From 82d13f079c430f4af8b3b5ac8e9c40cfa218d097 Mon Sep 17 00:00:00 2001 From: ShizCalev Date: Wed, 24 Oct 2018 18:43:30 -0400 Subject: [PATCH] Admin prefs stuff (#41041) fixes #41106 since it'll have it's own fucking location. cl ShizCalev add: Admins can now personalize their asay message color on servers with the feature enabled. tweak: Moved some admin only preference verbs out of the Preferences tab and to a new admin preferences tab to help unclutter it / prevent accidental toggling of fun things. /cl Note that the start of the admin message will still use the default formatting just so it can be quickly recognized as an admin message and not an OOC one. --- .../configuration/entries/general.dm | 2 + code/modules/admin/admin_verbs.dm | 3 + code/modules/admin/verbs/adminsay.dm | 4 +- code/modules/client/preferences.dm | 20 +++++- code/modules/client/preferences_savefile.dm | 3 + code/modules/client/preferences_toggles.dm | 68 +++++++++++++------ code/modules/client/verbs/etips.dm | 4 +- config/config.txt | 3 + 8 files changed, 82 insertions(+), 25 deletions(-) diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 6b27c54d8836..1618f0e26e6b 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -63,6 +63,8 @@ /datum/config_entry/flag/allow_admin_ooccolor // Allows admins with relevant permissions to have their own ooc colour +/datum/config_entry/flag/allow_admin_asaycolor //Allows admins with relevant permissions to have a personalized asay color + /datum/config_entry/flag/allow_vote_restart // allow votes to restart /datum/config_entry/flag/allow_vote_mode // allow votes to change mode diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 74a89373b8b3..429c5b5ca7c4 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -71,6 +71,9 @@ GLOBAL_LIST_INIT(admin_verbs_admin, world.AVerbsAdmin()) /client/proc/open_shuttle_manipulator, /* Opens shuttle manipulator UI */ /client/proc/deadchat, /client/proc/toggleprayers, + /client/proc/toggle_prayer_sound, + /client/proc/colorasay, + /client/proc/resetasaycolor, /client/proc/toggleadminhelpsound, /client/proc/respawn_character, /datum/admins/proc/open_borgopanel, diff --git a/code/modules/admin/verbs/adminsay.dm b/code/modules/admin/verbs/adminsay.dm index 997863767bb8..90b078a9f547 100644 --- a/code/modules/admin/verbs/adminsay.dm +++ b/code/modules/admin/verbs/adminsay.dm @@ -11,9 +11,9 @@ return mob.log_talk(msg, LOG_ASAY) - msg = keywords_lookup(msg) - msg = "ADMIN: [key_name(usr, 1)] [ADMIN_FLW(mob)]: [msg]" + var/custom_asay_color = (CONFIG_GET(flag/allow_admin_asaycolor) && prefs.asaycolor) ? "" : null + msg = "ADMIN: [key_name(usr, 1)] [ADMIN_FLW(mob)]: [custom_asay_color][msg][custom_asay_color ? "":null]" to_chat(GLOB.admins, msg) SSblackbox.record_feedback("tally", "admin_verb", 1, "Asay") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 44d97d61bfbb..23c17fd2f5cd 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -19,6 +19,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) //game-preferences var/lastchangelog = "" //Saved changlog filesize to detect if there was a change var/ooccolor = null + var/asaycolor = null var/enable_tips = TRUE var/tip_delay = 500 //tip delay in milliseconds @@ -598,11 +599,17 @@ GLOBAL_LIST_EMPTY(preferences_datums) dat += "

Admin Settings

" dat += "Adminhelp Sounds: [(toggles & SOUND_ADMINHELP)?"Enabled":"Disabled"]
" + dat += "Prayer Sounds: [(toggles & SOUND_PRAYERS)?"Enabled":"Disabled"]
" dat += "Announce Login: [(toggles & ANNOUNCE_LOGIN)?"Enabled":"Disabled"]
" dat += "
" dat += "Combo HUD Lighting: [(toggles & COMBOHUD_LIGHTING)?"Full-bright":"No Change"]
" dat += "
" - dat += "Silence Radio Messages: [(chat_toggles & CHAT_RADIO)?"Disabled":"Enabled"]
" + dat += "Hide Dead Chat: [(chat_toggles & CHAT_DEAD)?"Shown":"Hidden"]
" + dat += "Hide Radio Messages: [(chat_toggles & CHAT_RADIO)?"Shown":"Hidden"]
" + dat += "Hide Prayers: [(chat_toggles & CHAT_PRAYER)?"Shown":"Hidden"]
" + if(CONFIG_GET(flag/allow_admin_asaycolor)) + dat += "
" + dat += "ASAY Color:     Change
" dat += "" dat += "" // yogs start - Donor features @@ -1438,6 +1445,11 @@ GLOBAL_LIST_EMPTY(preferences_datums) if(new_ooccolor) ooccolor = new_ooccolor + if("asaycolor") + var/new_asaycolor = input(user, "Choose your ASAY color:", "Game Preference",asaycolor) as color|null + if(new_asaycolor) + asaycolor = new_asaycolor + if("bag") var/new_backbag = input(user, "Choose your character's style of bag:", "Character Preference") as null|anything in GLOB.backbaglist if(new_backbag) @@ -1533,12 +1545,18 @@ GLOBAL_LIST_EMPTY(preferences_datums) //here lies the badmins if("hear_adminhelps") user.client.toggleadminhelpsound() + if("hear_prayers") + user.client.toggle_prayer_sound() if("announce_login") user.client.toggleannouncelogin() if("combohud_lighting") toggles ^= COMBOHUD_LIGHTING + if("toggle_dead_chat") + user.client.deadchat() if("toggle_radio_chatter") user.client.toggle_hear_radio() + if("toggle_prayers") + user.client.toggleprayers() if("be_special") var/be_special_type = href_list["be_special_type"] diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 615181c8aa51..400374de93bc 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -71,6 +71,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car return 0 //general preferences + S["asaycolor"] >> asaycolor S["ooccolor"] >> ooccolor S["lastchangelog"] >> lastchangelog S["UI_style"] >> UI_style @@ -116,6 +117,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car update_preferences(needs_update, S) //needs_update = savefile_version if we need an update (positive integer) //Sanitize + asaycolor = sanitize_ooccolor(sanitize_hexcolor(asaycolor, 6, 1, initial(asaycolor))) ooccolor = sanitize_ooccolor(sanitize_hexcolor(ooccolor, 6, 1, initial(ooccolor))) lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog)) UI_style = sanitize_inlist(UI_style, GLOB.available_ui_styles, GLOB.available_ui_styles[1]) @@ -161,6 +163,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car WRITE_FILE(S["version"] , SAVEFILE_VERSION_MAX) //updates (or failing that the sanity checks) will ensure data is not invalid at load. Assume up-to-date //general preferences + WRITE_FILE(S["asaycolor"], asaycolor) WRITE_FILE(S["ooccolor"], ooccolor) WRITE_FILE(S["lastchangelog"], lastchangelog) WRITE_FILE(S["UI_style"], UI_style) diff --git a/code/modules/client/preferences_toggles.dm b/code/modules/client/preferences_toggles.dm index d5643a61fe52..3b717a329b2b 100644 --- a/code/modules/client/preferences_toggles.dm +++ b/code/modules/client/preferences_toggles.dm @@ -213,21 +213,6 @@ TOGGLE_CHECKBOX(/datum/verbs/menu/Settings/Sound, toggle_announcement_sound)() return C.prefs.toggles & SOUND_ANNOUNCEMENTS -TOGGLE_CHECKBOX(/datum/verbs/menu/Settings/Sound, toggleprayersounds)() - set name = "Hear/Silence Prayer Sounds" - set category = "Preferences" - set desc = "Hear Prayer Sounds" - usr.client.prefs.toggles ^= SOUND_PRAYERS - usr.client.prefs.save_preferences() - if(usr.client.prefs.toggles & SOUND_PRAYERS) - to_chat(usr, "You will now hear prayer sounds.") - else - to_chat(usr, "You will no longer prayer sounds.") - SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Toggle Prayer Sounds", "[usr.client.prefs.toggles & SOUND_PRAYERS ? "Enabled" : "Disabled"]")) -/datum/verbs/menu/Settings/Sound/toggleprayersounds/Get_checked(client/C) - return C.prefs.toggles & SOUND_PRAYERS - - /datum/verbs/menu/Settings/Sound/verb/stop_client_sounds() set name = "Stop Sounds" set category = "Preferences" @@ -367,7 +352,7 @@ GLOBAL_LIST_INIT(ghost_orbits, list(GHOST_ORBIT_CIRCLE,GHOST_ORBIT_TRIANGLE,GHOS //Admin Preferences /client/proc/toggleadminhelpsound() set name = "Hear/Silence Adminhelps" - set category = "Preferences" + set category = "Prefs - Admin" set desc = "Toggle hearing a notification when admin PMs are received" if(!holder) return @@ -378,7 +363,7 @@ GLOBAL_LIST_INIT(ghost_orbits, list(GHOST_ORBIT_CIRCLE,GHOST_ORBIT_TRIANGLE,GHOS /client/proc/toggleannouncelogin() set name = "Do/Don't Announce Login" - set category = "Preferences" + set category = "Prefs - Admin" set desc = "Toggle if you want an announcement to admins when you login during a round" if(!holder) return @@ -389,7 +374,7 @@ GLOBAL_LIST_INIT(ghost_orbits, list(GHOST_ORBIT_CIRCLE,GHOST_ORBIT_TRIANGLE,GHOS /client/proc/toggle_hear_radio() set name = "Show/Hide Radio Chatter" - set category = "Preferences" + set category = "Prefs - Admin" set desc = "Toggle seeing radiochatter from nearby radios and speakers" if(!holder) return @@ -400,8 +385,10 @@ GLOBAL_LIST_INIT(ghost_orbits, list(GHOST_ORBIT_CIRCLE,GHOST_ORBIT_TRIANGLE,GHOS /client/proc/deadchat() set name = "Show/Hide Deadchat" - set category = "Preferences" + set category = "Prefs - Admin" set desc ="Toggles seeing deadchat" + if(!holder) + return prefs.chat_toggles ^= CHAT_DEAD prefs.save_preferences() to_chat(src, "You will [(prefs.chat_toggles & CHAT_DEAD) ? "now" : "no longer"] see deadchat.") @@ -409,9 +396,50 @@ GLOBAL_LIST_INIT(ghost_orbits, list(GHOST_ORBIT_CIRCLE,GHOST_ORBIT_TRIANGLE,GHOS /client/proc/toggleprayers() set name = "Show/Hide Prayers" - set category = "Preferences" + set category = "Prefs - Admin" set desc = "Toggles seeing prayers" + if(!holder) + return prefs.chat_toggles ^= CHAT_PRAYER prefs.save_preferences() to_chat(src, "You will [(prefs.chat_toggles & CHAT_PRAYER) ? "now" : "no longer"] see prayerchat.") SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Toggle Prayer Visibility", "[prefs.chat_toggles & CHAT_PRAYER ? "Enabled" : "Disabled"]")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + +/client/proc/toggle_prayer_sound() + set name = "Hear/Silence Prayer Sounds" + set category = "Prefs - Admin" + set desc = "Hear Prayer Sounds" + if(!holder) + return + prefs.toggles ^= SOUND_PRAYERS + prefs.save_preferences() + to_chat(usr, "You will [(prefs.toggles & SOUND_PRAYERS) ? "now" : "no longer"] hear a sound when prayers arrive.") + SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Toggle Prayer Sounds", "[usr.client.prefs.toggles & SOUND_PRAYERS ? "Enabled" : "Disabled"]")) + +/client/proc/colorasay() + set name = "Set Admin Say Color" + set category = "Prefs - Admin" + set desc = "Set the color of your ASAY messages" + if(!holder) + return + if(!CONFIG_GET(flag/allow_admin_asaycolor)) + to_chat(src, "Custom Asay color is currently disabled by the server.") + return + var/new_asaycolor = input(src, "Please select your ASAY color.", "ASAY color", prefs.asaycolor) as color|null + if(new_asaycolor) + prefs.asaycolor = sanitize_ooccolor(new_asaycolor) + prefs.save_preferences() + SSblackbox.record_feedback("tally", "admin_verb", 1, "Set ASAY Color") + return + +/client/proc/resetasaycolor() + set name = "Reset your Admin Say Color" + set desc = "Returns your ASAY Color to default" + set category = "Prefs - Admin" + if(!holder) + return + if(!CONFIG_GET(flag/allow_admin_asaycolor)) + to_chat(src, "Custom Asay color is currently disabled by the server.") + return + prefs.asaycolor = initial(prefs.asaycolor) + prefs.save_preferences() diff --git a/code/modules/client/verbs/etips.dm b/code/modules/client/verbs/etips.dm index 326f693b0848..2455f5d01b07 100644 --- a/code/modules/client/verbs/etips.dm +++ b/code/modules/client/verbs/etips.dm @@ -1,5 +1,5 @@ /client/verb/toggle_tips() - set name = "Toggle examine tooltips" + set name = "Toggle Examine Tooltips" set desc = "Toggles examine hover-over tooltips" set category = "Preferences" @@ -8,7 +8,7 @@ to_chat(usr, "Examine tooltips [prefs.enable_tips ? "en" : "dis"]abled.") /client/verb/change_tip_delay() - set name = "Set examine tooltip delay" + set name = "Set Examine Tooltip Delay" set desc = "Sets the delay in milliseconds before examine tooltips appear" set category = "Preferences" diff --git a/config/config.txt b/config/config.txt index 1e31a1200422..f06f50a5c85c 100644 --- a/config/config.txt +++ b/config/config.txt @@ -155,6 +155,9 @@ PICTURE_LOGGING_CAMERA ## Comment this out to stop admins being able to choose their personal ooccolor ALLOW_ADMIN_OOCCOLOR +## Comment this out to stop admins being able to choose their personal asay color +ALLOW_ADMIN_ASAYCOLOR + ## Job slot open/close by identification consoles delay in seconds ID_CONSOLE_JOBSLOT_DELAY 30