mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +00:00
Merged var/muted_ic; var/muted_ooc; var/muted_deadchat; var/muted_pray; var/muted_adminhelp into var/muted as bitflags
Added a config option config.automute_on It toggles automuting. Admins cannot be muted. Made the proc/cmd_admin_mute code shorter. Automuting defaults to off git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4758 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -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]'"
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -64,12 +64,12 @@ var/global/floorIsLava = 0
|
||||
if(M.client)
|
||||
body += "| <A HREF='?src=\ref[src];sendtoprison=\ref[M]'>Prison</A> | "
|
||||
body += "<br><b>Mute: </b> "
|
||||
body += "\[<A href='?src=\ref[src];mute=\ref[M];mute_type=[MUTE_IC]'><font color='[(M.client.muted_ic)?"red":"blue"]'>IC</font></a> | "
|
||||
body += "<A href='?src=\ref[src];mute=\ref[M];mute_type=[MUTE_OOC]'><font color='[(M.client.muted_ooc)?"red":"blue"]'>OOC</font></a> | "
|
||||
body += "<A href='?src=\ref[src];mute=\ref[M];mute_type=[MUTE_PRAY]'><font color='[(M.client.muted_pray)?"red":"blue"]'>PRAY</font></a> | "
|
||||
body += "<A href='?src=\ref[src];mute=\ref[M];mute_type=[MUTE_ADMINHELP]'><font color='[(M.client.muted_adminhelp)?"red":"blue"]'>ADMINHELP</font></a> | "
|
||||
body += "<A href='?src=\ref[src];mute=\ref[M];mute_type=[MUTE_DEADCHAT]'><font color='[(M.client.muted_deadchat)?"red":"blue"]'>DEADCHAT</font></a>\]"
|
||||
body += "(<A href='?src=\ref[src];mute=\ref[M];mute_type=[MUTE_ALL]'>toggle all</a>)"
|
||||
body += "\[<A href='?src=\ref[src];mute=\ref[M];mute_type=[MUTE_IC]'><font color='[(M.client.muted & MUTE_IC)?"red":"blue"]'>IC</font></a> | "
|
||||
body += "<A href='?src=\ref[src];mute=\ref[M];mute_type=[MUTE_OOC]'><font color='[(M.client.muted & MUTE_OOC)?"red":"blue"]'>OOC</font></a> | "
|
||||
body += "<A href='?src=\ref[src];mute=\ref[M];mute_type=[MUTE_PRAY]'><font color='[(M.client.muted & MUTE_PRAY)?"red":"blue"]'>PRAY</font></a> | "
|
||||
body += "<A href='?src=\ref[src];mute=\ref[M];mute_type=[MUTE_ADMINHELP]'><font color='[(M.client.muted & MUTE_ADMINHELP)?"red":"blue"]'>ADMINHELP</font></a> | "
|
||||
body += "<A href='?src=\ref[src];mute=\ref[M];mute_type=[MUTE_DEADCHAT]'><font color='[(M.client.muted & MUTE_DEADCHAT)?"red":"blue"]'>DEADCHAT</font></a>\]"
|
||||
body += "(<A href='?src=\ref[src];mute=\ref[M];mute_type=[MUTE_ALL]'><font color='[(M.client.muted & MUTE_ALL)?"red":"blue"]'>toggle all</font></a>)"
|
||||
|
||||
body += "<br><br>"
|
||||
body += "<A href='?src=\ref[src];jumpto=\ref[M]'><b>Jump to</b></A> | "
|
||||
|
||||
@@ -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 << "<font color='red'>Error: Admin-PM: You cannot send adminhelps (Muted by admins).</font>"
|
||||
if(muted & MUTE_ADMINHELP)
|
||||
src << "<font color='red'>Error: Admin-PM: You cannot send adminhelps (Muted).</font>"
|
||||
return
|
||||
|
||||
if (src.handle_spam_prevention(msg,MUTE_ADMINHELP))
|
||||
|
||||
@@ -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 << "<font color='red'>Error: Admin-PM: You are unable to use admin PM-s (muted by admins).</font>"
|
||||
if(src.muted & MUTE_ADMINHELP)
|
||||
src << "<font color='red'>Error: Admin-PM: You are unable to use admin PM-s (muted).</font>"
|
||||
return
|
||||
|
||||
if( !C || !istype(C,/client) )
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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 << "<font color='red'>Error: cmd_admin_mute: You don't have permission to do this.</font>"
|
||||
return
|
||||
if(!M.client)
|
||||
usr << "<font color='red'>Error: cmd_admin_mute: This mob doesn't have a client tied to it.</font>"
|
||||
if(M.client.holder)
|
||||
usr << "<font color='red'>Error: cmd_admin_mute: You cannot mute an admin.</font>"
|
||||
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()
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -161,4 +161,7 @@ TICKCOMP 0
|
||||
HUMANS_NEED_SURNAMES
|
||||
|
||||
## Uncomment this to ban use of ToR
|
||||
#TOR_BAN
|
||||
#TOR_BAN
|
||||
|
||||
## Comment this out to disable automuting
|
||||
#AUTOMUTE_ON
|
||||
Reference in New Issue
Block a user