Skip to content

Commit

Permalink
SSD Indicators will be real in 2020
Browse files Browse the repository at this point in the history
  • Loading branch information
Skies-Of-Blue committed Jun 4, 2024
1 parent 27992f5 commit ed896c0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
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
25 changes: 25 additions & 0 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,31 @@
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(var/state)
if(state == ssd_indicator)
return
ssd_indicator = state
if(ssd_indicator)
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.

0 comments on commit ed896c0

Please sign in to comment.