From f2cb40fac69288e9a7bdbf08f54fbd61c32326b4 Mon Sep 17 00:00:00 2001 From: naut <55491249+nauticall@users.noreply.github.com> Date: Fri, 10 Oct 2025 01:54:11 +0800 Subject: [PATCH] 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. --- code/modules/mob/living/carbon/carbon.dm | 11 +++- code/modules/mob/living/carbon/human/life.dm | 2 +- .../living/carbon/human/species/species.dm | 4 ++ .../carbon/human/species/station/ipc/ipc.dm | 2 +- html/changelogs/nauticall-ipc_sleep.yml | 59 +++++++++++++++++++ 5 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 html/changelogs/nauticall-ipc_sleep.yml diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 6455d32eb46..69e1bda6e65 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -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 diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index ecf514fd4cc..ceeed0f2614 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -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 diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 98a64c79271..2057d8f7080 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -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 */ diff --git a/code/modules/mob/living/carbon/human/species/station/ipc/ipc.dm b/code/modules/mob/living/carbon/human/species/station/ipc/ipc.dm index 8eb84bab592..bed9be8a04d 100644 --- a/code/modules/mob/living/carbon/human/species/station/ipc/ipc.dm +++ b/code/modules/mob/living/carbon/human/species/station/ipc/ipc.dm @@ -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) diff --git a/html/changelogs/nauticall-ipc_sleep.yml b/html/changelogs/nauticall-ipc_sleep.yml new file mode 100644 index 00000000000..c4e255b26fa --- /dev/null +++ b/html/changelogs/nauticall-ipc_sleep.yml @@ -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."