refactor tags
This commit is contained in:
@@ -22,11 +22,11 @@
|
||||
|
||||
////////////////////////////// STUN ////////////////////////////////////
|
||||
|
||||
/mob/living/proc/_REFACTORING_IsStun() //If we're stunned
|
||||
/mob/living/proc/IsStun() //If we're stunned
|
||||
return has_status_effect(STATUS_EFFECT_STUN)
|
||||
|
||||
/mob/living/proc/_REFACTORING_AmountStun() //How many deciseconds remain in our stun
|
||||
var/datum/status_effect/incapacitating/stun/S = _REFACTORING_IsStun()
|
||||
/mob/living/proc/AmountStun() //How many deciseconds remain in our stun
|
||||
var/datum/status_effect/incapacitating/stun/S = IsStun()
|
||||
if(S)
|
||||
return S.duration - world.time
|
||||
return 0
|
||||
@@ -37,18 +37,18 @@
|
||||
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 = _REFACTORING_IsStun()
|
||||
var/datum/status_effect/incapacitating/stun/S = IsStun()
|
||||
if(S)
|
||||
S.duration = max(world.time + amount, S.duration)
|
||||
else if(amount > 0)
|
||||
S = apply_status_effect(STATUS_EFFECT_STUN, amount, updating)
|
||||
return S
|
||||
|
||||
/mob/living/proc/_REFACTORING_SetStun(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration
|
||||
/mob/living/proc/SetStun(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration
|
||||
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 = _REFACTORING_IsStun()
|
||||
var/datum/status_effect/incapacitating/stun/S = IsStun()
|
||||
if(amount <= 0)
|
||||
if(S)
|
||||
qdel(S)
|
||||
@@ -61,13 +61,13 @@
|
||||
S = apply_status_effect(STATUS_EFFECT_STUN, amount, updating)
|
||||
return S
|
||||
|
||||
/mob/living/proc/_REFACTORING_AdjustStun(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration
|
||||
/mob/living/proc/AdjustStun(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration
|
||||
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)
|
||||
if(absorb_stun(amount, ignore_canstun))
|
||||
return
|
||||
var/datum/status_effect/incapacitating/stun/S = _REFACTORING_IsStun()
|
||||
var/datum/status_effect/incapacitating/stun/S = IsStun()
|
||||
if(S)
|
||||
S.duration += amount
|
||||
else if(amount > 0)
|
||||
@@ -76,33 +76,33 @@
|
||||
|
||||
///////////////////////////////// KNOCKDOWN /////////////////////////////////////
|
||||
|
||||
/mob/living/proc/_REFACTORING_IsKnockdown() //If we're knocked down
|
||||
/mob/living/proc/IsKnockdown() //If we're knocked down
|
||||
return has_status_effect(STATUS_EFFECT_KNOCKDOWN)
|
||||
|
||||
/mob/living/proc/_REFACTORING_AmountKnockdown() //How many deciseconds remain in our knockdown
|
||||
var/datum/status_effect/incapacitating/knockdown/K = _REFACTORING_IsKnockdown()
|
||||
/mob/living/proc/AmountKnockdown() //How many deciseconds remain in our knockdown
|
||||
var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown()
|
||||
if(K)
|
||||
return K.duration - world.time
|
||||
return 0
|
||||
|
||||
/mob/living/proc/_REFACTORING_Knockdown(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration
|
||||
/mob/living/proc/Knockdown(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration
|
||||
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)
|
||||
if(absorb_stun(amount, ignore_canstun))
|
||||
return
|
||||
var/datum/status_effect/incapacitating/knockdown/K = _REFACTORING_IsKnockdown()
|
||||
var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown()
|
||||
if(K)
|
||||
K.duration = max(world.time + amount, K.duration)
|
||||
else if(amount > 0)
|
||||
K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount, updating)
|
||||
return K
|
||||
|
||||
/mob/living/proc/_REFACTORING_SetKnockdown(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration
|
||||
/mob/living/proc/SetKnockdown(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration
|
||||
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 = _REFACTORING_IsKnockdown()
|
||||
var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown()
|
||||
if(amount <= 0)
|
||||
if(K)
|
||||
qdel(K)
|
||||
@@ -115,13 +115,13 @@
|
||||
K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount, updating)
|
||||
return K
|
||||
|
||||
/mob/living/proc/_REFACTORING_AdjustKnockdown(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration
|
||||
/mob/living/proc/AdjustKnockdown(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration
|
||||
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)
|
||||
if(absorb_stun(amount, ignore_canstun))
|
||||
return
|
||||
var/datum/status_effect/incapacitating/knockdown/K = _REFACTORING_IsKnockdown()
|
||||
var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown()
|
||||
if(K)
|
||||
K.duration += amount
|
||||
else if(amount > 0)
|
||||
@@ -290,7 +290,7 @@
|
||||
//Blanket
|
||||
/mob/living/proc/AllImmobility(amount, updating, ignore_canstun = FALSE)
|
||||
Paralyze(amount, FALSE, ignore_canstun)
|
||||
_REFACTORING_Knockdown(amount, FALSE, ignore_canstun)
|
||||
Knockdown(amount, FALSE, ignore_canstun)
|
||||
Stun(amount, FALSE, ignore_canstun)
|
||||
Immobilize(amount, FALSE, ignore_canstun)
|
||||
Daze(amount, FALSE, ignore_canstun)
|
||||
@@ -299,8 +299,8 @@
|
||||
|
||||
/mob/living/proc/SetAllImmobility(amount, updating, ignore_canstun = FALSE)
|
||||
SetParalyzed(amount, FALSE, ignore_canstun)
|
||||
_REFACTORING_SetKnockdown(amount, FALSE, ignore_canstun)
|
||||
_REFACTORING_SetStun(amount, FALSE, ignore_canstun)
|
||||
SetKnockdown(amount, FALSE, ignore_canstun)
|
||||
SetStun(amount, FALSE, ignore_canstun)
|
||||
SetImmobilized(amount, FALSE, ignore_canstun)
|
||||
SetDazed(amount, FALSE, ignore_canstun)
|
||||
if(updating)
|
||||
@@ -308,8 +308,8 @@
|
||||
|
||||
/mob/living/proc/AdjustAllImmobility(amount, updating, ignore_canstun = FALSE)
|
||||
AdjustParalyzed(amount, FALSE, ignore_canstun)
|
||||
_REFACTORING_AdjustKnockdown(amount, FALSE, ignore_canstun)
|
||||
_REFACTORING_AdjustStun(amount, FALSE, ignore_canstun)
|
||||
AdjustKnockdown(amount, FALSE, ignore_canstun)
|
||||
AdjustStun(amount, FALSE, ignore_canstun)
|
||||
AdjustImmobilized(amount, FALSE, ignore_canstun)
|
||||
AdjustDazed(amount, FALSE, ignore_canstun)
|
||||
if(updating)
|
||||
@@ -317,10 +317,10 @@
|
||||
|
||||
/// Makes sure all 5 of the non-knockout immobilizing status effects are lower or equal to amount.
|
||||
/mob/living/proc/HealAllImmobilityUpTo(amount, updating, ignore_canstun = FALSE)
|
||||
if(_REFACTORING_AmountStun() > amount)
|
||||
_REFACTORING_SetStun(amount, FALSE, ignore_canstun)
|
||||
if(_REFACTORING_AmountKnockdown() > amount)
|
||||
_REFACTORING_SetKnockdown(amount, FALSE, ignore_canstun)
|
||||
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)
|
||||
@@ -331,14 +331,14 @@
|
||||
update_mobility()
|
||||
|
||||
/mob/living/proc/HighestImmobilityAmount()
|
||||
return max(max(max(max(_REFACTORING_AmountStun(), _REFACTORING_AmountKnockdown()), AmountParalyzed()), AmountImmobilized()), AmountDazed())
|
||||
return max(max(max(max(AmountStun(), AmountKnockdown()), AmountParalyzed()), AmountImmobilized()), AmountDazed())
|
||||
|
||||
//////////////////UNCONSCIOUS
|
||||
/mob/living/proc/_REFACTORING_IsUnconscious() //If we're unconscious
|
||||
/mob/living/proc/IsUnconscious() //If we're unconscious
|
||||
return has_status_effect(STATUS_EFFECT_UNCONSCIOUS)
|
||||
|
||||
/mob/living/proc/AmountUnconscious() //How many deciseconds remain in our unconsciousness
|
||||
var/datum/status_effect/incapacitating/unconscious/U = _REFACTORING_IsUnconscious()
|
||||
var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious()
|
||||
if(U)
|
||||
return U.duration - world.time
|
||||
return 0
|
||||
@@ -347,7 +347,7 @@
|
||||
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, updating, ignore_canstun) & COMPONENT_NO_STUN)
|
||||
return
|
||||
if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
||||
var/datum/status_effect/incapacitating/unconscious/U = _REFACTORING_IsUnconscious()
|
||||
var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious()
|
||||
if(U)
|
||||
U.duration = max(world.time + amount, U.duration)
|
||||
else if(amount > 0)
|
||||
@@ -358,7 +358,7 @@
|
||||
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, updating, ignore_canstun) & COMPONENT_NO_STUN)
|
||||
return
|
||||
if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
||||
var/datum/status_effect/incapacitating/unconscious/U = _REFACTORING_IsUnconscious()
|
||||
var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious()
|
||||
if(amount <= 0)
|
||||
if(U)
|
||||
qdel(U)
|
||||
@@ -372,7 +372,7 @@
|
||||
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, updating, ignore_canstun) & COMPONENT_NO_STUN)
|
||||
return
|
||||
if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
||||
var/datum/status_effect/incapacitating/unconscious/U = _REFACTORING_IsUnconscious()
|
||||
var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious()
|
||||
if(U)
|
||||
U.duration += amount
|
||||
else if(amount > 0)
|
||||
@@ -381,11 +381,11 @@
|
||||
|
||||
/////////////////////////////////// SLEEPING ////////////////////////////////////
|
||||
|
||||
/mob/living/proc/_REFACTORING_IsSleeping() //If we're asleep
|
||||
/mob/living/proc/IsSleeping() //If we're asleep
|
||||
return has_status_effect(STATUS_EFFECT_SLEEPING)
|
||||
|
||||
/mob/living/proc/AmountSleeping() //How many deciseconds remain in our sleep
|
||||
var/datum/status_effect/incapacitating/sleeping/S = _REFACTORING_IsSleeping()
|
||||
var/datum/status_effect/incapacitating/sleeping/S = IsSleeping()
|
||||
if(S)
|
||||
return S.duration - world.time
|
||||
return 0
|
||||
@@ -394,7 +394,7 @@
|
||||
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, amount, updating, ignore_canstun) & COMPONENT_NO_STUN)
|
||||
return
|
||||
if((!HAS_TRAIT(src, TRAIT_SLEEPIMMUNE)) || ignore_canstun)
|
||||
var/datum/status_effect/incapacitating/sleeping/S = _REFACTORING_IsSleeping()
|
||||
var/datum/status_effect/incapacitating/sleeping/S = IsSleeping()
|
||||
if(S)
|
||||
S.duration = max(world.time + amount, S.duration)
|
||||
else if(amount > 0)
|
||||
@@ -405,7 +405,7 @@
|
||||
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, amount, updating, ignore_canstun) & COMPONENT_NO_STUN)
|
||||
return
|
||||
if((!HAS_TRAIT(src, TRAIT_SLEEPIMMUNE)) || ignore_canstun)
|
||||
var/datum/status_effect/incapacitating/sleeping/S = _REFACTORING_IsSleeping()
|
||||
var/datum/status_effect/incapacitating/sleeping/S = IsSleeping()
|
||||
if(amount <= 0)
|
||||
if(S)
|
||||
qdel(S)
|
||||
@@ -419,7 +419,7 @@
|
||||
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, amount, updating, ignore_canstun) & COMPONENT_NO_STUN)
|
||||
return
|
||||
if((!HAS_TRAIT(src, TRAIT_SLEEPIMMUNE)) || ignore_canstun)
|
||||
var/datum/status_effect/incapacitating/sleeping/S = _REFACTORING_IsSleeping()
|
||||
var/datum/status_effect/incapacitating/sleeping/S = IsSleeping()
|
||||
if(S)
|
||||
S.duration += amount
|
||||
else if(amount > 0)
|
||||
|
||||
Reference in New Issue
Block a user