Skip to content

Commit

Permalink
SSD Indicators Will Be Real In 2020 (shiptest-ss13#3067)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
Loosely ports Skyrat-SS13/Skyrat13#420, splicing
Novasector's SSD mechanics with our own.

When a player goes SSD, they initially remain awake and gain a Zz icon
above the character indicating they are away.
<details>
  <summary>look here!</summary>

![nyaru goes
afk](https://github.com/shiptest-ss13/Shiptest/assets/86762641/98c61f04-7e65-4b24-a434-2769cc8a25f6)

</details>

After the player has been disconnected for three minutes, their
character will resume our current implementation of SSD behavior -
losing the Zz icon and falling asleep.

<details>
  <summary>see?</summary>

![nyaru has been gone a while,
huh](https://github.com/shiptest-ss13/Shiptest/assets/86762641/8c51e05f-a41d-40af-a259-3a2dc7e7cca2)

</details>

This also adds the time spent SSD to examine text.
<details>
  <summary>it's helpful!</summary>

![taking a
bit](https://github.com/shiptest-ss13/Shiptest/assets/86762641/15f91ab4-01b8-4d2f-8d8f-f5cf65f99213)

</details>
<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game

<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->
Our current implementation of being SSD leaves some things to be
desired. Whenever you disconnect, your character instantly passes out.
This can lead to:
- dropping critical items in dangerous situations, which is just sort of
the worst
- aghost causing your character to faint on the spot, something I've
heard more than a few admins complain about over the last few years
- players *reacting* to your character falling asleep as if it was a
planned thing within your control
- players moving your character to a bed, disrupting a scene you may
have been intent on continuing if it weren't for that pesky internet cut
- SSD players flooding the nearby chat with *snore out of nowhere

Of course, there's merit to our current implementation as well. Having
characters fall asleep keeps immersion clean, and having an SSD
Indicator can be immersion breaking. This is why I've opted to remove
the indicator and have characters fall asleep after a grace period of
three minutes. It allows players a time to reconnect, or admins time to
view what they needed to, without all of the disruptions listed above.

## Changelog

:cl:
add: an SSD Indicator for when you have been disconnected for less than
three minutes
balance: players will now remain awake for three minutes after
disconnecting, with a new SSD icon to boot!
balance: players SSD longer than three minutes will lose their icon and
fall asleep, much like the previous behavior
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
Skies-Of-Blue authored and MysticalFaceLesS committed Jul 20, 2024
1 parent b98214c commit 6766950
Show file tree
Hide file tree
Showing 4 changed files with 33 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 @@ -326,7 +326,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.

0 comments on commit 6766950

Please sign in to comment.