Adds an End of Round Sound Toggle Preference (#49805)

* how about yee(naw)

* Fixes an issue with order in preferences.dm and adds a null check in ticker.dm

* updates the savefile max ver and adds a condition for it in update_preferences

* Puts the call sound(round_end_sound) outside of the loop into a variable that we insert the reference into the loop.
This commit is contained in:
KomradeSpectre
2020-03-14 12:34:04 +01:00
committed by GitHub
parent ef6e994891
commit 05b64182a9
5 changed files with 30 additions and 3 deletions
+4
View File
@@ -631,6 +631,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<br>"
dat += "<b>Play Admin MIDIs:</b> <a href='?_src_=prefs;preference=hear_midis'>[(toggles & SOUND_MIDI) ? "Enabled":"Disabled"]</a><br>"
dat += "<b>Play Lobby Music:</b> <a href='?_src_=prefs;preference=lobby_music'>[(toggles & SOUND_LOBBY) ? "Enabled":"Disabled"]</a><br>"
dat += "<b>Play End of Round Sounds:</b> <a href='?_src_=prefs;preference=endofround_sounds'>[(toggles & SOUND_ENDOFROUND) ? "Enabled":"Disabled"]</a><br>"
dat += "<b>See Pull Requests:</b> <a href='?_src_=prefs;preference=pull_requests'>[(chat_toggles & CHAT_PULLR) ? "Enabled":"Disabled"]</a><br>"
dat += "<br>"
@@ -1638,6 +1639,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
else
user.stop_sound_channel(CHANNEL_LOBBYMUSIC)
if("endofround_sounds")
toggles ^= SOUND_ENDOFROUND
if("ghost_ears")
chat_toggles ^= CHAT_GHOSTEARS
+4 -1
View File
@@ -5,7 +5,7 @@
// You do not need to raise this if you are adding new values that have sane defaults.
// Only raise this value when changing the meaning/format/name/layout of an existing value
// where you would want the updater procs below to run
#define SAVEFILE_VERSION_MAX 32
#define SAVEFILE_VERSION_MAX 33
/*
SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn
@@ -53,6 +53,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if(current_version < 32) //If you remove this, remove force_reset_keybindings() too.
addtimer(CALLBACK(src, .proc/force_reset_keybindings), 30) //No mob available when this is run, timer allows user choice.
if(current_version < 33)
toggles |= SOUND_ENDOFROUND
/datum/preferences/proc/update_character(current_version, savefile/S)
if(current_version < 19)
pda_style = "mono"
@@ -144,6 +144,21 @@ TOGGLE_CHECKBOX(/datum/verbs/menu/Settings/Sound, toggletitlemusic)()
return C.prefs.toggles & SOUND_LOBBY
TOGGLE_CHECKBOX(/datum/verbs/menu/Settings/Sound, toggleendofroundsounds)()
set name = "Hear/Silence End of Round Sounds"
set category = "Preferences"
set desc = "Hear Round End Sounds"
usr.client.prefs.toggles ^= SOUND_ENDOFROUND
usr.client.prefs.save_preferences()
if(usr.client.prefs.toggles & SOUND_ENDOFROUND)
to_chat(usr, "You will now hear sounds played before the server restarts.")
else
to_chat(usr, "You will no longer hear sounds played before the server restarts.")
SSblackbox.record_feedback("nested tally", "preferences_verb", 1, list("Toggle End of Round Sounds", "[usr.client.prefs.toggles & SOUND_ENDOFROUND ? "Enabled" : "Disabled"]"))
/datum/verbs/menu/Settings/Sound/toggleendofroundsounds/Get_checked(client/C)
return C.prefs.toggles & SOUND_ENDOFROUND
TOGGLE_CHECKBOX(/datum/verbs/menu/Settings/Sound, togglemidis)()
set name = "Hear/Silence Midis"
set category = "Preferences"