diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 0536ce772b..7c226e72c6 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -49,6 +49,7 @@ var/kick_inactive = 0 //force disconnect for inactive players var/load_jobs_from_txt = 0 var/ToRban = 0 + var/automute_on = 0 //enables automuting/spam prevention var/server var/banappeals @@ -336,6 +337,9 @@ if("tor_ban") ToRban = 1 + if("automute_on") + automute_on = 1 + else diary << "Unknown setting in configuration: '[name]'" diff --git a/code/game/verbs/ooc.dm b/code/game/verbs/ooc.dm index d3854905e1..a0e6bfb379 100644 --- a/code/game/verbs/ooc.dm +++ b/code/game/verbs/ooc.dm @@ -13,7 +13,7 @@ set name = "OOC" //Gave this shit a shorter name so you only have to time out "ooc" rather than "ooc message" to use it --NeoFite set category = "OOC" if (IsGuestKey(src.key)) - src << "You are not authorized to communicate over these channels." + src << "Guests may not use OOC." return msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN) if(!msg) @@ -28,8 +28,8 @@ usr << "\red OOC for dead mobs has been turned off." return else if (src.client) - if(src.client.muted_ooc) - src << "\red You cannot use OOC (muted by admins)." + if(src.client.muted & MUTE_OOC) + src << "\red You cannot use OOC (muted)." return if (src.client.handle_spam_prevention(msg,MUTE_OOC)) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index e5e1380959..d1ed4652a5 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -64,12 +64,12 @@ var/global/floorIsLava = 0 if(M.client) body += "| Prison | " body += "
Mute: " - body += "\[IC | " - body += "OOC | " - body += "PRAY | " - body += "ADMINHELP | " - body += "DEADCHAT\]" - body += "(toggle all)" + body += "\[IC | " + body += "OOC | " + body += "PRAY | " + body += "ADMINHELP | " + body += "DEADCHAT\]" + body += "(toggle all)" body += "

