From e5ba67ed0b88b9497f023de2ddfa8fb01d78a7f6 Mon Sep 17 00:00:00 2001 From: bawhoppen Date: Thu, 24 Mar 2016 12:12:51 -0500 Subject: [PATCH] makes code significantly less shit --- code/modules/admin/verbs/adminhelp.dm | 92 ++++++++------------------- 1 file changed, 28 insertions(+), 64 deletions(-) diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 9e937185c1b..bf3da5e19fd 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -69,56 +69,63 @@ src.verbs |= /client/verb/adminhelp adminhelptimerid = 0 -/client/verb/adminhelp(msg as text) - set category = "Admin" - set name = "Adminhelp" +/client/verb/mentorhelp(msg as text) + set category = "Admin" + set name = "Mentorhelp" + ahelp(msg, 'sound/machines/twobeep.ogg', "Mentor", ircalert=FALSE, "MH", 0) - if(say_disabled) //This is here to try to identify lag problems +/client/verb/adminhelp(msg as text) + set category = "Admin" + set name = "Adminhelp" + + ahelp(msg, 'sound/effects/adminhelp.ogg', "Admin", ircalert=TRUE, "AH", 1200) + +/client/proc/ahelp(msg, sound, title, ircalert, unique_id, delay) + if(say_disabled) //This is here to try to identify lag problems usr << "Speech is currently admin-disabled." return - //handle muting and automuting +//handle muting and automuting if(prefs.muted & MUTE_ADMINHELP) - src << "Error: Admin-PM: You cannot send adminhelps (Muted)." + src << "Error: [title]-PM: You cannot send adminhelps (Muted)." return if(src.handle_spam_prevention(msg,MUTE_ADMINHELP)) return - //clean the input msg +//clean the input msg if(!msg) return msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN)) - if(!msg) return + if(!msg) return var/original_msg = msg - //remove our adminhelp verb temporarily to prevent spamming of admins. +//remove our adminhelp verb temporarily to prevent spamming of admins. src.verbs -= /client/verb/adminhelp - adminhelptimerid = addtimer(src, "giveadminhelpverb", 1200, FALSE) //2 minute cooldown of admin helps + adminhelptimerid = addtimer(src, "giveadminhelpverb", delay, FALSE) //2 minute cooldown of admin helps msg = keywords_lookup(msg) if(!mob) - return //this doesn't happen + return //this doesn't happen var/ref_mob = "\ref[mob]" var/ref_client = "\ref[src]" msg = "HELP: [key_name(src)] (?) (PP) (VV) (SM) (FLW) (TP) (REJT): [msg]" - - //send this msg to all admins - +//send this msg to all admins for(var/client/X in admins) if(X.prefs.toggles & SOUND_ADMINHELP) - X << 'sound/effects/adminhelp.ogg' + X << sound X << msg +//show it to the person adminhelping too + src << "PM to-[title]s: [original_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 - //send it to irc if nobody is on and tell us how many were on - var/admin_number_present = send2irc_adminless_only(ckey,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! + if(ircalert) + var/admin_number_present = send2irc_adminless_only(ckey,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",unique_id)//If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! return /proc/get_admin_counts(requiredflags = R_BAN) @@ -147,46 +154,3 @@ if(config.useircbot) shell("python nudge.py [msg] [msg2]") return - - - - -/client/verb/mentorhelp(msg as text) - set category = "Admin" - set name = "Mentorhelp" - - if(say_disabled) - usr << "Speech is currently admin-disabled." - return - - if(prefs.muted & MUTE_ADMINHELP) - src << "Error: Admin-PM: You cannot send mentorhelps (Muted)." - return - if(src.handle_spam_prevention(msg,MUTE_ADMINHELP)) - return - - if(!msg) - return - msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN)) - if(!msg) return - var/original_msg = msg - - msg = keywords_lookup(msg) - - if(!mob) - return - - var/ref_mob = "\ref[mob]" - var/ref_client = "\ref[src]" - msg = "HELP: [key_name(src)] (?) (PP) (VV) (SM) (FLW) (TP) (REJT): [msg]" - - - - for(var/client/X in admins) - if(X.prefs.toggles & SOUND_ADMINHELP) - X << 'sound/machines/twobeep.ogg' - X << msg - - src << "PM to-Mentors: [original_msg]" - -