Sleeping tweaks, at-will wakes (#21452)

Species capable of indefinite sleep can now wake up from being asleep at
will by pressing "Sleep" again.

IPCs will also no longer beep constantly when sleeping. This is part of
a `snores` variable that can be toggled on other species too in lieu of
a `snore_key` variable.

Unfortunately does not make IPCs stop consuming charge when asleep.
Tried it, it's one hell of a spaghetticode nightmare for a result that
really doesn't matter that much. Might revisit once the IPC rework gets
merged.
This commit is contained in:
naut
2025-10-09 17:54:11 +00:00
committed by GitHub
parent 7873192a82
commit f2cb40fac6
5 changed files with 75 additions and 3 deletions
+10 -1
View File
@@ -398,7 +398,16 @@
set category = "IC"
if(usr.sleeping)
to_chat(usr, SPAN_WARNING("You are already asleep."))
if(species && species.indefinite_sleep) // Species can wake up at will when sleeping.
to_chat(usr, SPAN_NOTICE("You start to wake up."))
if(usr.sleeping_indefinitely)
to_chat(usr, SPAN_NOTICE("You will no longer sleep indefinitely."))
usr.sleeping_indefinitely = FALSE // Stop any glitches from happening with overriding indefinite sleep.
usr.sleeping = 1 // Wake up soon.
usr.eye_blurry = 1
else
to_chat(usr, SPAN_WARNING("You are already asleep."))
return
if(alert(src,"Are you sure you want to sleep for a while?", "Sleep", "Yes", "No") == "Yes")
willfully_sleeping = TRUE
+1 -1
View File
@@ -796,7 +796,7 @@
else
AdjustSleeping(-1)
if(prob(2) && health && !failed_last_breath && !InStasis())
if(!paralysis)
if(!paralysis && species.snores)
emote(species.snore_key)
//CONSCIOUS
@@ -361,6 +361,10 @@
* The key of the emote to play when this species is sleeping
*/
var/snore_key = "snore"
/**
* Whether or not this species snores when sleeping
*/
var/snores = TRUE
/**
* Whether this species can choose to sleep indefinitely
*/
@@ -145,7 +145,7 @@
psi_deaf = TRUE
sleeps_upright = TRUE
snore_key = "beep"
snores = FALSE
indefinite_sleep = TRUE
/datum/species/machine/handle_post_spawn(var/mob/living/carbon/human/H)