diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 4406a1cdec7..78e08706ed3 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -240,15 +240,6 @@ show_message(span_userdanger("The blob attacks!")) adjustBruteLoss(10) -/mob/living/carbon/emp_act(severity) - . = ..() - if(. & EMP_PROTECT_CONTENTS) - return - for(var/obj/item/organ/organ as anything in organs) - organ.emp_act(severity) - for(var/obj/item/bodypart/bodypart as anything in src.bodyparts) - bodypart.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, jitter_time = 20 SECONDS, stutter_time = 4 SECONDS, stun_duration = 4 SECONDS) . = ..() diff --git a/code/modules/surgery/bodyparts/_bodyparts.dm b/code/modules/surgery/bodyparts/_bodyparts.dm index 20b685fdcae..fe5f4facc45 100644 --- a/code/modules/surgery/bodyparts/_bodyparts.dm +++ b/code/modules/surgery/bodyparts/_bodyparts.dm @@ -1407,12 +1407,24 @@ else update_icon_dropped() -// Note: Does NOT return EMP protection value from parent call or pass it on to subtypes +// Note: For effects on subtypes, use the emp_effect() proc instead /obj/item/bodypart/emp_act(severity) var/protection = ..() - if((protection & EMP_PROTECT_WIRES) || !IS_ROBOTIC_LIMB(src)) - return FALSE + // If the limb doesn't protect contents, strike them first + if(!(protection & EMP_PROTECT_CONTENTS)) + for(var/atom/content as anything in contents) + content.emp_act(severity) + + if((protection & (EMP_PROTECT_WIRES | EMP_PROTECT_SELF))) + return protection + emp_effect(severity, protection) + return protection + +/// The actual effect of EMPs on the limb. Allows children to override it however they want +/obj/item/bodypart/proc/emp_effect(severity, protection) + if(!IS_ROBOTIC_LIMB(src)) + return FALSE // with defines at the time of writing, this is 2 brute and 1.5 burn // 2 + 1.5 = 3,5, with 6 limbs thats 21, on a heavy 42 // 42 * 0.8 = 33.6 diff --git a/code/modules/surgery/bodyparts/robot_bodyparts.dm b/code/modules/surgery/bodyparts/robot_bodyparts.dm index cdd92df7b88..0891e32cb16 100644 --- a/code/modules/surgery/bodyparts/robot_bodyparts.dm +++ b/code/modules/surgery/bodyparts/robot_bodyparts.dm @@ -115,7 +115,7 @@ damage_examines = list(BRUTE = ROBOTIC_BRUTE_EXAMINE_TEXT, BURN = ROBOTIC_BURN_EXAMINE_TEXT) bodypart_flags = BODYPART_UNHUSKABLE -/obj/item/bodypart/leg/left/robot/emp_act(severity) +/obj/item/bodypart/leg/left/robot/emp_effect(severity, protection) . = ..() if(!. || isnull(owner)) return @@ -125,8 +125,9 @@ knockdown_time *= 2 owner.Knockdown(knockdown_time) if(owner.incapacitated(IGNORE_RESTRAINTS|IGNORE_GRAB)) // So the message isn't duplicated. If they were stunned beforehand by something else, then the message not showing makes more sense anyways. - return + return FALSE to_chat(owner, span_danger("As your [plaintext_zone] unexpectedly malfunctions, it causes you to fall to the ground!")) + return /obj/item/bodypart/leg/right/robot name = "cyborg right leg" @@ -163,7 +164,7 @@ damage_examines = list(BRUTE = ROBOTIC_BRUTE_EXAMINE_TEXT, BURN = ROBOTIC_BURN_EXAMINE_TEXT) bodypart_flags = BODYPART_UNHUSKABLE -/obj/item/bodypart/leg/right/robot/emp_act(severity) +/obj/item/bodypart/leg/right/robot/emp_effect(severity, protection) . = ..() if(!. || isnull(owner)) return @@ -173,8 +174,9 @@ knockdown_time *= 2 owner.Knockdown(knockdown_time) if(owner.incapacitated(IGNORE_RESTRAINTS|IGNORE_GRAB)) // So the message isn't duplicated. If they were stunned beforehand by something else, then the message not showing makes more sense anyways. - return + return FALSE to_chat(owner, span_danger("As your [plaintext_zone] unexpectedly malfunctions, it causes you to fall to the ground!")) + return /obj/item/bodypart/chest/robot name = "cyborg torso" @@ -215,7 +217,7 @@ var/wired = FALSE var/obj/item/stock_parts/cell/cell = null -/obj/item/bodypart/chest/robot/emp_act(severity) +/obj/item/bodypart/chest/robot/emp_effect(severity, protection) . = ..() if(!. || isnull(owner)) return @@ -236,6 +238,7 @@ to_chat(owner, span_danger("Your [plaintext_zone]'s logic boards temporarily become unresponsive!")) owner.Stun(stun_time) owner.Shake(pixelshiftx = shift_x, pixelshifty = shift_y, duration = shake_duration) + return /obj/item/bodypart/chest/robot/get_cell() return cell @@ -394,7 +397,7 @@ #define EMP_GLITCH "EMP_GLITCH" -/obj/item/bodypart/head/robot/emp_act(severity) +/obj/item/bodypart/head/robot/emp_effect(severity, protection) . = ..() if(!. || isnull(owner)) return @@ -408,6 +411,7 @@ owner.add_client_colour(/datum/client_colour/malfunction) addtimer(CALLBACK(owner, TYPE_PROC_REF(/mob/living/carbon/human, remove_client_colour), /datum/client_colour/malfunction), glitch_duration) + return #undef EMP_GLITCH