mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-08 07:52:54 +00:00
This tracks the seconds per tick of a subsystem, however note that it is not completely accurate, as subsystems can be delayed, however it's useful to have this number as a multiplier or ratio, so that if in future someone changes the subsystem wait time code correctly adjusts how fast it applies effects regexes used git grep --files-with-matches --name-only 'DT_PROB' | xargs -l sed -i 's/DT_PROB/SPT_PROB/g' git grep --files-with-matches --name-only 'delta_time' | xargs -l sed -i 's/delta_time/seconds_per_tick/g'
43 lines
1.3 KiB
Plaintext
43 lines
1.3 KiB
Plaintext
/datum/status_effect/drowsiness
|
|
id = "drowsiness"
|
|
tick_interval = 2 SECONDS
|
|
alert_type = null
|
|
remove_on_fullheal = TRUE
|
|
|
|
/datum/status_effect/drowsiness/on_creation(mob/living/new_owner, duration = 10 SECONDS)
|
|
src.duration = duration
|
|
return ..()
|
|
|
|
/datum/status_effect/drowsiness/on_apply()
|
|
if(HAS_TRAIT(owner, TRAIT_SLEEPIMMUNE) || !(owner.status_flags & CANUNCONSCIOUS))
|
|
return FALSE
|
|
// Do robots dream of electric sheep?
|
|
if(issilicon(owner))
|
|
return FALSE
|
|
|
|
RegisterSignal(owner, COMSIG_COMPONENT_CLEAN_FACE_ACT, PROC_REF(on_face_clean))
|
|
return TRUE
|
|
|
|
/datum/status_effect/drowsiness/on_remove()
|
|
UnregisterSignal(owner, COMSIG_COMPONENT_CLEAN_FACE_ACT)
|
|
|
|
/// Signal proc for [COMSIG_COMPONENT_CLEAN_FACE_ACT]. When we wash our face, reduce drowsiness by a bit.
|
|
/datum/status_effect/drowsiness/proc/on_face_clean(datum/source)
|
|
SIGNAL_HANDLER
|
|
|
|
remove_duration(rand(4 SECONDS, 6 SECONDS))
|
|
|
|
/datum/status_effect/drowsiness/tick(seconds_per_tick)
|
|
// You do not feel drowsy while unconscious or in stasis
|
|
if(owner.stat >= UNCONSCIOUS || IS_IN_STASIS(owner))
|
|
return
|
|
|
|
// Resting helps against drowsiness
|
|
// While resting, we lose 4 seconds of duration (2 additional ticks) per tick
|
|
if(owner.resting && remove_duration(2 * initial(tick_interval)))
|
|
return
|
|
|
|
owner.set_eye_blur_if_lower(4 SECONDS)
|
|
if(prob(5))
|
|
owner.AdjustSleeping(10 SECONDS)
|