|
|
|
@@ -2,9 +2,9 @@
|
|
|
|
|
//The effects include: stun, knockdown, unconscious, sleeping, resting, jitteriness, dizziness,
|
|
|
|
|
// eye damage, eye_blind, eye_blurry, druggy, TRAIT_BLIND trait, and TRAIT_NEARSIGHT trait.
|
|
|
|
|
|
|
|
|
|
#define IS_STUN_IMMUNE(source, ignore_canstun) ((source.status_flags & GODMODE) || (!ignore_canstun && (!(source.status_flags & CANKNOCKDOWN) || HAS_TRAIT(source, TRAIT_STUNIMMUNE))))
|
|
|
|
|
|
|
|
|
|
////////////////////////////// STUN ////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/* STUN */
|
|
|
|
|
/mob/living/proc/IsStun() //If we're stunned
|
|
|
|
|
return has_status_effect(STATUS_EFFECT_STUN)
|
|
|
|
|
|
|
|
|
@@ -17,54 +17,50 @@
|
|
|
|
|
/mob/living/proc/Stun(amount, ignore_canstun = FALSE) //Can't go below remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_STUN, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
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 = IsStun()
|
|
|
|
|
if(S)
|
|
|
|
|
S.duration = max(world.time + amount, S.duration)
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
S = apply_status_effect(STATUS_EFFECT_STUN, amount)
|
|
|
|
|
return S
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
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)
|
|
|
|
|
return S
|
|
|
|
|
|
|
|
|
|
/mob/living/proc/SetStun(amount, ignore_canstun = FALSE) //Sets remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_STUN, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(((status_flags & CANSTUN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
|
|
|
|
var/datum/status_effect/incapacitating/stun/S = IsStun()
|
|
|
|
|
if(amount <= 0)
|
|
|
|
|
if(S)
|
|
|
|
|
qdel(S)
|
|
|
|
|
var/datum/status_effect/incapacitating/stun/S = IsStun()
|
|
|
|
|
if(amount <= 0)
|
|
|
|
|
if(S)
|
|
|
|
|
qdel(S)
|
|
|
|
|
else
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(S)
|
|
|
|
|
S.duration = world.time + amount
|
|
|
|
|
else
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(S)
|
|
|
|
|
S.duration = world.time + amount
|
|
|
|
|
else
|
|
|
|
|
S = apply_status_effect(STATUS_EFFECT_STUN, amount)
|
|
|
|
|
return S
|
|
|
|
|
S = apply_status_effect(STATUS_EFFECT_STUN, amount)
|
|
|
|
|
return S
|
|
|
|
|
|
|
|
|
|
/mob/living/proc/AdjustStun(amount, ignore_canstun = FALSE) //Adds to remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_STUN, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
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 = IsStun()
|
|
|
|
|
if(S)
|
|
|
|
|
S.duration += amount
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
S = apply_status_effect(STATUS_EFFECT_STUN, amount)
|
|
|
|
|
return S
|
|
|
|
|
|
|
|
|
|
///////////////////////////////// KNOCKDOWN /////////////////////////////////////
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
var/datum/status_effect/incapacitating/stun/S = IsStun()
|
|
|
|
|
if(S)
|
|
|
|
|
S.duration += amount
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
S = apply_status_effect(STATUS_EFFECT_STUN, amount)
|
|
|
|
|
return S
|
|
|
|
|
|
|
|
|
|
/* KNOCKDOWN */
|
|
|
|
|
/mob/living/proc/IsKnockdown() //If we're knocked down
|
|
|
|
|
return has_status_effect(STATUS_EFFECT_KNOCKDOWN)
|
|
|
|
|
|
|
|
|
@@ -77,53 +73,50 @@
|
|
|
|
|
/mob/living/proc/Knockdown(amount, ignore_canstun = FALSE) //Can't go below remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_KNOCKDOWN, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
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 = IsKnockdown()
|
|
|
|
|
if(K)
|
|
|
|
|
K.duration = max(world.time + amount, K.duration)
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount)
|
|
|
|
|
return K
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
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)
|
|
|
|
|
return K
|
|
|
|
|
|
|
|
|
|
/mob/living/proc/SetKnockdown(amount, ignore_canstun = FALSE) //Sets remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_KNOCKDOWN, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
|
|
|
|
var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown()
|
|
|
|
|
if(amount <= 0)
|
|
|
|
|
if(K)
|
|
|
|
|
qdel(K)
|
|
|
|
|
var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown()
|
|
|
|
|
if(amount <= 0)
|
|
|
|
|
if(K)
|
|
|
|
|
qdel(K)
|
|
|
|
|
else
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(K)
|
|
|
|
|
K.duration = world.time + amount
|
|
|
|
|
else
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(K)
|
|
|
|
|
K.duration = world.time + amount
|
|
|
|
|
else
|
|
|
|
|
K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount)
|
|
|
|
|
return K
|
|
|
|
|
K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount)
|
|
|
|
|
return K
|
|
|
|
|
|
|
|
|
|
/mob/living/proc/AdjustKnockdown(amount, ignore_canstun = FALSE) //Adds to remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_KNOCKDOWN, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
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 = IsKnockdown()
|
|
|
|
|
if(K)
|
|
|
|
|
K.duration += amount
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount)
|
|
|
|
|
return K
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown()
|
|
|
|
|
if(K)
|
|
|
|
|
K.duration += amount
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount)
|
|
|
|
|
return K
|
|
|
|
|
|
|
|
|
|
///////////////////////////////// IMMOBILIZED ////////////////////////////////////
|
|
|
|
|
/* IMMOBILIZED */
|
|
|
|
|
/mob/living/proc/IsImmobilized() //If we're immobilized
|
|
|
|
|
return has_status_effect(STATUS_EFFECT_IMMOBILIZED)
|
|
|
|
|
|
|
|
|
@@ -136,53 +129,50 @@
|
|
|
|
|
/mob/living/proc/Immobilize(amount, ignore_canstun = FALSE) //Can't go below remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_IMMOBILIZE, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
var/datum/status_effect/incapacitating/immobilized/I = IsImmobilized()
|
|
|
|
|
if(I)
|
|
|
|
|
I.duration = max(world.time + amount, I.duration)
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount)
|
|
|
|
|
return I
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
var/datum/status_effect/incapacitating/immobilized/I = IsImmobilized()
|
|
|
|
|
if(I)
|
|
|
|
|
I.duration = max(world.time + amount, I.duration)
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount)
|
|
|
|
|
return I
|
|
|
|
|
|
|
|
|
|
/mob/living/proc/SetImmobilized(amount, ignore_canstun = FALSE) //Sets remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_IMMOBILIZE, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
|
|
|
|
var/datum/status_effect/incapacitating/immobilized/I = IsImmobilized()
|
|
|
|
|
if(amount <= 0)
|
|
|
|
|
if(I)
|
|
|
|
|
qdel(I)
|
|
|
|
|
var/datum/status_effect/incapacitating/immobilized/I = IsImmobilized()
|
|
|
|
|
if(amount <= 0)
|
|
|
|
|
if(I)
|
|
|
|
|
qdel(I)
|
|
|
|
|
else
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(I)
|
|
|
|
|
I.duration = world.time + amount
|
|
|
|
|
else
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(I)
|
|
|
|
|
I.duration = world.time + amount
|
|
|
|
|
else
|
|
|
|
|
I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount)
|
|
|
|
|
return I
|
|
|
|
|
I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount)
|
|
|
|
|
return I
|
|
|
|
|
|
|
|
|
|
/mob/living/proc/AdjustImmobilized(amount, ignore_canstun = FALSE) //Adds to remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_IMMOBILIZE, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
var/datum/status_effect/incapacitating/immobilized/I = IsImmobilized()
|
|
|
|
|
if(I)
|
|
|
|
|
I.duration += amount
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount)
|
|
|
|
|
return I
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
var/datum/status_effect/incapacitating/immobilized/I = IsImmobilized()
|
|
|
|
|
if(I)
|
|
|
|
|
I.duration += amount
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount)
|
|
|
|
|
return I
|
|
|
|
|
|
|
|
|
|
///////////////////////////////// PARALYZED //////////////////////////////////
|
|
|
|
|
/* PARALYZED */
|
|
|
|
|
/mob/living/proc/IsParalyzed() //If we're paralyzed
|
|
|
|
|
return has_status_effect(STATUS_EFFECT_PARALYZED)
|
|
|
|
|
|
|
|
|
@@ -195,51 +185,116 @@
|
|
|
|
|
/mob/living/proc/Paralyze(amount, ignore_canstun = FALSE) //Can't go below remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
var/datum/status_effect/incapacitating/paralyzed/P = IsParalyzed(FALSE)
|
|
|
|
|
if(P)
|
|
|
|
|
P.duration = max(world.time + amount, P.duration)
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount)
|
|
|
|
|
return P
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
var/datum/status_effect/incapacitating/paralyzed/P = IsParalyzed(FALSE)
|
|
|
|
|
if(P)
|
|
|
|
|
P.duration = max(world.time + amount, P.duration)
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount)
|
|
|
|
|
return P
|
|
|
|
|
|
|
|
|
|
/mob/living/proc/SetParalyzed(amount, ignore_canstun = FALSE) //Sets remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
|
|
|
|
var/datum/status_effect/incapacitating/paralyzed/P = IsParalyzed(FALSE)
|
|
|
|
|
if(amount <= 0)
|
|
|
|
|
if(P)
|
|
|
|
|
qdel(P)
|
|
|
|
|
var/datum/status_effect/incapacitating/paralyzed/P = IsParalyzed(FALSE)
|
|
|
|
|
if(amount <= 0)
|
|
|
|
|
if(P)
|
|
|
|
|
qdel(P)
|
|
|
|
|
else
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(P)
|
|
|
|
|
P.duration = world.time + amount
|
|
|
|
|
else
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(P)
|
|
|
|
|
P.duration = world.time + amount
|
|
|
|
|
else
|
|
|
|
|
P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount)
|
|
|
|
|
return P
|
|
|
|
|
P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount)
|
|
|
|
|
return P
|
|
|
|
|
|
|
|
|
|
/mob/living/proc/AdjustParalyzed(amount, ignore_canstun = FALSE) //Adds to remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
var/datum/status_effect/incapacitating/paralyzed/P = IsParalyzed(FALSE)
|
|
|
|
|
if(P)
|
|
|
|
|
P.duration += amount
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount)
|
|
|
|
|
return P
|
|
|
|
|
|
|
|
|
|
/* INCAPACITATED */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Proc that returns the remaining duration of the status efect in deciseconds.
|
|
|
|
|
/mob/living/proc/amount_incapacitated()
|
|
|
|
|
var/datum/status_effect/incapacitating/incapacitated/incapacitated_status_effect = has_status_effect(STATUS_EFFECT_INCAPACITATED)
|
|
|
|
|
if (incapacitated_status_effect)
|
|
|
|
|
return incapacitated_status_effect.duration - world.time
|
|
|
|
|
else
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
/** Proc that actually applies the status effect.
|
|
|
|
|
* Applies the Incapacitated status effect to a mob/living.
|
|
|
|
|
* * amount - Amount of time the status effect should be applied for, in deciseconds.
|
|
|
|
|
* * ignore_canstun - If TRUE, the mob's resistance to stuns is ignored.
|
|
|
|
|
*/
|
|
|
|
|
/mob/living/proc/incapacitate(amount, ignore_canstun = FALSE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
var/datum/status_effect/incapacitating/incapacitated/incapacitated_status_effect = has_status_effect(STATUS_EFFECT_INCAPACITATED)
|
|
|
|
|
if(incapacitated_status_effect)
|
|
|
|
|
incapacitated_status_effect.duration = max(world.time + amount, incapacitated_status_effect.duration)
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
incapacitated_status_effect = apply_status_effect(STATUS_EFFECT_INCAPACITATED, amount)
|
|
|
|
|
return incapacitated_status_effect
|
|
|
|
|
|
|
|
|
|
/** Proc that set the incapacitated status effect's remaining duration to a certain time.
|
|
|
|
|
* Checks if the mob has the status effect. If yes, it sets the duration to the amount passed in arguments. If not, applies the status effect
|
|
|
|
|
* and sets the duration to the amount passed in arguments.
|
|
|
|
|
* * amount - Amount of time the status effect should be set to, in deciseconds.
|
|
|
|
|
* * ignore_canstun - If TRUE, the mob's resistance to stuns is ignored.
|
|
|
|
|
*/
|
|
|
|
|
/mob/living/proc/set_incapacitated(amount, ignore_canstun = FALSE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
var/datum/status_effect/incapacitating/incapacitated/incapacitated_status_effect = has_status_effect(STATUS_EFFECT_INCAPACITATED)
|
|
|
|
|
if(amount <= 0)
|
|
|
|
|
if(incapacitated_status_effect)
|
|
|
|
|
qdel(incapacitated_status_effect)
|
|
|
|
|
else
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
var/datum/status_effect/incapacitating/paralyzed/P = IsParalyzed(FALSE)
|
|
|
|
|
if(P)
|
|
|
|
|
P.duration += amount
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount)
|
|
|
|
|
return P
|
|
|
|
|
if(incapacitated_status_effect)
|
|
|
|
|
incapacitated_status_effect.duration = world.time + amount
|
|
|
|
|
else
|
|
|
|
|
incapacitated_status_effect = apply_status_effect(STATUS_EFFECT_INCAPACITATED, amount)
|
|
|
|
|
return incapacitated_status_effect
|
|
|
|
|
|
|
|
|
|
/** Proc that adds duration to an incapacitated status effect.
|
|
|
|
|
* Checks if the mob has the status effect. If yes, it adds the amount passed in arguments to the remaining duration. If not, applies the status effect
|
|
|
|
|
* and sets the duration to the amount passed in arguments.
|
|
|
|
|
* * amount - Amount of time the status effect should be set to, in deciseconds.
|
|
|
|
|
* * ignore_canstun - If TRUE, the mob's resistance to stuns is ignored.
|
|
|
|
|
*/
|
|
|
|
|
/mob/living/proc/adjust_incapacitated(amount, ignore_canstun = FALSE) //Adds to remaining duration
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(absorb_stun(amount, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
var/datum/status_effect/incapacitating/incapacitated/incapacitated_status_effect = has_status_effect(STATUS_EFFECT_INCAPACITATED)
|
|
|
|
|
if(incapacitated_status_effect)
|
|
|
|
|
incapacitated_status_effect.duration += amount
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
incapacitated_status_effect = apply_status_effect(STATUS_EFFECT_INCAPACITATED, amount)
|
|
|
|
|
return incapacitated_status_effect
|
|
|
|
|
|
|
|
|
|
//Blanket
|
|
|
|
|
/mob/living/proc/AllImmobility(amount)
|
|
|
|
@@ -263,7 +318,7 @@
|
|
|
|
|
AdjustImmobilized(amount)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////UNCONSCIOUS
|
|
|
|
|
/* UNCONSCIOUS */
|
|
|
|
|
/mob/living/proc/IsUnconscious() //If we're unconscious
|
|
|
|
|
return has_status_effect(STATUS_EFFECT_UNCONSCIOUS)
|
|
|
|
|
|
|
|
|
@@ -276,47 +331,43 @@
|
|
|
|
|
/mob/living/proc/Unconscious(amount, ignore_canstun = FALSE) //Can't go below remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
|
|
|
|
var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious()
|
|
|
|
|
if(U)
|
|
|
|
|
U.duration = max(world.time + amount, U.duration)
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount)
|
|
|
|
|
return U
|
|
|
|
|
var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious()
|
|
|
|
|
if(U)
|
|
|
|
|
U.duration = max(world.time + amount, U.duration)
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount)
|
|
|
|
|
return U
|
|
|
|
|
|
|
|
|
|
/mob/living/proc/SetUnconscious(amount, ignore_canstun = FALSE) //Sets remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
|
|
|
|
var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious()
|
|
|
|
|
if(amount <= 0)
|
|
|
|
|
if(U)
|
|
|
|
|
qdel(U)
|
|
|
|
|
else if(U)
|
|
|
|
|
U.duration = world.time + amount
|
|
|
|
|
else
|
|
|
|
|
U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount)
|
|
|
|
|
return U
|
|
|
|
|
var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious()
|
|
|
|
|
if(amount <= 0)
|
|
|
|
|
if(U)
|
|
|
|
|
qdel(U)
|
|
|
|
|
else if(U)
|
|
|
|
|
U.duration = world.time + amount
|
|
|
|
|
else
|
|
|
|
|
U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount)
|
|
|
|
|
return U
|
|
|
|
|
|
|
|
|
|
/mob/living/proc/AdjustUnconscious(amount, ignore_canstun = FALSE) //Adds to remaining duration
|
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, ignore_canstun) & COMPONENT_NO_STUN)
|
|
|
|
|
return
|
|
|
|
|
if(status_flags & GODMODE)
|
|
|
|
|
if(IS_STUN_IMMUNE(src, ignore_canstun))
|
|
|
|
|
return
|
|
|
|
|
if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
|
|
|
|
|
var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious()
|
|
|
|
|
if(U)
|
|
|
|
|
U.duration += amount
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount)
|
|
|
|
|
return U
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////// SLEEPING ////////////////////////////////////
|
|
|
|
|
var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious()
|
|
|
|
|
if(U)
|
|
|
|
|
U.duration += amount
|
|
|
|
|
else if(amount > 0)
|
|
|
|
|
U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount)
|
|
|
|
|
return U
|
|
|
|
|
|
|
|
|
|
/* SLEEPING */
|
|
|
|
|
/mob/living/proc/IsSleeping() //If we're asleep
|
|
|
|
|
if(!HAS_TRAIT(src, TRAIT_SLEEPIMMUNE))
|
|
|
|
|
return has_status_effect(STATUS_EFFECT_SLEEPING)
|
|
|
|
@@ -391,11 +442,12 @@
|
|
|
|
|
|
|
|
|
|
///////////////////////////////// FROZEN /////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/* FROZEN */
|
|
|
|
|
/mob/living/proc/IsFrozen()
|
|
|
|
|
return has_status_effect(/datum/status_effect/freon)
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////// STUN ABSORPTION /////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/* STUN ABSORPTION*/
|
|
|
|
|
/mob/living/proc/add_stun_absorption(key, duration, priority, message, self_message, examine_message)
|
|
|
|
|
//adds a stun absorption with a key, a duration in deciseconds, its priority, and the messages it makes when you're stun/examined, if any
|
|
|
|
|
if(!islist(stun_absorption))
|
|
|
|
@@ -457,8 +509,7 @@
|
|
|
|
|
return TRUE
|
|
|
|
|
return FALSE
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////// TRAIT PROCS ////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/* TRAIT PROCS */
|
|
|
|
|
/mob/living/proc/cure_blind(source)
|
|
|
|
|
if(source)
|
|
|
|
|
REMOVE_TRAIT(src, TRAIT_BLIND, source)
|
|
|
|
|