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)
+59
View File
@@ -0,0 +1,59 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# - (fixes bugs)
# wip
# - (work in progress)
# qol
# - (quality of life)
# soundadd
# - (adds a sound)
# sounddel
# - (removes a sound)
# rscadd
# - (adds a feature)
# rscdel
# - (removes a feature)
# imageadd
# - (adds an image or sprite)
# imagedel
# - (removes an image or sprite)
# spellcheck
# - (fixes spelling or grammar)
# experiment
# - (experimental change)
# balance
# - (balance changes)
# code_imp
# - (misc internal code change)
# refactor
# - (refactors code)
# config
# - (makes a change to the config files)
# admin
# - (makes changes to administrator tools)
# server
# - (miscellaneous changes to server)
#################################
# Your name.
author: ChangeMe
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit.
# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Species capable of indefinite sleep, can now voluntarily wake up from sleeping at will by pressing 'Sleep' again."
- sounddel: "IPCs will no longer beep when sleeping."