From ef493f3b5122a68984c46b59b3354c769fe08dbb Mon Sep 17 00:00:00 2001 From: "baloh.matevz" Date: Wed, 11 Jul 2012 17:39:16 +0000 Subject: [PATCH] - Made the number of deciseconds someone has to be inactive to be considered AFK a define (AFK_THRESHOLD) which defaults to 3000ds = 300s = 5m, which is the same as it was before. This is still only used when an admin uses 'adminwho' to tell if admins are AFK. - send2irc will now only send adminhelps to irc if there are no admins online or if all the admins online are AFK. If will add a "- No admins online" to the end of the message if there are no admins online or a " - All admins AFK (X)" with X being the number of admins currently online. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4038 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/verbs/who.dm | 2 +- code/modules/admin/verbs/adminhelp.dm | 16 ++++++++++++++-- code/setup.dm | 5 ++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/code/game/verbs/who.dm b/code/game/verbs/who.dm index ff0d03626f..c8f519c071 100644 --- a/code/game/verbs/who.dm +++ b/code/game/verbs/who.dm @@ -58,7 +58,7 @@ proc/get_all_admin_clients() if(M && M.client && M.client.holder) if(usr.client.holder) var/afk = 0 - if( M.client.inactivity > 3000 ) //3000 deciseconds = 300 seconds = 5 minutes + if( M.client.inactivity > AFK_THRESHOLD ) //When I made this, the AFK_THRESHOLD was 3000ds = 300s = 5m, see setup.dm for the new one. afk = 1 if(isobserver(M)) usr << "[M.key] is a [M.client.holder.rank][M.client.stealth ? " (as [M.client.fakekey])" : ""] - Observing [afk ? "(AFK)" : ""]" diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 065d2c116a..4f6b03097b 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -80,11 +80,16 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an", "monkey", "ali j++ msg = dd_list2text(msglist, " ") + var/admin_number = 0 + var/admin_number_afk = 0 if(mob) var/ref_mob = "\ref[src.mob]" for (var/client/X) if (X.holder) + admin_number++ + if( X.inactivity > AFK_THRESHOLD ) //When I made this, the AFK_THRESHOLD was 3000ds = 300s = 5m, see setup.dm for the new one. + admin_number_afk++ if(X.sound_adminhelp) X << 'adminhelp.ogg' var/msg_to_send = "\blue HELP: [key_name(src, X)] (?) (PP) (VV) (SM) (JMP) (CA): [msg]" @@ -95,6 +100,9 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an", "monkey", "ali var/ref_client = "\ref[src]" for (var/client/X) if (X.holder) + admin_number++ + if( X.inactivity > AFK_THRESHOLD ) //When I made this, the AFK_THRESHOLD was 3000ds = 300s = 5m, see setup.dm for the new one. + admin_number_afk++ if(X.sound_adminhelp) X << 'adminhelp.ogg' var/msg_to_send = "\blue HELP: [key_name(src, X)] (VV) (CA): [msg]" @@ -103,10 +111,14 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an", "monkey", "ali X << msg_to_send src << "PM to-Admins: [original_msg]" - log_admin("HELP: [key_name(src)]: [original_msg]") + log_admin("HELP: [key_name(src)]: [original_msg] - heard by [admin_number] non-AFK admins.") if(tension_master) tension_master.new_adminhelp() - send2irc(ckey, original_msg) + if((admin_number - admin_number_afk) <= 0) + if(!admin_number_afk) + send2irc(ckey, "[original_msg] - No admins online") + else + send2irc(ckey, "[original_msg] - All admins AFK ([admin_number_afk])") feedback_add_details("admin_verb","AH") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! return diff --git a/code/setup.dm b/code/setup.dm index e973a499e3..e2b5de7587 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -396,4 +396,7 @@ var/list/liftable_structures = list(\ #define BANTYPE_PERMA 1 #define BANTYPE_TEMP 2 #define BANTYPE_JOB_PERMA 3 -#define BANTYPE_JOB_TEMP 4 \ No newline at end of file +#define BANTYPE_JOB_TEMP 4 + +//The number of deciseconds which someone needs to be inactive to be classified as AFK: +#define AFK_THRESHOLD 3000 \ No newline at end of file