mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-12 15:45:25 +01:00
Allows you to mute soundfiles from specific admins (#20576)
* Allows you to mute soundfiles from specific admins * me no spello * Wording tweak
This commit is contained in:
@@ -126,6 +126,8 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
|
||||
var/list/keybindings_overrides = null
|
||||
/// Player's region override for routing optimisation
|
||||
var/server_region = null
|
||||
/// List of admin ckeys this player wont hear sounds from
|
||||
var/list/admin_sound_ckey_ignore = list()
|
||||
|
||||
/datum/preferences/New(client/C, datum/db_query/Q) // Process our query
|
||||
parent = C
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// Check ../login_processing/10-load_preferences.dm
|
||||
|
||||
//general preferences
|
||||
var/raw_muted_admins
|
||||
while(query.NextRow())
|
||||
ooccolor = query.item[1]
|
||||
UI_style = query.item[2]
|
||||
@@ -27,6 +28,7 @@
|
||||
colourblind_mode = query.item[21]
|
||||
keybindings = init_keybindings(raw = query.item[22])
|
||||
server_region = query.item[23]
|
||||
raw_muted_admins = query.item[24]
|
||||
|
||||
lastchangelog_2 = lastchangelog // Clone please
|
||||
|
||||
@@ -50,6 +52,12 @@
|
||||
ghost_darkness_level = sanitize_integer(ghost_darkness_level, 0, 255, initial(ghost_darkness_level))
|
||||
colourblind_mode = sanitize_inlist(colourblind_mode, list(COLOURBLIND_MODE_NONE, COLOURBLIND_MODE_DEUTER, COLOURBLIND_MODE_PROT, COLOURBLIND_MODE_TRIT), COLOURBLIND_MODE_NONE)
|
||||
|
||||
if(length(raw_muted_admins))
|
||||
try
|
||||
admin_sound_ckey_ignore = json_decode(raw_muted_admins)
|
||||
catch
|
||||
admin_sound_ckey_ignore = list() // Invalid JSON, handle safely please
|
||||
|
||||
// Sanitize the region
|
||||
if(!(server_region in GLOB.configuration.system.region_map))
|
||||
server_region = null // This region doesnt exist anymore
|
||||
@@ -89,7 +97,8 @@
|
||||
ghost_darkness_level=:ghost_darkness_level,
|
||||
colourblind_mode=:colourblind_mode,
|
||||
keybindings=:keybindings,
|
||||
server_region=:server_region
|
||||
server_region=:server_region,
|
||||
muted_adminsounds_ckeys=:muted_adminsounds_ckeys
|
||||
WHERE ckey=:ckey"}, list(
|
||||
// OH GOD THE PARAMETERS
|
||||
"ooccolour" = ooccolor,
|
||||
@@ -115,6 +124,7 @@
|
||||
"keybindings" = json_encode(keybindings_overrides),
|
||||
"ckey" = C.ckey,
|
||||
"server_region" = server_region,
|
||||
"muted_adminsounds_ckeys" = json_encode(admin_sound_ckey_ignore),
|
||||
))
|
||||
|
||||
if(!query.warn_execute())
|
||||
|
||||
@@ -373,3 +373,20 @@
|
||||
prefs.toggles2 ^= PREFTOGGLE_2_DANCE_DISCO
|
||||
prefs.save_preferences(src)
|
||||
to_chat(usr, "You will [(prefs.toggles2 & PREFTOGGLE_2_DANCE_DISCO) ? "now" : "no longer"] dance to the radiant dance machine.")
|
||||
|
||||
/client/verb/manage_adminsound_mutes()
|
||||
set name = "Manage Admin Sound Mutes"
|
||||
set category = "Preferences"
|
||||
set desc = "Manage admins that you wont hear played audio from"
|
||||
|
||||
if(!length(prefs.admin_sound_ckey_ignore))
|
||||
to_chat(usr, "You have no admins with muted sounds.")
|
||||
return
|
||||
|
||||
var/choice = input(usr, "Select an admin to unmute sounds from.", "Pick an admin") as null|anything in prefs.admin_sound_ckey_ignore
|
||||
if(!choice)
|
||||
return
|
||||
|
||||
prefs.admin_sound_ckey_ignore -= choice
|
||||
to_chat(usr, "You will now hear sounds from <code>[choice]</code> again.")
|
||||
prefs.save_preferences(src)
|
||||
|
||||
Reference in New Issue
Block a user