From b39f120f4b26a73d3a17ac09ccaf0c8f4cc51b06 Mon Sep 17 00:00:00 2001 From: MrStonedOne Date: Thu, 26 Feb 2015 14:07:56 -0800 Subject: [PATCH] Makes the irc new player alert option behave like irc admin pm notices It will only trigger if the new player alert is enabled for admin display and no valid non-afk admins are on to see it. --- code/modules/admin/verbs/adminhelp.dm | 37 +++++++++++++++++---------- code/modules/client/client procs.dm | 7 ++--- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 09e3cc4484c..93da6704f1f 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -88,6 +88,23 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey"," msg = "HELP: [key_name(src, 1)] (?) (PP) (VV) (SM) (JMP) (CA) [ai_found ? " (CL)" : ""]: [msg]" //send this msg to all admins + + for(var/client/X in admins) + if(X.prefs.toggles & SOUND_ADMINHELP) + X << 'sound/effects/adminhelp.ogg' + X << msg + + + //show it to the person adminhelping too + src << "PM to-Admins: [original_msg]" + + //send it to irc if nobody is on and tell us how many were on + var/admin_number_present = send2irc_adminless_only(original_msg) + log_admin("HELP: [key_name(src)]: [original_msg] - heard by [admin_number_present] non-AFK admins who have +BAN.") + feedback_add_details("admin_verb","AH") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + return + +proc/send2irc_adminless_only(source, msg, requiredflags = R_BAN) var/admin_number_total = 0 //Total number of admins var/admin_number_afk = 0 //Holds the number of admins who are afk var/admin_number_ignored = 0 //Holds the number of admins without +BAN (so admins who are not really admins) @@ -95,30 +112,24 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey"," for(var/client/X in admins) admin_number_total++; var/invalid = 0 - if(!check_rights_for(X, R_BAN)) + if(requiredflags != 0 && !check_rights_for(X, requiredflags)) admin_number_ignored++ invalid = 1 if(X.is_afk()) admin_number_afk++ invalid = 1 + if(X.holder.fakekey) + admin_number_ignored++ + invalid = 1 if(invalid) admin_number_decrease++ - if(X.prefs.toggles & SOUND_ADMINHELP) - X << 'sound/effects/adminhelp.ogg' - X << msg - - //show it to the person adminhelping too - src << "PM to-Admins: [original_msg]" - var/admin_number_present = admin_number_total - admin_number_decrease //Number of admins who are neither afk nor invalid - log_admin("HELP: [key_name(src)]: [original_msg] - heard by [admin_number_present] non-AFK admins who have +BAN.") if(admin_number_present <= 0) if(!admin_number_afk && !admin_number_ignored) - send2irc(ckey, "[original_msg] - No admins online") + send2irc(source, "[msg] - No admins online") else - send2irc(ckey, "[original_msg] - All admins AFK ([admin_number_afk]/[admin_number_total]) or skipped ([admin_number_ignored]/[admin_number_total])") - feedback_add_details("admin_verb","AH") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - return + send2irc(source, "[msg] - All admins AFK ([admin_number_afk]/[admin_number_total]) or skipped ([admin_number_ignored]/[admin_number_total])") + return admin_number_present proc/send2irc(msg,msg2) if(config.useircbot) diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 51ca6ecf703..4bc8b7f6504 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -90,7 +90,9 @@ var/list/external_rsc_urls var/next_external_rsc = 0 #endif + /client/New(TopicData) + TopicData = null //Prevent calls to client.Topic from connect if(connection != "seeker") //Invalid connection type. @@ -144,9 +146,8 @@ var/next_external_rsc = 0 if (config.notify_new_player_age >= 0) message_admins("New user: [key_name_admin(src)] is connecting here for the first time.") - - if (config.irc_first_connection_alert) - send2irc("New user", "[key_name(src)] is connecting for the first time!") + if (config.irc_first_connection_alert) + send2irc_adminless_only("New user", "[key_name(src)] is connecting for the first time!") player_age = 0 // set it from -1 to 0 so the job selection code doesn't have a panic attack