mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-11 10:22:13 +00:00
264 lines
8.5 KiB
Plaintext
264 lines
8.5 KiB
Plaintext
|
|
//Here are the procs used to modify status effects of a mob.
|
|
//The effects include: stun, knockdown, unconscious, sleeping, resting, jitteriness, dizziness, ear damage,
|
|
// eye damage, eye_blind, eye_blurry, druggy, TRAIT_BLIND trait, and TRAIT_NEARSIGHT trait.
|
|
|
|
/////////////////////////////////// STUN ////////////////////////////////////
|
|
|
|
/mob/proc/IsStun() //non-living mobs shouldn't be stunned
|
|
return FALSE
|
|
|
|
/////////////////////////////////// KNOCKDOWN ////////////////////////////////////
|
|
|
|
/mob/proc/IsKnockdown() //non-living mobs shouldn't be knocked down
|
|
return FALSE
|
|
|
|
/////////////////////////////////// UNCONSCIOUS ////////////////////////////////////
|
|
|
|
/mob/proc/IsUnconscious() //non-living mobs shouldn't be unconscious
|
|
return FALSE
|
|
|
|
/mob/living/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 = IsUnconscious()
|
|
if(U)
|
|
return U.duration - world.time
|
|
return 0
|
|
|
|
/mob/living/proc/Unconscious(amount, updating = TRUE, ignore_canunconscious = FALSE) //Can't go below remaining duration
|
|
if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canunconscious)
|
|
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, updating)
|
|
return U
|
|
|
|
/mob/living/proc/SetUnconscious(amount, updating = TRUE, ignore_canunconscious = FALSE) //Sets remaining duration
|
|
if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canunconscious)
|
|
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, updating)
|
|
return U
|
|
|
|
/mob/living/proc/AdjustUnconscious(amount, updating = TRUE, ignore_canunconscious = FALSE) //Adds to remaining duration
|
|
if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canunconscious)
|
|
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, updating)
|
|
return U
|
|
|
|
/////////////////////////////////// SLEEPING ////////////////////////////////////
|
|
|
|
/mob/proc/IsSleeping() //non-living mobs shouldn't be sleeping either
|
|
return FALSE
|
|
|
|
/mob/living/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 = IsSleeping()
|
|
if(S)
|
|
return S.duration - world.time
|
|
return 0
|
|
|
|
/mob/living/proc/Sleeping(amount, updating = TRUE, ignore_sleepimmune = FALSE) //Can't go below remaining duration
|
|
if((!HAS_TRAIT(src, TRAIT_SLEEPIMMUNE)) || ignore_sleepimmune)
|
|
var/datum/status_effect/incapacitating/sleeping/S = IsSleeping()
|
|
if(S)
|
|
S.duration = max(world.time + amount, S.duration)
|
|
else if(amount > 0)
|
|
S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating)
|
|
return S
|
|
|
|
/mob/living/proc/SetSleeping(amount, updating = TRUE, ignore_sleepimmune = FALSE) //Sets remaining duration
|
|
if((!HAS_TRAIT(src, TRAIT_SLEEPIMMUNE)) || ignore_sleepimmune)
|
|
var/datum/status_effect/incapacitating/sleeping/S = IsSleeping()
|
|
if(amount <= 0)
|
|
if(S)
|
|
qdel(S)
|
|
else if(S)
|
|
S.duration = world.time + amount
|
|
else
|
|
S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating)
|
|
return S
|
|
|
|
/mob/living/proc/AdjustSleeping(amount, updating = TRUE, ignore_sleepimmune = FALSE) //Adds to remaining duration
|
|
if((!HAS_TRAIT(src, TRAIT_SLEEPIMMUNE)) || ignore_sleepimmune)
|
|
var/datum/status_effect/incapacitating/sleeping/S = IsSleeping()
|
|
if(S)
|
|
S.duration += amount
|
|
else if(amount > 0)
|
|
S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating)
|
|
return S
|
|
|
|
/////////////////////////////////// RESTING ////////////////////////////////////
|
|
|
|
/mob/proc/Resting(amount)
|
|
resting = max(max(resting,amount),0)
|
|
|
|
/mob/living/Resting(amount)
|
|
..()
|
|
update_canmove()
|
|
|
|
/mob/proc/SetResting(amount)
|
|
resting = max(amount,0)
|
|
|
|
/mob/living/SetResting(amount)
|
|
..()
|
|
update_canmove()
|
|
|
|
/mob/proc/AdjustResting(amount)
|
|
resting = max(resting + amount,0)
|
|
|
|
/mob/living/AdjustResting(amount)
|
|
..()
|
|
update_canmove()
|
|
|
|
/////////////////////////////////// JITTERINESS ////////////////////////////////////
|
|
|
|
/mob/proc/Jitter(amount)
|
|
jitteriness = max(jitteriness,amount,0)
|
|
|
|
/////////////////////////////////// DIZZINESS ////////////////////////////////////
|
|
|
|
/mob/proc/Dizzy(amount)
|
|
dizziness = max(dizziness,amount,0)
|
|
|
|
/////////////////////////////////// EYE_BLIND ////////////////////////////////////
|
|
|
|
/mob/proc/blind_eyes(amount)
|
|
if(amount>0)
|
|
var/old_eye_blind = eye_blind
|
|
eye_blind = max(eye_blind, amount)
|
|
if(!old_eye_blind)
|
|
if(stat == CONSCIOUS || stat == SOFT_CRIT)
|
|
throw_alert("blind", /obj/screen/alert/blind)
|
|
overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
|
|
|
|
/mob/proc/adjust_blindness(amount)
|
|
if(amount>0)
|
|
var/old_eye_blind = eye_blind
|
|
eye_blind += amount
|
|
if(!old_eye_blind)
|
|
if(stat == CONSCIOUS || stat == SOFT_CRIT)
|
|
throw_alert("blind", /obj/screen/alert/blind)
|
|
overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
|
|
else if(eye_blind)
|
|
var/blind_minimum = 0
|
|
if((stat != CONSCIOUS && stat != SOFT_CRIT))
|
|
blind_minimum = 1
|
|
if(isliving(src))
|
|
var/mob/living/L = src
|
|
if(HAS_TRAIT(L, TRAIT_BLIND))
|
|
blind_minimum = 1
|
|
eye_blind = max(eye_blind+amount, blind_minimum)
|
|
if(!eye_blind)
|
|
clear_alert("blind")
|
|
clear_fullscreen("blind")
|
|
|
|
/mob/proc/set_blindness(amount)
|
|
if(amount>0)
|
|
var/old_eye_blind = eye_blind
|
|
eye_blind = amount
|
|
if(client && !old_eye_blind)
|
|
if(stat == CONSCIOUS || stat == SOFT_CRIT)
|
|
throw_alert("blind", /obj/screen/alert/blind)
|
|
overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
|
|
else if(eye_blind)
|
|
var/blind_minimum = 0
|
|
if(stat != CONSCIOUS && stat != SOFT_CRIT)
|
|
blind_minimum = 1
|
|
if(isliving(src))
|
|
var/mob/living/L = src
|
|
if(HAS_TRAIT(L, TRAIT_BLIND))
|
|
blind_minimum = 1
|
|
eye_blind = blind_minimum
|
|
if(!eye_blind)
|
|
clear_alert("blind")
|
|
clear_fullscreen("blind")
|
|
|
|
/////////////////////////////////// EYE_BLURRY ////////////////////////////////////
|
|
|
|
/mob/proc/blur_eyes(amount)
|
|
if(amount>0)
|
|
var/old_eye_blurry = eye_blurry
|
|
eye_blurry = max(amount, eye_blurry)
|
|
if(!old_eye_blurry)
|
|
add_eyeblur() //Citadel edit blurry eye memes entailed. syncs beware
|
|
else if(eye_blurry > 0)
|
|
update_eyeblur()
|
|
|
|
/mob/proc/adjust_blurriness(amount)
|
|
var/old_eye_blurry = eye_blurry
|
|
eye_blurry = max(eye_blurry+amount, 0)
|
|
if(amount>0)
|
|
if(!old_eye_blurry)
|
|
add_eyeblur()
|
|
else if(eye_blurry > 0)
|
|
update_eyeblur()
|
|
else if(old_eye_blurry && !eye_blurry)
|
|
remove_eyeblur()
|
|
|
|
/mob/proc/set_blurriness(amount)
|
|
var/old_eye_blurry = eye_blurry
|
|
eye_blurry = max(amount, 0)
|
|
if(amount>0)
|
|
if(!old_eye_blurry)
|
|
add_eyeblur()
|
|
else if(eye_blurry > 0)
|
|
update_eyeblur()
|
|
else if(old_eye_blurry)
|
|
remove_eyeblur()
|
|
|
|
/mob/proc/add_eyeblur()
|
|
if(!client)
|
|
return
|
|
var/obj/screen/plane_master/game_world/GW = locate(/obj/screen/plane_master/game_world) in client.screen
|
|
var/obj/screen/plane_master/floor/F = locate(/obj/screen/plane_master/floor) in client.screen
|
|
GW.add_filter("blurry_eyes", 2, EYE_BLUR(CLAMP(eye_blurry*0.1,0.6,3)))
|
|
F.add_filter("blurry_eyes", 2, EYE_BLUR(CLAMP(eye_blurry*0.1,0.6,3)))
|
|
|
|
/mob/proc/update_eyeblur()
|
|
remove_eyeblur()
|
|
add_eyeblur()
|
|
|
|
/mob/proc/remove_eyeblur()
|
|
if(!client)
|
|
return
|
|
var/obj/screen/plane_master/game_world/GW = locate(/obj/screen/plane_master/game_world) in client.screen
|
|
var/obj/screen/plane_master/floor/F = locate(/obj/screen/plane_master/floor) in client.screen
|
|
GW.remove_filter("blurry_eyes")
|
|
F.remove_filter("blurry_eyes")
|
|
|
|
/////////////////////////////////// DRUGGY ////////////////////////////////////
|
|
|
|
/mob/proc/adjust_drugginess(amount)
|
|
return
|
|
|
|
/mob/proc/set_drugginess(amount)
|
|
return
|
|
|
|
/////////////////////////////////// GROSSED OUT ////////////////////////////////////
|
|
|
|
/mob/proc/adjust_disgust(amount)
|
|
return
|
|
|
|
/mob/proc/set_disgust(amount)
|
|
return
|
|
|
|
/////////////////////////////////// TEMPERATURE ////////////////////////////////////
|
|
|
|
/mob/proc/adjust_bodytemperature(amount,min_temp=0,max_temp=INFINITY)
|
|
if(bodytemperature >= min_temp && bodytemperature <= max_temp)
|
|
bodytemperature = CLAMP(bodytemperature + amount,min_temp,max_temp)
|