Moves mutes to a GLOB

This commit is contained in:
AffectedArc07
2021-09-07 15:09:37 +01:00
parent 6ef47b7e82
commit fce2828724
20 changed files with 68 additions and 37 deletions
+6 -7
View File
@@ -140,14 +140,13 @@ GLOBAL_VAR_INIT(nologevent, 0)
body += "\ <A href='?_src_=holder;sendbacktolobby=[M.UID()]'>Send back to Lobby</A> | "
body += "\ <A href='?_src_=holder;eraseflavortext=[M.UID()]'>Erase Flavor Text</A> | "
body += "\ <A href='?_src_=holder;userandomname=[M.UID()]'>Use Random Name</A> | "
var/muted = M.client.prefs.muted
body += {"<br><b>Mute: </b>
\[<A href='?_src_=holder;mute=[M.UID()];mute_type=[MUTE_IC]'><font color='[(muted & MUTE_IC)?"red":"#6685f5"]'>IC</font></a> |
<A href='?_src_=holder;mute=[M.UID()];mute_type=[MUTE_OOC]'><font color='[(muted & MUTE_OOC)?"red":"#6685f5"]'>OOC</font></a> |
<A href='?_src_=holder;mute=[M.UID()];mute_type=[MUTE_PRAY]'><font color='[(muted & MUTE_PRAY)?"red":"#6685f5"]'>PRAY</font></a> |
<A href='?_src_=holder;mute=[M.UID()];mute_type=[MUTE_ADMINHELP]'><font color='[(muted & MUTE_ADMINHELP)?"red":"#6685f5"]'>ADMINHELP</font></a> |
<A href='?_src_=holder;mute=[M.UID()];mute_type=[MUTE_DEADCHAT]'><font color='[(muted & MUTE_DEADCHAT)?"red":"#6685f5"]'>DEADCHAT</font></a>\]
(<A href='?_src_=holder;mute=[M.UID()];mute_type=[MUTE_ALL]'><font color='[(muted & MUTE_ALL)?"red":"#6685f5"]'>toggle all</font></a>)
\[<A href='?_src_=holder;mute=[M.UID()];mute_type=[MUTE_IC]'><font color='[check_mute(M.client.ckey, MUTE_IC) ? "red" : "#6685f5"]'>IC</font></a> |
<A href='?_src_=holder;mute=[M.UID()];mute_type=[MUTE_OOC]'><font color='[check_mute(M.client.ckey, MUTE_OOC) ? "red" : "#6685f5"]'>OOC</font></a> |
<A href='?_src_=holder;mute=[M.UID()];mute_type=[MUTE_PRAY]'><font color='[check_mute(M.client.ckey, MUTE_PRAY) ? "red" : "#6685f5"]'>PRAY</font></a> |
<A href='?_src_=holder;mute=[M.UID()];mute_type=[MUTE_ADMINHELP]'><font color='[check_mute(M.client.ckey, MUTE_ADMINHELP) ? "red" : "#6685f5"]'>ADMINHELP</font></a> |
<A href='?_src_=holder;mute=[M.UID()];mute_type=[MUTE_DEADCHAT]'><font color='[check_mute(M.client.ckey, MUTE_DEADCHAT) ?" red" : "#6685f5"]'>DEADCHAT</font></a>]
(<A href='?_src_=holder;mute=[M.UID()];mute_type=[MUTE_ALL]'><font color='[check_mute(M.client.ckey, MUTE_ALL) ? "red" : "#6685f5"]'>toggle all</font></a>)
"}
var/jumptoeye = ""
+32
View File
@@ -0,0 +1,32 @@
/// Associative list of people who are muted via admin mutes
GLOBAL_LIST_EMPTY(admin_mutes_assoc)
/proc/check_mute(ckey, muteflag)
if(isnull(GLOB.admin_mutes_assoc[ckey]))
return FALSE
if(GLOB.admin_mutes_assoc[ckey] & muteflag)
return TRUE
return FALSE
/proc/toggle_mute(ckey, muteflag)
if(isnull(GLOB.admin_mutes_assoc[ckey]))
GLOB.admin_mutes_assoc[ckey] = 0
if(GLOB.admin_mutes_assoc[ckey] & muteflag)
GLOB.admin_mutes_assoc[ckey] &= ~muteflag
else
GLOB.admin_mutes_assoc[ckey] |= muteflag
/proc/force_add_mute(ckey, muteflag)
if(isnull(GLOB.admin_mutes_assoc[ckey]))
GLOB.admin_mutes_assoc[ckey] = 0
GLOB.admin_mutes_assoc[ckey] |= muteflag
/proc/force_remove_mute(ckey, muteflag)
if(isnull(GLOB.admin_mutes_assoc[ckey]))
GLOB.admin_mutes_assoc[ckey] = 0
GLOB.admin_mutes_assoc[ckey] &= ~muteflag
+1 -1
View File
@@ -6,7 +6,7 @@ GLOBAL_LIST_INIT(adminhelp_ignored_words, list("unknown", "the", "a", "an", "of"
set name = "Adminhelp"
//handle muting and automuting
if(prefs.muted & MUTE_ADMINHELP)
if(check_mute(ckey, MUTE_ADMINHELP))
to_chat(src, "<font color='red'>Error: Admin-PM: You cannot send adminhelps (Muted).</font>")
return
+2 -2
View File
@@ -58,7 +58,7 @@
//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(whom, msg, type = "PM")
if(prefs.muted & MUTE_ADMINHELP)
if(check_mute(ckey, MUTE_ADMINHELP))
to_chat(src, "<span class='danger'>Error: Private-Message: You are unable to use PM-s (muted).</span>")
return
@@ -212,7 +212,7 @@
return
/client/proc/cmd_admin_discord_pm()
if(prefs.muted & MUTE_ADMINHELP)
if(check_mute(ckey, MUTE_ADMINHELP))
to_chat(src, "<span class='danger'>Error: Private-Message: You are unable to use PMs (muted).</span>")
return
+1 -1
View File
@@ -9,7 +9,7 @@
if(!src.mob)
return
if(prefs.muted & MUTE_DEADCHAT)
if(check_mute(ckey, MUTE_DEADCHAT))
to_chat(src, "<span class='warning'>You cannot send DSAY messages (muted).</span>")
return
+1 -1
View File
@@ -7,7 +7,7 @@
return
if(usr.client)
if(usr.client.prefs.muted & MUTE_PRAY)
if(check_mute(client.ckey, MUTE_PRAY))
to_chat(usr, "<span class='warning'>You cannot pray (muted).</span>")
return
if(client.handle_spam_prevention(msg, MUTE_PRAY, OOC_COOLDOWN))
+6 -6
View File
@@ -230,19 +230,19 @@
if(automute)
muteunmute = "auto-muted"
M.client.prefs.muted |= mute_type
force_add_mute(M.client.ckey, 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)
to_chat(M, "You have been [muteunmute] from [mute_string] by the SPAM AUTOMUTE system. Contact an admin.")
SSblackbox.record_feedback("tally", "admin_verb", 1, "Automute") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
return
if(M.client.prefs.muted & mute_type)
muteunmute = "unmuted"
M.client.prefs.muted &= ~mute_type
else
toggle_mute(M.client.ckey, mute_type)
if(check_mute(M.client.ckey, mute_type))
muteunmute = "muted"
M.client.prefs.muted |= mute_type
else
muteunmute = "unmuted"
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)