Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PORT] 'Adds some extra flags and args to electrocute_act' from TG (PR#78374) #592

Merged
merged 1 commit into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 18 additions & 10 deletions code/modules/mob/living/carbon/carbon_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions code/modules/mob/living/carbon/human/human_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
. = ..()
Expand Down
Loading