From cdad5e93a0c7e120eebd3219f3e56e3d583d53ce Mon Sep 17 00:00:00 2001 From: vuonojenmustaturska Date: Wed, 22 May 2019 15:41:11 +0300 Subject: [PATCH] Removes some unnecessary wrapper procs (#44061) * unwrap some things * actually let's not #define this either --- code/__DEFINES/status_effects.dm | 4 ++++ code/game/machinery/stasis.dm | 10 +++++----- code/modules/mob/living/carbon/alien/larva/life.dm | 2 +- code/modules/mob/living/carbon/human/life.dm | 10 ++++------ code/modules/mob/living/carbon/life.dm | 2 +- code/modules/mob/living/carbon/monkey/life.dm | 2 +- code/modules/mob/living/life.dm | 2 +- code/modules/mob/living/living.dm | 5 ++--- code/modules/mob/living/status_procs.dm | 8 -------- 9 files changed, 19 insertions(+), 26 deletions(-) diff --git a/code/__DEFINES/status_effects.dm b/code/__DEFINES/status_effects.dm index b50423cc80c..47d7a8dff3b 100644 --- a/code/__DEFINES/status_effects.dm +++ b/code/__DEFINES/status_effects.dm @@ -122,3 +122,7 @@ #define STATUS_EFFECT_RAINBOWPROTECTION /datum/status_effect/rainbow_protection //Invulnerable and pacifistic #define STATUS_EFFECT_SLIMESKIN /datum/status_effect/slimeskin //Increased armor + +// Stasis helpers + +#define IS_IN_STASIS(mob) (mob.has_status_effect(STATUS_EFFECT_STASIS)) diff --git a/code/game/machinery/stasis.dm b/code/game/machinery/stasis.dm index 4eebeb23107..2069b012001 100644 --- a/code/game/machinery/stasis.dm +++ b/code/game/machinery/stasis.dm @@ -44,7 +44,7 @@ /obj/machinery/stasis/Exited(atom/movable/AM, atom/newloc) if(AM == occupant) var/mob/living/L = AM - if(L.IsInStasis()) + if(IS_IN_STASIS(L)) thaw_them(L) . = ..() @@ -95,12 +95,12 @@ return var/freq = rand(24750, 26550) playsound(src, 'sound/effects/spray.ogg', 5, TRUE, 2, frequency = freq) - target.SetStasis(TRUE) + target.apply_status_effect(STATUS_EFFECT_STASIS, null, TRUE) target.ExtinguishMob() use_power = ACTIVE_POWER_USE /obj/machinery/stasis/proc/thaw_them(mob/living/target) - target.SetStasis(FALSE) + target.remove_status_effect(STATUS_EFFECT_STASIS) if(target == occupant) use_power = IDLE_POWER_USE @@ -124,9 +124,9 @@ return var/mob/living/L_occupant = occupant if(stasis_running()) - if(!L_occupant.IsInStasis()) + if(!IS_IN_STASIS(L_occupant)) chill_out(L_occupant) - else if(L_occupant.IsInStasis()) + else if(IS_IN_STASIS(L_occupant)) thaw_them(L_occupant) /obj/machinery/stasis/screwdriver_act(mob/living/user, obj/item/I) diff --git a/code/modules/mob/living/carbon/alien/larva/life.dm b/code/modules/mob/living/carbon/alien/larva/life.dm index 51fe5e2e100..acfe3f6fafb 100644 --- a/code/modules/mob/living/carbon/alien/larva/life.dm +++ b/code/modules/mob/living/carbon/alien/larva/life.dm @@ -4,7 +4,7 @@ set invisibility = 0 if (notransform) return - if(..() && !IsInStasis()) //not dead and not in stasis + if(..() && !IS_IN_STASIS(src)) //not dead and not in stasis // GROW! if(amount_grown < max_grown) amount_grown++ diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index ca3e63f38d4..761c01d9977 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -28,9 +28,11 @@ if (QDELETED(src)) return 0 - if(!IsInStasis()) + if(!IS_IN_STASIS(src)) if(.) //not dead - handle_active_genes() + + for(var/datum/mutation/human/HM in dna.mutations) // Handle active genes + HM.on_life() if(stat != DEAD) //heart attack stuff @@ -310,10 +312,6 @@ clear_alert("embeddedobject") SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "embedded") -/mob/living/carbon/human/proc/handle_active_genes() - for(var/datum/mutation/human/HM in dna.mutations) - HM.on_life() - /mob/living/carbon/human/proc/handle_heart() var/we_breath = !HAS_TRAIT_FROM(src, TRAIT_NOBREATH, SPECIES_TRAIT) diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 93a60d4679f..dc051b0ad1b 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -8,7 +8,7 @@ damageoverlaytemp = 0 update_damage_hud() - if(!IsInStasis()) + if(!IS_IN_STASIS(src)) if(stat != DEAD) //Reagent processing needs to come before breathing, to prevent edge cases. handle_organs() diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index 624ed6d0160..9f7fdbe96e4 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -9,7 +9,7 @@ if (notransform) return - if(..() && !IsInStasis()) + if(..() && !IS_IN_STASIS(src)) if(!client) if(stat == CONSCIOUS) diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index ef4287afc81..0d40c75d80b 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -35,7 +35,7 @@ if(!loc) return - if(!IsInStasis()) + if(!IS_IN_STASIS(src)) if(stat != DEAD) //Mutations and radiation diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 9f6616d96fd..15c6e1ac38f 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -383,7 +383,7 @@ death() /mob/living/incapacitated(ignore_restraints = FALSE, ignore_grab = FALSE, check_immobilized = FALSE, ignore_stasis = FALSE) - if(stat || IsUnconscious() || IsStun() || IsParalyzed() || (check_immobilized && IsImmobilized()) || (!ignore_restraints && restrained(ignore_grab)) || (!ignore_stasis && IsInStasis())) + if(stat || IsUnconscious() || IsStun() || IsParalyzed() || (check_immobilized && IsImmobilized()) || (!ignore_restraints && restrained(ignore_grab)) || (!ignore_stasis && IS_IN_STASIS(src))) return TRUE /mob/living/canUseStorage() @@ -1097,8 +1097,7 @@ var/stun = IsStun() var/knockdown = IsKnockdown() var/ignore_legs = get_leg_ignore() - var/in_stasis = IsInStasis() - var/canmove = !IsImmobilized() && !stun && conscious && !paralyzed && !buckled && (!stat_softcrit || !pulledby) && !chokehold && !IsFrozen() && !in_stasis && (has_arms || ignore_legs || has_legs) + var/canmove = !IsImmobilized() && !stun && conscious && !paralyzed && !buckled && (!stat_softcrit || !pulledby) && !chokehold && !IsFrozen() && !IS_IN_STASIS(src) && (has_arms || ignore_legs || has_legs) if(canmove) mobility_flags |= MOBILITY_MOVE else diff --git a/code/modules/mob/living/status_procs.dm b/code/modules/mob/living/status_procs.dm index 1d41e25a334..b5747b1f65e 100644 --- a/code/modules/mob/living/status_procs.dm +++ b/code/modules/mob/living/status_procs.dm @@ -374,14 +374,6 @@ priority_absorb_key["stuns_absorbed"] += amount return TRUE -/////////////////////////////////// STASIS /////////////////////////////////// - -/mob/living/proc/IsInStasis() - . = has_status_effect(STATUS_EFFECT_STASIS) - -/mob/living/proc/SetStasis(apply, updating = TRUE) - . = apply ? apply_status_effect(STATUS_EFFECT_STASIS, null, updating) : remove_status_effect(STATUS_EFFECT_STASIS) - /////////////////////////////////// DISABILITIES //////////////////////////////////// /mob/living/proc/add_quirk(quirktype, spawn_effects) //separate proc due to the way these ones are handled if(HAS_TRAIT(src, quirktype))