Skip to content

Commit

Permalink
Merge pull request #255 from K3Licia/system-shock
Browse files Browse the repository at this point in the history
"Have You Tried Turning It off and on Again?" | NEW NEGATIVE QUIRK
  • Loading branch information
Paxilmaniac authored Nov 29, 2024
2 parents a8e580c + 9788dd2 commit a14406b
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 0 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/~doppler_defines/traits/declarations.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// The trait that determines if someone has the system shock quirk.
#define TRAIT_SYSTEM_SHOCK "trait_system_shock"

1 change: 1 addition & 0 deletions code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_IGNORE_FIRE_PROTECTION" = TRAIT_IGNORE_FIRE_PROTECTION,
"TRAIT_LEFT_EYE_SCAR" = TRAIT_LEFT_EYE_SCAR,
"TRAIT_RIGHT_EYE_SCAR" = TRAIT_RIGHT_EYE_SCAR,
"TRAIT_SYSTEM_SHOCK" = TRAIT_SYSTEM_SHOCK, // DOPPLER EDIT ADDITION
),
/obj/item = list(
"TRAIT_APC_SHOCKING" = TRAIT_APC_SHOCKING,
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/traits/admin_tooling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ GLOBAL_LIST_INIT(admin_visible_traits, list(
"TRAIT_IGNORE_FIRE_PROTECTION" = TRAIT_IGNORE_FIRE_PROTECTION,
"TRAIT_LEFT_EYE_SCAR" = TRAIT_LEFT_EYE_SCAR,
"TRAIT_RIGHT_EYE_SCAR" = TRAIT_RIGHT_EYE_SCAR,
"TRAIT_SYSTEM_SHOCK" = TRAIT_SYSTEM_SHOCK, // DOPPLER EDIT ADDITION
),
/obj/item = list(
"TRAIT_APC_SHOCKING" = TRAIT_APC_SHOCKING,
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/robot/items/generic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
span_userdanger("[user] prods you with [src]!"),
)

SEND_SIGNAL(attacked_mob, COMSIG_LIVING_MINOR_SHOCK) // DOPPLER EDIT ADDITION
playsound(loc, 'sound/items/weapons/egloves.ogg', 50, TRUE, -1)
cooldown_check = world.time + cooldown
log_combat(user, attacked_mob, "stunned", src, "(Combat mode: [user.combat_mode ? "On" : "Off"])")
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/brain/MMI.dm
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@
if(3)
brainmob.emp_damage = min(brainmob.emp_damage + rand(0,10), 30)
brainmob.emote("alarm")
SEND_SIGNAL(brainmob, COMSIG_LIVING_MINOR_SHOCK) // DOPPLER EDIT ADDITION

/obj/item/mmi/atom_deconstruct(disassembled = TRUE)
if(brain)
Expand Down
31 changes: 31 additions & 0 deletions modular_doppler/modular_quirks/system_shock/system_shock.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/datum/quirk/system_shock
name = "System Shock"
desc = "You and electricity have a volatile relationship. One spark's liable to forcefully reboot your systems. Note: This quirk only works on synths."
gain_text = span_danger("You start feeling nervous around plug sockets.")
lose_text = span_notice("You feel normal about sparks.")
medical_record_text = "Patient's processors are unusually uninsulated."
value = -8
mob_trait = TRAIT_SYSTEM_SHOCK
icon = FA_ICON_PLUG_CIRCLE_XMARK
quirk_flags = QUIRK_HUMAN_ONLY

/datum/quirk/system_shock/add(client/client_source)
if(isandroid(quirk_holder))
RegisterSignals(quirk_holder, list(COMSIG_LIVING_ELECTROCUTE_ACT, COMSIG_LIVING_MINOR_SHOCK), PROC_REF(on_electrocute))

/datum/quirk/system_shock/remove()
UnregisterSignal(quirk_holder, list(COMSIG_LIVING_ELECTROCUTE_ACT, COMSIG_LIVING_MINOR_SHOCK))


/datum/quirk/system_shock/proc/on_electrocute()
SIGNAL_HANDLER
var/knockout_length = 20 SECONDS + rand(0 SECONDS, 5 SECONDS)
quirk_holder.set_static_vision(knockout_length)
quirk_holder.balloon_alert(quirk_holder, "system rebooting")
to_chat(quirk_holder, span_danger("CRIT&!AL ERR%R: S#STEM REBO#TING."))
//The intent with the 0.4 seconds is so that the visual static effect lasts longer than the actual knockout/sleeping effect.
addtimer(CALLBACK(src, PROC_REF(knock_out), knockout_length - 0.4 SECONDS), 2 SECONDS)

///The length at which unconsciousness lasts during system shock.
/datum/quirk/system_shock/proc/knock_out(length)
quirk_holder.Sleeping(length)
2 changes: 2 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@
#include "code\__DEFINES\~doppler_defines\traits.dm"
#include "code\__DEFINES\~doppler_defines\vv.dm"
#include "code\__DEFINES\~doppler_defines\wounds.dm"
#include "code\__DEFINES\~doppler_defines\traits\declarations.dm"
#include "code\__HELPERS\_auxtools_api.dm"
#include "code\__HELPERS\_dreamluau.dm"
#include "code\__HELPERS\_lists.dm"
Expand Down Expand Up @@ -7054,6 +7055,7 @@
#include "modular_doppler\modular_quirks\paycheck_rations\code\tickets.dm"
#include "modular_doppler\modular_quirks\permitted_cybernetic\permitted_cybernetic.dm"
#include "modular_doppler\modular_quirks\permitted_cybernetic\code\preferences.dm"
#include "modular_doppler\modular_quirks\system_shock\system_shock.dm"
#include "modular_doppler\modular_sounds\code\sounds.dm"
#include "modular_doppler\modular_species\_species.dm"
#include "modular_doppler\modular_species\code\bloodsplatter.dm"
Expand Down

0 comments on commit a14406b

Please sign in to comment.