From 7006f2b1beae7ea2d446c53db67289060a308e14 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Mon, 6 Jan 2020 04:23:52 -0800 Subject: [PATCH] more compile stuff --- code/__DEFINES/components.dm | 9 +++++++++ code/modules/mob/living/living.dm | 8 ++------ code/modules/mob/living/status_procs.dm | 27 ++++++++++++++++++------- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index 7b2dd8663c..4352ada0cf 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -198,6 +198,15 @@ #define COMSIG_LIVING_MINOR_SHOCK "living_minor_shock" //sent by stuff like stunbatons and tasers: () #define COMSIG_LIVING_GUN_PROCESS_FIRE "living_gun_process_fire" //from base of /obj/item/gun/proc/process_fire(): (atom/target, params, zone_override) +//ALL OF THESE DO NOT TAKE INTO ACCOUNT WHETHER AMOUNT IS 0 OR LOWER AND ARE SENT REGARDLESS! +#define COMSIG_LIVING_STATUS_STUN "living_stun" //from base of mob/living/Stun() (amount, update, ignore) +#define COMSIG_LIVING_STATUS_KNOCKDOWN "living_knockdown" //from base of mob/living/Knockdown() (amount, update, ignore) +#define COMSIG_LIVING_STATUS_PARALYZE "living_paralyze" //from base of mob/living/Paralyze() (amount, update, ignore) +#define COMSIG_LIVING_STATUS_IMMOBILIZE "living_immobilize" //from base of mob/living/Immobilize() (amount, update, ignore) +#define COMSIG_LIVING_STATUS_UNCONSCIOUS "living_unconscious" //from base of mob/living/Unconscious() (amount, update, ignore) +#define COMSIG_LIVING_STATUS_SLEEP "living_sleeping" //from base of mob/living/Sleeping() (amount, update, ignore) + #define COMPONENT_NO_STUN 1 //For all of them + // /mob/living/carbon signals #define COMSIG_CARBON_SOUNDBANG "carbon_soundbang" //from base of mob/living/carbon/soundbang_act(): (list(intensity)) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index df596ec785..02e398cb6a 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -500,8 +500,7 @@ setStaminaLoss(0, 0) SetUnconscious(0, FALSE) set_disgust(0) - SetStun(0, FALSE) - SetKnockdown(0, FALSE) + SetAllImmobility(0, FALSE) SetSleeping(0, FALSE) radiation = 0 nutrition = NUTRITION_LEVEL_FED + 50 @@ -1185,10 +1184,7 @@ SetSleeping(clamp_unconscious_to) if(AmountUnconscious() > clamp_unconscious_to) SetUnconscious(clamp_unconscious_to) - if(AmountStun() > clamp_immobility_to) - SetStun(clamp_immobility_to) - if(AmountKnockdown() > clamp_immobility_to) - SetKnockdown(clamp_immobility_to) + HealAllImmobilityUpTo(clamp_immobility_to) adjustStaminaLoss(min(0, -stamina_boost)) adjustStaminaLossBuffered(min(0, -stamina_buffer_boost)) if(scale_stamina_loss_recovery) diff --git a/code/modules/mob/living/status_procs.dm b/code/modules/mob/living/status_procs.dm index 0569722098..7ea27a9106 100644 --- a/code/modules/mob/living/status_procs.dm +++ b/code/modules/mob/living/status_procs.dm @@ -37,7 +37,7 @@ if(((status_flags & CANSTUN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) return - var/datum/status_effect/incapacitating/stun/S = IsStun() + var/datum/status_effect/incapacitating/stun/S = _MOBILITYFLAGTEMPORARY_IsStun() if(S) S.duration = max(world.time + amount, S.duration) else if(amount > 0) @@ -48,7 +48,7 @@ if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_STUN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANSTUN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) - var/datum/status_effect/incapacitating/stun/S = IsStun() + var/datum/status_effect/incapacitating/stun/S = _MOBILITYFLAGTEMPORARY_IsStun() if(amount <= 0) if(S) qdel(S) @@ -67,7 +67,7 @@ if(((status_flags & CANSTUN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) return - var/datum/status_effect/incapacitating/stun/S = IsStun() + var/datum/status_effect/incapacitating/stun/S = _MOBILITYFLAGTEMPORARY_IsStun() if(S) S.duration += amount else if(amount > 0) @@ -80,7 +80,7 @@ return has_status_effect(STATUS_EFFECT_KNOCKDOWN) /mob/living/proc/_MOBILITYFLAGTEMPORARY_AmountKnockdown() //How many deciseconds remain in our knockdown - var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown() + var/datum/status_effect/incapacitating/knockdown/K = _MOBILITYFLAGTEMPORARY_IsKnockdown() if(K) return K.duration - world.time return 0 @@ -91,7 +91,7 @@ if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) return - var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown() + var/datum/status_effect/incapacitating/knockdown/K = _MOBILITYFLAGTEMPORARY_IsKnockdown() if(K) K.duration = max(world.time + amount, K.duration) else if(amount > 0) @@ -102,7 +102,7 @@ if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_KNOCKDOWN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) - var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown() + var/datum/status_effect/incapacitating/knockdown/K = _MOBILITYFLAGTEMPORARY_IsKnockdown() if(amount <= 0) if(K) qdel(K) @@ -121,7 +121,7 @@ if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) return - var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown() + var/datum/status_effect/incapacitating/knockdown/K = _MOBILITYFLAGTEMPORARY_IsKnockdown() if(K) K.duration += amount else if(amount > 0) @@ -259,6 +259,19 @@ if(updating) update_mobility() +//makes sure nothing is longer +/mob/living/proc/HealAllImmobilityupto(amount, updating, ignore_canstun = FALSE) + if(AmountStun() > amount) + SetStun(amount, FALSE, ignore_canstun) + if(AmountKnockdown() > amount) + SetKnockdown(amount, FALSE, ignore_canstun) + if(AmountParalyzed() > amount) + SetParalyzed(amount, FALSE, ignore_canstun) + if(AmountImmobilized() > amount) + SetImmobilized(amount, FALSE, ignore_canstun) + if(updating) + update_mobility() + //////////////////UNCONSCIOUS /mob/living/proc/_MOBILITYFLAGTEMPORARY_IsUnconscious() //If we're unconscious return has_status_effect(STATUS_EFFECT_UNCONSCIOUS)