mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-31 09:08:30 +01:00
aaa (#1879)
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
GLOBAL_VAR_INIT(AOOC_COLOR, "#de3c8c")
|
||||
GLOBAL_VAR_INIT(aooc_allowed, TRUE) // used with admin verbs to disable aooc - not a config option
|
||||
GLOBAL_LIST_EMPTY(ckey_to_aooc_name)
|
||||
|
||||
#define AOOC_LISTEN_PLAYER 1
|
||||
#define AOOC_LISTEN_ADMIN 2
|
||||
|
||||
/client/verb/aooc(msg as text)
|
||||
set name = "AOOC"
|
||||
set category = "OOC"
|
||||
|
||||
if(GLOB.say_disabled) //This is here to try to identify lag problems
|
||||
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
|
||||
return
|
||||
|
||||
if(!mob)
|
||||
return
|
||||
|
||||
if(!holder)
|
||||
if(!mob.mind || !length(mob.mind.antag_datums))
|
||||
to_chat(src, "<span class='danger'>You're not an antagonist!</span>")
|
||||
return
|
||||
if(!GLOB.aooc_allowed)
|
||||
to_chat(src, "<span class='danger'>AOOC is globally muted.</span>")
|
||||
return
|
||||
if(prefs.muted & MUTE_OOC)
|
||||
to_chat(src, "<span class='danger'>You cannot use OOC (muted).</span>")
|
||||
return
|
||||
if(is_banned_from(ckey, "OOC"))
|
||||
to_chat(src, "<span class='danger'>You have been banned from OOC.</span>")
|
||||
return
|
||||
if(QDELETED(src))
|
||||
return
|
||||
|
||||
msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)
|
||||
var/raw_msg = msg
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
msg = emoji_parse(msg)
|
||||
|
||||
if(!(prefs.chat_toggles & CHAT_OOC))
|
||||
to_chat(src, "<span class='danger'>You have OOC muted.</span>")
|
||||
return
|
||||
|
||||
mob.log_talk(raw_msg, LOG_OOC, tag="AOOC")
|
||||
|
||||
var/keyname = key
|
||||
var/anon = FALSE
|
||||
|
||||
//Anonimity for players and deadminned admins
|
||||
if(!holder || holder.deadmined)
|
||||
if(!GLOB.ckey_to_aooc_name[key])
|
||||
GLOB.ckey_to_aooc_name[key] = "Operator [pick(GLOB.phonetic_alphabet)] [rand(1, 99)]"
|
||||
keyname = GLOB.ckey_to_aooc_name[key]
|
||||
anon = TRUE
|
||||
|
||||
var/list/listeners = list()
|
||||
|
||||
for(var/mind in get_antag_minds(/datum/antagonist))
|
||||
var/datum/mind/M = mind
|
||||
if(!M.current || !M.current.client || isnewplayer(M.current))
|
||||
continue
|
||||
listeners[M.current.client] = AOOC_LISTEN_PLAYER
|
||||
|
||||
for(var/m in GLOB.player_list)
|
||||
var/mob/M = m
|
||||
//Admins with muted OOC do not get to listen to AOOC, but normal players do, as it could be admins talking important stuff to them
|
||||
if(M.client && M.client.holder && !M.client.holder.deadmined && M.client.prefs.chat_toggles & CHAT_OOC)
|
||||
listeners[M.client] = AOOC_LISTEN_ADMIN
|
||||
|
||||
for(var/c in listeners)
|
||||
var/client/C = c
|
||||
var/mode = listeners[c]
|
||||
var/color = (!anon && CONFIG_GET(flag/allow_admin_ooccolor) && C.prefs.ooccolor) ? C.prefs.ooccolor : GLOB.AOOC_COLOR
|
||||
var/name = (mode == AOOC_LISTEN_ADMIN && anon) ? "([key])[keyname]" : keyname
|
||||
to_chat(C, "<font color='[color]'><b><span class='prefix'>AOOC:</span> <EM>[name]:</EM> <span class='message linkify'>[msg]</span></b></font>")
|
||||
|
||||
#undef AOOC_LISTEN_PLAYER
|
||||
#undef AOOC_LISTEN_ADMIN
|
||||
|
||||
/proc/toggle_aooc(toggle = null)
|
||||
if(toggle != null) //if we're specifically en/disabling aooc
|
||||
if(toggle != GLOB.aooc_allowed)
|
||||
GLOB.aooc_allowed = toggle
|
||||
else
|
||||
return
|
||||
else //otherwise just toggle it
|
||||
GLOB.aooc_allowed = !GLOB.aooc_allowed
|
||||
var/list/listeners = list()
|
||||
for(var/mind in get_antag_minds(/datum/antagonist))
|
||||
var/datum/mind/M = mind
|
||||
if(!M.current || !M.current.client || isnewplayer(M.current))
|
||||
continue
|
||||
listeners[M.current.client] = TRUE
|
||||
|
||||
for(var/m in GLOB.player_list)
|
||||
var/mob/M = m
|
||||
if(M.client && M.client.holder && !M.client.holder.deadmined)
|
||||
listeners[M.client] = TRUE
|
||||
for(var/c in listeners)
|
||||
var/client/C = c
|
||||
to_chat(C, "<B>The AOOC channel has been globally [GLOB.aooc_allowed ? "enabled" : "disabled"].</B>")
|
||||
|
||||
/datum/admins/proc/toggleaooc()
|
||||
set category = "Server"
|
||||
set name="Toggle Antag OOC"
|
||||
toggle_aooc()
|
||||
log_admin("[key_name(usr)] toggled Antagonist OOC.")
|
||||
message_admins("[key_name_admin(usr)] toggled Antagonist OOC.")
|
||||
SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Toggle Antag OOC", "[GLOB.aooc_allowed ? "Enabled" : "Disabled"]")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
@@ -0,0 +1,118 @@
|
||||
GLOBAL_VAR_INIT(SOOC_COLOR, "#ff5454")
|
||||
GLOBAL_VAR_INIT(sooc_allowed, TRUE) // used with admin verbs to disable sooc - not a config option
|
||||
GLOBAL_LIST_EMPTY(ckey_to_sooc_name)
|
||||
|
||||
#define SOOC_LISTEN_PLAYER 1
|
||||
#define SOOC_LISTEN_ADMIN 2
|
||||
|
||||
/client/verb/sooc(msg as text)
|
||||
set name = "SOOC"
|
||||
set category = "OOC"
|
||||
|
||||
if(GLOB.say_disabled) //This is here to try to identify lag problems
|
||||
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
|
||||
return
|
||||
|
||||
if(!mob)
|
||||
return
|
||||
|
||||
var/static/list/job_lookup = list("Security Officer"=TRUE, "Warden"=TRUE, "Detective"=TRUE, "Head of Security"=TRUE, "Captain"=TRUE, "Blueshield"=TRUE)
|
||||
if(!holder)
|
||||
if(!mob.mind || !job_lookup[mob.mind.assigned_role])
|
||||
to_chat(src, "<span class='danger'>You're not a security role!</span>")
|
||||
return
|
||||
if(!GLOB.sooc_allowed)
|
||||
to_chat(src, "<span class='danger'>SOOC is globally muted.</span>")
|
||||
return
|
||||
if(prefs.muted & MUTE_OOC)
|
||||
to_chat(src, "<span class='danger'>You cannot use OOC (muted).</span>")
|
||||
return
|
||||
if(is_banned_from(ckey, "OOC"))
|
||||
to_chat(src, "<span class='danger'>You have been banned from OOC.</span>")
|
||||
return
|
||||
if(QDELETED(src))
|
||||
return
|
||||
|
||||
msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)
|
||||
var/raw_msg = msg
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
msg = emoji_parse(msg)
|
||||
|
||||
if(!(prefs.chat_toggles & CHAT_OOC))
|
||||
to_chat(src, "<span class='danger'>You have OOC muted.</span>")
|
||||
return
|
||||
|
||||
mob.log_talk(raw_msg, LOG_OOC, tag="SOOC")
|
||||
|
||||
var/keyname = key
|
||||
var/anon = FALSE
|
||||
|
||||
//Anonimity for players and deadminned admins
|
||||
if(!holder || holder.deadmined)
|
||||
if(!GLOB.ckey_to_sooc_name[key])
|
||||
GLOB.ckey_to_sooc_name[key] = "Deputy [pick(GLOB.phonetic_alphabet)] [rand(1, 99)]"
|
||||
keyname = GLOB.ckey_to_sooc_name[key]
|
||||
anon = TRUE
|
||||
|
||||
var/list/listeners = list()
|
||||
|
||||
for(var/mind in get_antag_minds(/datum/antagonist))
|
||||
var/datum/mind/M = mind
|
||||
if(!M.current || !M.current.client || isnewplayer(M.current))
|
||||
continue
|
||||
listeners[M.current.client] = SOOC_LISTEN_PLAYER
|
||||
|
||||
for(var/m in GLOB.player_list)
|
||||
var/mob/M = m
|
||||
//Admins with muted OOC do not get to listen to SOOC, but normal players do, as it could be admins talking important stuff to them
|
||||
if(M.client && M.client.holder && !M.client.holder.deadmined && M.client.prefs.chat_toggles & CHAT_OOC)
|
||||
listeners[M.client] = SOOC_LISTEN_ADMIN
|
||||
else
|
||||
if(M.mind)
|
||||
var/datum/mind/MIND = M.mind
|
||||
if(job_lookup[MIND.assigned_role])
|
||||
listeners[M.client] = SOOC_LISTEN_PLAYER
|
||||
|
||||
for(var/c in listeners)
|
||||
var/client/C = c
|
||||
var/mode = listeners[c]
|
||||
var/color = (!anon && CONFIG_GET(flag/allow_admin_ooccolor) && C.prefs.ooccolor) ? C.prefs.ooccolor : GLOB.SOOC_COLOR
|
||||
var/name = (mode == SOOC_LISTEN_ADMIN && anon) ? "([key])[keyname]" : keyname
|
||||
to_chat(C, "<font color='[color]'><b><span class='prefix'>SOOC:</span> <EM>[name]:</EM> <span class='message linkify'>[msg]</span></b></font>")
|
||||
|
||||
#undef SOOC_LISTEN_PLAYER
|
||||
#undef SOOC_LISTEN_ADMIN
|
||||
|
||||
/proc/toggle_sooc(toggle = null)
|
||||
if(toggle != null) //if we're specifically en/disabling sooc
|
||||
if(toggle != GLOB.sooc_allowed)
|
||||
GLOB.sooc_allowed = toggle
|
||||
else
|
||||
return
|
||||
else //otherwise just toggle it
|
||||
GLOB.sooc_allowed = !GLOB.sooc_allowed
|
||||
var/list/listeners = list()
|
||||
for(var/mind in get_antag_minds(/datum/antagonist))
|
||||
var/datum/mind/M = mind
|
||||
if(!M.current || !M.current.client || isnewplayer(M.current))
|
||||
continue
|
||||
listeners[M.current.client] = TRUE
|
||||
|
||||
for(var/m in GLOB.player_list)
|
||||
var/mob/M = m
|
||||
if(M.client && M.client.holder && !M.client.holder.deadmined)
|
||||
listeners[M.client] = TRUE
|
||||
for(var/c in listeners)
|
||||
var/client/C = c
|
||||
to_chat(C, "<B>The SOOC channel has been globally [GLOB.sooc_allowed ? "enabled" : "disabled"].</B>")
|
||||
|
||||
/datum/admins/proc/togglesooc()
|
||||
set category = "Server"
|
||||
set name="Toggle Security OOC"
|
||||
toggle_sooc()
|
||||
log_admin("[key_name(usr)] toggled Security OOC.")
|
||||
message_admins("[key_name_admin(usr)] toggled Security OOC.")
|
||||
SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Toggle Antag OOC", "[GLOB.sooc_allowed ? "Enabled" : "Disabled"]")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
Reference in New Issue
Block a user