From 1c8bdb0d7ae65b208cd531eefb8ca3de5838a0c8 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 16 Jun 2019 11:33:57 +0200 Subject: [PATCH] Adds a list SSD players verb for admins --- code/controllers/configuration.dm | 5 +++ code/modules/admin/admin_verbs.dm | 1 + code/modules/admin/topic.dm | 7 +++- code/modules/admin/verbs/randomverbs.dm | 51 +++++++++++++++++++++++++ config/example/config.txt | 3 ++ 5 files changed, 66 insertions(+), 1 deletion(-) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 3f155fa8031..8b4e7d8a25c 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -74,6 +74,8 @@ var/auto_cryo_ssd_mins = 0 var/ssd_warning = 0 + + var/list_afk_minimum = 5 // How long people have to be AFK before it's listed on the "List AFK players" verb var/prob_free_golems = 75 //chance for free golems spawners to appear roundstart var/unrestricted_free_golems = FALSE //if true, free golems can appear on all roundtypes @@ -319,6 +321,9 @@ if("ssd_warning") config.ssd_warning = 1 + if("list_afk_minimum") + config.list_afk_minimum = text2num(value) + if("ipintel_email") if(value != "ch@nge.me") config.ipintel_email = value diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 06c2361b90a..ff44844be4a 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -77,6 +77,7 @@ var/list/admin_verbs_admin = list( /client/proc/toggle_mentor_chat, /client/proc/toggle_advanced_interaction, /*toggle admin ability to interact with not only machines, but also atoms such as buttons and doors*/ /client/proc/list_ssds, + /client/proc/list_afks, /client/proc/cmd_admin_headset_message, /client/proc/spawn_floor_cluwne, /client/proc/show_discord_duplicates, diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 224f07d4277..68fed1ba10a 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1993,7 +1993,7 @@ if(!istype(H)) to_chat(usr, "This can only be used on instances of type /mob/living/carbon/human") return - if(!isLivingSSD(H)) + if(!href_list["cryoafk"] && !isLivingSSD(H)) to_chat(usr, "This can only be used on living, SSD players.") return if(istype(H.loc, /obj/machinery/cryopod)) @@ -2001,6 +2001,11 @@ P.despawn_occupant() log_admin("[key_name(usr)] despawned [H.job] [H] in cryo.") message_admins("[key_name_admin(usr)] despawned [H.job] [H] in cryo.") + if(href_list["cryoafk"]) // Warn them if they are send to storage and are AFK + to_chat(H, "The admins have moved you to cryo storage for being AFK. Please move out of cryostorage if you want to avoid being despawned.") + H << 'sound/effects/adminhelp.ogg' + if(H.client) + window_flash(H.client) else if(cryo_ssd(H)) log_admin("[key_name(usr)] sent [H.job] [H] to cryo.") message_admins("[key_name_admin(usr)] sent [H.job] [H] to cryo.") diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index ec731458109..4404aa421cc 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -1001,6 +1001,57 @@ Traitors and the like can also be revived with the previous role mostly intact. msg += "" src << browse(msg, "window=Player_ssd_check") +/client/proc/list_afks() + set category = "Admin" + set name = "List AFKs" + set desc = "Lists AFK players" + + if(!check_rights(R_ADMIN)) + return + + var/msg = "AFK Report" + msg += "AFK Players:
" + msg += "" + var/mins_afk + var/job_string + var/key_string + var/role_string + for(var/mob/living/carbon/human/H in GLOB.living_mob_list) + if(H.client == null || H.stat == DEAD) // No clientless or dead + continue + mins_afk = round(H.client.inactivity / 600) + if(mins_afk < config.list_afk_minimum) + continue + if(H.job) + job_string = H.job + else + job_string = "-" + key_string = H.key + if(job_string in command_positions) + job_string = "" + job_string + "" + role_string = "-" + var/obj_count = 0 + var/obj_string = "" + if(H.mind) + if(H.mind.special_role) + role_string = "[H.mind.special_role]" + if(!H.key && H.mind.key) + key_string = H.mind.key + for(var/datum/objective/O in all_objectives) + if(O.target == H.mind) + obj_count++ + if(obj_count > 0) + obj_string = "
Obj Target" + msg += "" + msg += "" + if(istype(H.loc, /obj/machinery/cryopod)) + msg += "" + else + msg += "" + msg += "" + msg += "
KeyReal NameJobMins AFKSpecial RoleAreaPPNCryo
[key_string][H.real_name][job_string][mins_afk][role_string][obj_string][get_area(H)][ADMIN_PP(H,"PP")]De-SpawnCryo
" + src << browse(msg, "window=Player_afk_check") + /client/proc/toggle_ert_calling() set category = "Event" set name = "Toggle ERT" diff --git a/config/example/config.txt b/config/example/config.txt index 87ed0ce5cf1..8b8600df1da 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -85,6 +85,9 @@ LOG_WORLD_OUTPUT ## log admin warning messages LOG_ADMINWARN +## Amount of minutes that a person has to be AFK before he'll be listed on the "List AFK players" verb +#LIST_AFK_MINIMUM 5 + ## probablities for game modes chosen in "secret" and "random" modes ## ## default probablity is 1, increase to make that mode more likely to be picked