diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index c453ada5c2a..2814e0dbad8 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -363,6 +363,16 @@ #define SHOCK_ILLUSION (1 << 2) ///The shock doesn't stun. #define SHOCK_NOSTUN (1 << 3) +/// No default message is sent from the shock +#define SHOCK_SUPPRESS_MESSAGE (1 << 4) +/// No skeleton animation if a human was shocked +#define SHOCK_NO_HUMAN_ANIM (1 << 5) +/// Ignores TRAIT_STUNIMMUNE +#define SHOCK_IGNORE_IMMUNITY (1 << 6) +/// Prevents the immediate stun, instead only gives the delay +#define SHOCK_DELAY_STUN (1 << 7) +/// Makes the paralyze into a knockdown +#define SHOCK_KNOCKDOWN (1 << 8) #define INCORPOREAL_MOVE_BASIC 1 /// normal movement, see: [/mob/living/var/incorporeal_move] #define INCORPOREAL_MOVE_SHADOW 2 /// leaves a trail of shadows diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 32733c1d827..79c7c7a8032 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -373,7 +373,7 @@ internal_organ.emp_act(severity) ///Adds to the parent by also adding functionality to propagate shocks through pulling and doing some fluff effects. -/mob/living/carbon/electrocute_act(shock_damage, source, siemens_coeff = 1, flags = NONE) +/mob/living/carbon/electrocute_act(shock_damage, source, siemens_coeff = 1, flags = NONE, jitter_time = 20 SECONDS, stutter_time = 4 SECONDS, stun_duration = 4 SECONDS) . = ..() if(!.) return @@ -394,22 +394,30 @@ //Found our victims, now lets shock them all for(var/victim in shocking_queue) var/mob/living/carbon/C = victim - C.electrocute_act(shock_damage*0.75, src, 1, flags) + C.electrocute_act(shock_damage*0.75, src, 1, flags, jitter_time, stutter_time, stun_duration) //Stun var/should_stun = (!(flags & SHOCK_TESLA) || siemens_coeff > 0.5) && !(flags & SHOCK_NOSTUN) - if(should_stun) - Paralyze(40) + var/paralyze = !(flags & SHOCK_KNOCKDOWN) + var/immediately_stun = should_stun && !(flags & SHOCK_DELAY_STUN) + if(immediately_stun) + if(paralyze) + Paralyze(stun_duration) + else + Knockdown(stun_duration) //Jitter and other fluff. do_jitter_animation(300) - adjust_jitter(20 SECONDS) - adjust_stutter(4 SECONDS) - addtimer(CALLBACK(src, PROC_REF(secondary_shock), should_stun), 2 SECONDS) + adjust_jitter(jitter_time) + adjust_stutter(stutter_time) + if(should_stun) + addtimer(CALLBACK(src, PROC_REF(secondary_shock), paralyze, stun_duration * 1.5), 2 SECONDS) return shock_damage ///Called slightly after electrocute act to apply a secondary stun. -/mob/living/carbon/proc/secondary_shock(should_stun) - if(should_stun) - Paralyze(60) +/mob/living/carbon/proc/secondary_shock(paralyze, stun_duration) + if(paralyze) + Paralyze(stun_duration) + else + Knockdown(stun_duration) /mob/living/carbon/proc/help_shake_act(mob/living/carbon/helper) if(on_fire) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index fb7cba462e9..f082b7944ab 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -485,7 +485,7 @@ ///Calculates the siemens coeff based on clothing and species, can also restart hearts. -/mob/living/carbon/human/electrocute_act(shock_damage, source, siemens_coeff = 1, flags = NONE) +/mob/living/carbon/human/electrocute_act(shock_damage, source, siemens_coeff = 1, flags = NONE, jitter_time = 20 SECONDS, stutter_time = 4 SECONDS, stun_duration = 4 SECONDS) //Calculates the siemens coeff based on clothing. Completely ignores the arguments if(flags & SHOCK_TESLA) //I hate this entire block. This gets the siemens_coeff for tesla shocks if(gloves && gloves.siemens_coefficient <= 0) @@ -512,7 +512,8 @@ var/obj/item/organ/internal/heart/heart = getorganslot(ORGAN_SLOT_HEART) if(heart.Restart() && stat == CONSCIOUS) to_chat(src, span_notice("You feel your heart beating again!")) - electrocution_animation(40) + if(!(flags & SHOCK_NO_HUMAN_ANIM)) + electrocution_animation(4 SECONDS) /mob/living/carbon/human/emp_act(severity) . = ..()