[MIRROR] Toggle Sleep (#8471)

Co-authored-by: Killian <49700375+KillianKirilenko@users.noreply.github.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2
2024-06-03 22:59:17 -04:00
committed by GitHub
co-authored by Killian Kashargul
parent 67a4b3a1a2
commit ccaa3a501d
4 changed files with 30 additions and 12 deletions
-10
View File
@@ -395,16 +395,6 @@
return method ? ">250" : "extremely weak and fast, patient's artery feels like a thread"
// output for machines^ ^^^^^^^output for people^^^^^^^^^
/mob/living/carbon/verb/mob_sleep()
set name = "Sleep"
set category = "IC.Game" //CHOMPEdit
if(usr.sleeping)
to_chat(usr, span_red("You are already sleeping"))
return
if(tgui_alert(src,"You sure you want to sleep for a while?","Sleep",list("Yes","No")) == "Yes")
usr.AdjustSleeping(20)
/mob/living/carbon/Bump(atom/A)
if(now_pushing)
return
+1 -2
View File
@@ -1325,8 +1325,7 @@
if (mind)
//Are they SSD? If so we'll keep them asleep but work off some of that sleep var in case of stoxin or similar.
if(client || sleeping > 3)
AdjustSleeping(-1 * species.waking_speed) //CHOMPEdit
throw_alert("asleep", /obj/screen/alert/asleep)
handle_sleeping()
if( prob(2) && health && !hal_crit && client )
spawn(0)
emote("snore")
+16
View File
@@ -295,3 +295,19 @@
//to_world("[src] in B:[round(brightness,0.1)] C:[round(current,0.1)] A2:[round(adjust_to,0.1)] D:[round(distance,0.01)] T:[round(distance*10 SECONDS,0.1)]")
animate(dsoverlay, alpha = (adjust_to*255), time = (distance*10 SECONDS))
/mob/living/proc/handle_sleeping()
if(stat != DEAD && toggled_sleeping)
Sleeping(2)
if(sleeping)
//CHOMPEdit Start
if(iscarbon(src))
var/mob/living/carbon/C = src
AdjustSleeping(-1 * C.species.waking_speed)
else
AdjustSleeping(-1)
//CHOMPEdit End
throw_alert("asleep", /obj/screen/alert/asleep)
else
clear_alert("asleep")
return sleeping
+13
View File
@@ -1387,3 +1387,16 @@
. = ..()
if(size_multiplier != 1 || icon_scale_x != DEFAULT_ICON_SCALE_X && center_offset > 0)
update_transform(TRUE)
/mob/living
var/toggled_sleeping = FALSE
/mob/living/verb/mob_sleep()
set name = "Sleep"
set category = "IC.Game" //CHOMPEdit
if(!toggled_sleeping && alert(src, "Are you sure you wish to go to sleep? You will snooze until you use the Sleep verb again.", "Sleepy Time", "No", "Yes") == "No")
return
toggled_sleeping = !toggled_sleeping
to_chat(src, SPAN_NOTICE("You are [toggled_sleeping ? "now sleeping. Use the Sleep verb again to wake up" : "no longer sleeping"]."))
if(toggled_sleeping)
Sleeping(1)