" body += "Jump to | " diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 6c61175a58..235a41ae6e 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -7,8 +7,8 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an", "monkey", "ali set category = "Admin" set name = "Adminhelp" - if (muted_adminhelp) - src << "Error: Admin-PM: You cannot send adminhelps (Muted by admins)." + if(muted & MUTE_ADMINHELP) + src << "Error: Admin-PM: You cannot send adminhelps (Muted)." return if (src.handle_spam_prevention(msg,MUTE_ADMINHELP)) diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index 9c65027d5c..e7b2eae3d7 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -36,8 +36,8 @@ //takes input from cmd_admin_pm_context, cmd_admin_pm_panel or /client/Topic and sends them a PM. //Fetching a message if needed. src is the sender and C is the target client /client/proc/cmd_admin_pm(var/client/C, var/msg) - if(src.muted_adminhelp) - src << "Error: Admin-PM: You are unable to use admin PM-s (muted by admins)." + if(src.muted & MUTE_ADMINHELP) + src << "Error: Admin-PM: You are unable to use admin PM-s (muted)." return if( !C || !istype(C,/client) ) diff --git a/code/modules/admin/verbs/adminsay.dm b/code/modules/admin/verbs/adminsay.dm index 73756fc80a..b4d0d75d94 100644 --- a/code/modules/admin/verbs/adminsay.dm +++ b/code/modules/admin/verbs/adminsay.dm @@ -7,8 +7,8 @@ src << "Only administrators may use this command." return - if (src.muted_adminhelp) - src << "You cannot send ASAY messages (muted by admins)." + if (src.muted & MUTE_ADMINHELP) + src << "You cannot send ASAY messages (muted)." return if (src.handle_spam_prevention(msg,MUTE_ADMINHELP)) diff --git a/code/modules/admin/verbs/deadsay.dm b/code/modules/admin/verbs/deadsay.dm index 13995610d0..ce4256e51b 100644 --- a/code/modules/admin/verbs/deadsay.dm +++ b/code/modules/admin/verbs/deadsay.dm @@ -7,8 +7,8 @@ return if(!src.mob) return - if(src.muted_deadchat) - src << "\red You cannot send DSAY messages (muted by admins)." + if(src.muted & MUTE_DEADCHAT) + src << "\red You cannot send DSAY messages (muted)." return if (src.handle_spam_prevention(msg,MUTE_DEADCHAT)) diff --git a/code/modules/admin/verbs/pray.dm b/code/modules/admin/verbs/pray.dm index 615253c104..fd4fcb9cc1 100644 --- a/code/modules/admin/verbs/pray.dm +++ b/code/modules/admin/verbs/pray.dm @@ -8,7 +8,8 @@ return if (usr.client) - if(usr.client.muted_pray) + if(usr.client.muted & MUTE_PRAY) + usr << "\red You cannot pray (muted)." return if (src.client.handle_spam_prevention(msg,MUTE_PRAY)) diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 2dfd8b54ef..a90557d4c7 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -123,73 +123,55 @@ message_admins("[key_name_admin(usr)] has toggled [key_name_admin(M)]'s nodamage to [(M.nodamage ? "On" : "Off")]", 1) feedback_add_details("admin_verb","GOD") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + proc/cmd_admin_mute(mob/M as mob, mute_type, automute = 0) - if(!automute) - if(usr && usr.client) - if(!usr.client.holder) - src << "Only administrators may use this command." - return - if (M.client && M.client.holder && (M.client.holder.level >= usr.client.holder.level)) - alert("You cannot perform this action. You must be of a higher administrative rank!", null, null, null, null, null) - return - if(!M.client) - src << "This mob doesn't have a client tied to it." + if(automute) + if(!config.automute_on) return + else + if(!usr || !usr.client) + return + if(!usr.client.holder) + usr << "Error: cmd_admin_mute: You don't have permission to do this." + return + if(!M.client) + usr << "Error: cmd_admin_mute: This mob doesn't have a client tied to it." + if(M.client.holder) + usr << "Error: cmd_admin_mute: You cannot mute an admin." + if(!M.client) return + if(M.client.holder) return + + var/muteunmute + var/mute_string + + switch(mute_type) + if(MUTE_IC) mute_string = "IC (say and emote)" + if(MUTE_OOC) mute_string = "OOC" + if(MUTE_PRAY) mute_string = "pray" + if(MUTE_ADMINHELP) mute_string = "adminhelp, admin PM and ASAY" + if(MUTE_DEADCHAT) mute_string = "deadchat and DSAY" + if(MUTE_ALL) mute_string = "everything" + else return + + if(automute) + muteunmute = "auto-muted" + M.client.muted |= mute_type + log_admin("SPAM AUTOMUTE: [muteunmute] [key_name(M)] from [mute_string]") + message_admins("SPAM AUTOMUTE: [muteunmute] [key_name_admin(M)] from [mute_string].", 1) + M << "You have been [muteunmute] from [mute_string] by the SPAM AUTOMUTE system. Contact an admin." + feedback_add_details("admin_verb","AUTOMUTE") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! return - var/muteunmute = 0 //0 = unmuted; 1 = muted - var/mute_string = "unknown" - - //The '| automute' thing ensures that if an automute is being applied by code, it always mutes to prevent any potential for automute to unmute someone who was muted. - switch(mute_type) - if(MUTE_IC) - M.client.muted_ic = !M.client.muted_ic | automute - muteunmute = M.client.muted_ic - mute_string = "IC (say and emote)" - if(MUTE_OOC) - M.client.muted_ooc = !M.client.muted_ooc | automute - muteunmute = M.client.muted_ooc - mute_string = "OOC" - if(MUTE_PRAY) - M.client.muted_pray = !M.client.muted_pray | automute - muteunmute = M.client.muted_pray - mute_string = "pray" - if(MUTE_ADMINHELP) - M.client.muted_adminhelp = !M.client.muted_adminhelp | automute - muteunmute = M.client.muted_adminhelp - mute_string = "adminhelp, admin PM and ASAY" - if(MUTE_DEADCHAT) - M.client.muted_deadchat = !M.client.muted_deadchat | automute - muteunmute = M.client.muted_deadchat - mute_string = "deadchat and DSAY" - if(MUTE_ALL) - mute_string = "everything" - if( M.client.muted_ic ) - M.client.muted_ic = 1 - M.client.muted_ooc = 1 - M.client.muted_pray = 1 - M.client.muted_adminhelp = 1 - M.client.muted_deadchat = 1 - muteunmute = 1 - else - M.client.muted_ic = 0 - M.client.muted_ooc = 0 - M.client.muted_pray = 0 - M.client.muted_adminhelp = 0 - M.client.muted_deadchat = 0 - muteunmute = 0 - - if(!automute) - log_admin("[key_name(usr)] has [(muteunmute ? "muted" : "voiced")] [key_name(M)] from [mute_string]") - message_admins("[key_name_admin(usr)] has [(muteunmute ? "muted" : "voiced")] [key_name_admin(M)] from [mute_string].", 1) - - M << "You have been [(muteunmute ? "muted" : "voiced")] from [mute_string]." - feedback_add_details("admin_verb","MUTE") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + if(M.client.muted & mute_type) + muteunmute = "unmuted" + M.client.muted &= ~mute_type else - log_admin("SPAM AUTOMUTE: [(muteunmute ? "muted" : "voiced")] [key_name(M)] from [mute_string]") - message_admins("SPAM AUTOMUTE: [(muteunmute ? "muted" : "voiced")] [key_name_admin(M)] from [mute_string].", 1) + muteunmute = "muted" + M.client.muted |= mute_type - M << "You have been [(muteunmute ? "muted" : "voiced")] from [mute_string] by the SPAM AUTOMUTE system. Contact an admin." - feedback_add_details("admin_verb","AUTOMUTE") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + log_admin("[key_name(usr)] has [muteunmute] [key_name(M)] from [mute_string]") + message_admins("[key_name_admin(usr)] has [muteunmute] [key_name_admin(M)] from [mute_string].", 1) + M << "You have been [muteunmute] from [mute_string]." + feedback_add_details("admin_verb","MUTE") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/cmd_admin_add_random_ai_law() diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index e7e2f23907..700dee2106 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -6,11 +6,7 @@ var/buildmode = 0 var/seeprayers = 0 - var/muted_ic //can't use 'say' while alive or emotes. - var/muted_ooc //can't speak in ooc - var/muted_deadchat //can't use 'say' while dead or DSAY - var/muted_pray //can't send prayers - var/muted_adminhelp //can't send adminhelps, PM-s or use ASAY + var/muted = 0 var/last_message = "" //Contains the last message sent by this client - used to protect against copy-paste spamming. var/last_message_count = 0 //contins a number of how many times a message identical to last_message was sent. diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index a1c32f3a9e..8f26b3928a 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -55,7 +55,7 @@ ..() //redirect to [locate(hsrc)]/Topic() /client/proc/handle_spam_prevention(var/message, var/mute_type) - if(src.last_message == message) + if(config.automute_on && !holder && src.last_message == message) src.last_message_count++ if(src.last_message_count >= SPAM_TRIGGER_AUTOMUTE) src << "\red You have exceeded the spam filter limit for identical messages. An auto-mute was applied." diff --git a/code/modules/mob/dead/observer/say.dm b/code/modules/mob/dead/observer/say.dm index 7f7f86d3a4..4a2857e938 100644 --- a/code/modules/mob/dead/observer/say.dm +++ b/code/modules/mob/dead/observer/say.dm @@ -10,8 +10,8 @@ log_say("Ghost/[src.key] : [message]") if (src.client) - if(src.client.muted_deadchat) - src << "\red You cannot talk in deadchat (muted by admins)." + if(src.client.muted & MUTE_DEADCHAT) + src << "\red You cannot talk in deadchat (muted)." return if (src.client.handle_spam_prevention(message,MUTE_DEADCHAT)) diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm index 32f797a978..f0407f0ec3 100644 --- a/code/modules/mob/living/carbon/human/emote.dm +++ b/code/modules/mob/living/carbon/human/emote.dm @@ -66,8 +66,8 @@ if(silent) return if (src.client) - if (client.muted_ic) - src << "\red You cannot send IC messages (muted by admins)." + if (client.muted & MUTE_IC) + src << "\red You cannot send IC messages (muted)." return if (src.client.handle_spam_prevention(message,MUTE_IC)) return diff --git a/code/modules/mob/living/carbon/human/whisper.dm b/code/modules/mob/living/carbon/human/whisper.dm index 7525e90fe7..e7566dbfca 100644 --- a/code/modules/mob/living/carbon/human/whisper.dm +++ b/code/modules/mob/living/carbon/human/whisper.dm @@ -8,8 +8,8 @@ log_whisper("[src.name]/[src.key] : [message]") if (src.client) - if (src.client.muted_ic) - src << "\red You cannot whisper (muted by admins)." + if (src.client.muted & MUTE_IC) + src << "\red You cannot whisper (muted)." return if (src.client.handle_spam_prevention(message,MUTE_IC)) diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 347b0d1177..3e95b65d40 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -86,8 +86,8 @@ var/list/department_radio_keys = list( return say_dead(message) if (src.client) - if(client.muted_ic) - src << "\red You cannot speak in IC (muted by admins)." + if(client.muted & MUTE_IC) + src << "\red You cannot speak in IC (muted)." return if (src.client.handle_spam_prevention(message,MUTE_IC)) return diff --git a/code/modules/mob/living/silicon/robot/emote.dm b/code/modules/mob/living/silicon/robot/emote.dm index 6c83956157..016f3dcb79 100644 --- a/code/modules/mob/living/silicon/robot/emote.dm +++ b/code/modules/mob/living/silicon/robot/emote.dm @@ -69,8 +69,8 @@ if ("me") if (src.client) - if(client.muted_ic) - src << "You cannot send IC messages (muted by admins)." + if(client.muted & MUTE_IC) + src << "You cannot send IC messages (muted)." return if (src.client.handle_spam_prevention(message,MUTE_IC)) return diff --git a/code/modules/mob/living/silicon/say.dm b/code/modules/mob/living/silicon/say.dm index 9369d0f48e..39c80bc7b0 100644 --- a/code/modules/mob/living/silicon/say.dm +++ b/code/modules/mob/living/silicon/say.dm @@ -3,8 +3,8 @@ return if (src.client) - if(client.muted_ic) - src << "You cannot send IC messages (muted by admins)." + if(client.muted & MUTE_IC) + src << "You cannot send IC messages (muted)." return if (src.client.handle_spam_prevention(message,MUTE_IC)) return diff --git a/code/setup.dm b/code/setup.dm index e1b75149b1..8fd8a3b9f6 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -447,12 +447,14 @@ var/list/liftable_structures = list(\ /obj/machinery/portable_atmospherics/canister) //A set of constants used to determine which type of mute an admin wishes to apply: -#define MUTE_IC 1 -#define MUTE_OOC 2 -#define MUTE_PRAY 3 -#define MUTE_ADMINHELP 4 -#define MUTE_DEADCHAT 5 -#define MUTE_ALL 6 +//Please read and understand the muting/automuting stuff before changing these. MUTE_IC_AUTO etc = (MUTE_IC << 1) +//Therefore there needs to be a gap between the flags for the automute flags +#define MUTE_IC 1 +#define MUTE_OOC 2 +#define MUTE_PRAY 4 +#define MUTE_ADMINHELP 8 +#define MUTE_DEADCHAT 16 +#define MUTE_ALL 31 //Number of identical messages required to get the spam-prevention automute thing to trigger warnings and automutes #define SPAM_TRIGGER_WARNING 5 diff --git a/config/config.txt b/config/config.txt index b980032248..adb63df8e8 100644 --- a/config/config.txt +++ b/config/config.txt @@ -161,4 +161,7 @@ TICKCOMP 0 HUMANS_NEED_SURNAMES ## Uncomment this to ban use of ToR -#TOR_BAN \ No newline at end of file +#TOR_BAN + +## Comment this out to disable automuting +#AUTOMUTE_ON \ No newline at end of file