diff --git a/code/__DEFINES/traits/declarations.dm b/code/__DEFINES/traits/declarations.dm index 81a3531c337..2e7e20abd97 100644 --- a/code/__DEFINES/traits/declarations.dm +++ b/code/__DEFINES/traits/declarations.dm @@ -7,6 +7,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai //atom traits /// Trait used to prevent an atom from component radiation emission (see radioactivity.dm) #define TRAIT_BLOCK_RADIATION "block_radiation" +/// Is this atom being actively shocked? Used to prevent repeated shocks. +#define TRAIT_BEING_SHOCKED "being_shocked" /// Weather immunities, also protect mobs inside them. #define TRAIT_LAVA_IMMUNE "lava_immune" //Used by lava turfs and The Floor Is Lava. diff --git a/code/__DEFINES/traits/sources.dm b/code/__DEFINES/traits/sources.dm index b94dba6f701..980d6b3a256 100644 --- a/code/__DEFINES/traits/sources.dm +++ b/code/__DEFINES/traits/sources.dm @@ -19,6 +19,9 @@ #define EAR_DAMAGE "ear_damage" #define EYE_DAMAGE "eye_damage" +/// Trait sorce for "was recently shocked by something" +#define WAS_SHOCKED "was_shocked" + /// cannot be removed without admin intervention #define ROUNDSTART_TRAIT "roundstart" diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index 404ab1867e0..fbd9bade0b5 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -7,6 +7,7 @@ */ GLOBAL_LIST_INIT(traits_by_type, list( /atom = list( + "TRAIT_BEING_SHOCKED" = TRAIT_BEING_SHOCKED, "TRAIT_BLOCK_RADIATION" = TRAIT_BLOCK_RADIATION, "TRAIT_CMAGGED" = TRAIT_CMAGGED, ), diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm index b83379f18de..a3d9acc8a30 100644 --- a/code/modules/power/tesla/energy_ball.dm +++ b/code/modules/power/tesla/energy_ball.dm @@ -225,7 +225,7 @@ else if(isliving(A)) var/dist = get_dist(source, A) var/mob/living/L = A - if(dist <= zap_range && (dist < closest_dist || !closest_mob) && L.stat != DEAD && !HAS_TRAIT(L, TRAIT_TESLA_SHOCKIMMUNE)) + if(dist <= zap_range && (dist < closest_dist || !closest_mob) && L.stat != DEAD && !HAS_TRAIT(L, TRAIT_TESLA_SHOCKIMMUNE) && !HAS_TRAIT(L, TRAIT_BEING_SHOCKED)) closest_mob = L closest_atom = A closest_dist = dist @@ -279,8 +279,10 @@ closest_grounding_rod.tesla_act(power, explosive) else if(closest_mob) + ADD_TRAIT(closest_mob, TRAIT_BEING_SHOCKED, WAS_SHOCKED) + addtimer(TRAIT_CALLBACK_REMOVE(closest_mob, TRAIT_BEING_SHOCKED, WAS_SHOCKED), 1 SECONDS) var/shock_damage = clamp(round(power/400), 10, 90) + rand(-5, 5) - closest_mob.electrocute_act(shock_damage, "шара тесла", flags = SHOCK_TESLA) + closest_mob.electrocute_act(shock_damage, "шара тесла", flags = SHOCK_TESLA | (stun_mobs ? NONE : SHOCK_NOSTUN)) if(issilicon(closest_mob)) var/mob/living/silicon/S = closest_mob if(stun_mobs)