From bb71a1e047790641b5168f7478db6a8a471385fe Mon Sep 17 00:00:00 2001 From: LordFowl Date: Fri, 8 Dec 2017 09:19:38 -0500 Subject: [PATCH] Adds SSD Timers (#3942) A client'd mob inactive for more than ten minutes (Aka alt-tabbed or maybe the player had an aneurysm while playing) will indicate such when examined. A formerly client'd mob disconnected for more than five minutes will also indicate such when examined. --- .../mob/living/carbon/human/examine.dm | 8 +++- code/modules/mob/login.dm | 1 + code/modules/mob/logout.dm | 1 + code/modules/mob/mob_defines.dm | 3 +- html/changelogs/ssd.yml | 37 +++++++++++++++++++ 5 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 html/changelogs/ssd.yml diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 25828bcc994..2c006742b19 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -217,7 +217,7 @@ msg += "[T.He] [T.is] on fire!\n" msg += "" - + if(nutrition < 100) msg += "[T.He] [T.is] severely malnourished.\n" else if(nutrition >= 500) @@ -225,7 +225,7 @@ msg += "[T.He] [T.is] plump and delicious looking - Like a fat little piggy. A tasty piggy.\n" else*/ msg += "[T.He] [T.is] quite chubby.\n" - + msg += "" @@ -237,6 +237,10 @@ msg += "[T.He] [T.is] [species.show_ssd]. It doesn't look like [T.he] [T.is] waking up anytime soon.\n" else if(!client) msg += "[T.He] [T.is] [species.show_ssd].\n" + if(client && ((client.inactivity / 600) > 10)) // inactivity/10/60 > 10 MINUTES + msg += "\[Inactive for [round(client.inactivity / 600)] minutes.\]\n" + else if((world.realtime - disconnect_time) >= 5 MINUTES) + msg += "\[Disconnected/ghosted [(world.realtime - disconnect_time)/600] minutes ago.\]\n" var/list/wound_flavor_text = list() var/list/is_bleeding = list() diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 70b4c912dab..f1c3232c6a1 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -34,6 +34,7 @@ if(hud_used) qdel(hud_used) //remove the hud objects hud_used = new /datum/hud(src) + disconnect_time = null next_move = 1 sight |= SEE_SELF ..() diff --git a/code/modules/mob/logout.dm b/code/modules/mob/logout.dm index d1b8d62e7c2..56a5dc805df 100644 --- a/code/modules/mob/logout.dm +++ b/code/modules/mob/logout.dm @@ -1,6 +1,7 @@ /mob/Logout() SSnanoui.user_logout(src) // this is used to clean up (remove) this user's Nano UIs player_list -= src + disconnect_time = world.realtime log_access("Logout: [key_name(src)]",ckey=key_name(src)) if(admin_datums[src.ckey]) if (SSticker.current_state == GAME_STATE_PLAYING) //Only report this stuff if we are currently playing. diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 8ad8866e6df..2a23b6e9c9f 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -95,7 +95,7 @@ var/list/speak_emote = list("says") // Verbs used when speaking. Defaults to 'say' if speak_emote is null. var/emote_type = 1 // Define emote default type, 1 for seen emotes, 2 for heard emotes var/facing_dir = null // Used for the ancient art of moonwalking. - + var/obj/machinery/hologram/holopad/holo = null var/name_archive //For admin things like possession @@ -221,3 +221,4 @@ var/frozen = FALSE //related to wizard statues, if set to true, life won't process gfi_layer_rotation = GFI_ROTATION_DEFDIR + var/disconnect_time = null//Time of client loss, set by Logout(), for timekeeping diff --git a/html/changelogs/ssd.yml b/html/changelogs/ssd.yml new file mode 100644 index 00000000000..5ed4d0b782c --- /dev/null +++ b/html/changelogs/ssd.yml @@ -0,0 +1,37 @@ +################################ +# 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 +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +################################# + +# Your name. +author: LordFowl + +# 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, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "SSD/Inactivity timers are available when examining another player."