Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSD Indicators Will Be Real In 2020 #3067

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/examine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
if(!key)
msg += "<span class='deadsay'>[t_He] [t_is] totally catatonic. The stresses of life in deep-space must have been too much for [t_him]. Any recovery is unlikely.</span>\n"
else if(!client)
msg += "<span class='warning'>[t_He] appears to be suffering from SSD - Space Sleep Disorder. [t_He] may snap out of it at any time! Or maybe never. It's best to leave [t_him] be.</span>\n"
msg += "<span class='warning'>[t_He] [t_has] been suffering from SSD - Space Sleep Disorder - for [trunc(((world.time - lastclienttime) / (1 MINUTES)))] minutes. [t_He] may snap out of it at any time! Or maybe never. It's best to leave [t_him] be.</span>\n"
if (length(msg))
. += "<span class='warning'>[msg.Join("")]</span>"

Expand Down
9 changes: 6 additions & 3 deletions code/modules/mob/living/carbon/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
if(.) //not dead
handle_blood()

if(isLivingSSD())//if you're disconnected, you're going to sleep
if(AmountSleeping() < 20)
AdjustSleeping(20)//adjust every 10 seconds
if(isLivingSSD()) // If you're disconnected, you're going to sleep
if(trunc((world.time - lastclienttime) / (3 MINUTES)) > 0) // After a three minute grace period, your character will fall asleep
if(AmountSleeping() < 20)
AdjustSleeping(20) // Adjust every 10 seconds
if(ssd_indicator)
cut_overlay(GLOB.ssd_indicator_overlay) // Prevents chronically SSD players from breaking immersion

if(stat != DEAD)
var/bprv = handle_bodyparts()
Expand Down
26 changes: 26 additions & 0 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,32 @@
if(player_logged && stat != DEAD)
return TRUE

// The above code is kept to prevent old SSD behavior from breaking, while the code below is dedicated to the SSD Indicator

GLOBAL_VAR_INIT(ssd_indicator_overlay, mutable_appearance('icons/mob/ssd_indicator.dmi', "default0", RUNECHAT_PLANE))

/mob/living
var/ssd_indicator = FALSE
var/lastclienttime = 0

/mob/living/proc/set_ssd_indicator(state)
if(state == ssd_indicator)
return
ssd_indicator = state
if(ssd_indicator && stat != DEAD)
add_overlay(GLOB.ssd_indicator_overlay)
else
cut_overlay(GLOB.ssd_indicator_overlay)

/mob/living/Login()
. = ..()
set_ssd_indicator(FALSE)

/mob/living/Logout()
. = ..()
lastclienttime = world.time
set_ssd_indicator(TRUE)

/mob/living/vv_get_header()
. = ..()
var/refid = REF(src)
Expand Down
Binary file added icons/mob/ssd_indicator.dmi
Binary file not shown.
Loading