From a00a03684101519afc840f1c7f1a9ba20df07be9 Mon Sep 17 00:00:00 2001 From: Paul <90473506+pwbokie@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:50:40 -0400 Subject: [PATCH] add option to disable end of round sound (#26014) * add option to disable end of round sound * fix sleep position * add EOR sound to enable/disable preferences * invert logic so that existing players don't mute the sound * fix inconsistent mute/hear variable --------- Co-authored-by: pwbokie --- code/__DEFINES/preferences_defines.dm | 1 + code/controllers/subsystem/SSticker.dm | 8 ++++++-- code/modules/client/preference/link_processing.dm | 3 +++ code/modules/client/preference/preferences.dm | 1 + code/modules/client/preference/preferences_toggles.dm | 10 ++++++++++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/preferences_defines.dm b/code/__DEFINES/preferences_defines.dm index a661810bb2b..c4f3905028a 100644 --- a/code/__DEFINES/preferences_defines.dm +++ b/code/__DEFINES/preferences_defines.dm @@ -10,6 +10,7 @@ #define SOUND_DISCO (1<<8) #define SOUND_AI_VOICE (1<<9) #define SOUND_PRAYERNOTIFY (1<<10) +#define SOUND_MUTE_END_OF_ROUND (1<<11) #define SOUND_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|SOUND_HEARTBEAT|SOUND_BUZZ|SOUND_INSTRUMENTS|SOUND_MENTORHELP|SOUND_DISCO|SOUND_AI_VOICE|SOUND_PRAYERNOTIFY) diff --git a/code/controllers/subsystem/SSticker.dm b/code/controllers/subsystem/SSticker.dm index 9defe679128..ddf2ed88db9 100644 --- a/code/controllers/subsystem/SSticker.dm +++ b/code/controllers/subsystem/SSticker.dm @@ -744,10 +744,14 @@ SUBSYSTEM_DEF(ticker) if(end_string) end_state = end_string - // Play a haha funny noise + // Play a haha funny noise for those who want to hear it :) var/round_end_sound = pick(GLOB.round_end_sounds) var/sound_length = GLOB.round_end_sounds[round_end_sound] - SEND_SOUND(world, sound(round_end_sound)) + + for(var/mob/M in GLOB.player_list) + if(!(M.client.prefs.sound & SOUND_MUTE_END_OF_ROUND)) + SEND_SOUND(M, round_end_sound) + sleep(sound_length) world.Reboot() diff --git a/code/modules/client/preference/link_processing.dm b/code/modules/client/preference/link_processing.dm index 3352420aea7..b6aaaaabea8 100644 --- a/code/modules/client/preference/link_processing.dm +++ b/code/modules/client/preference/link_processing.dm @@ -1053,6 +1053,9 @@ if("hear_midis") sound ^= SOUND_MIDI + if("mute_end_of_round") + sound ^= SOUND_MUTE_END_OF_ROUND + if("lobby_music") sound ^= SOUND_LOBBY if((sound & SOUND_LOBBY) && user.client) diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index ec9f22d5f3b..2191f4a34f4 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -440,6 +440,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts dat += "TGUI strip menu size: [toggles2 & PREFTOGGLE_2_BIG_STRIP_MENU ? "Full-size" : "Miniature"]
" dat += "Play Admin MIDIs: [(sound & SOUND_MIDI) ? "Yes" : "No"]
" dat += "Play Lobby Music: [(sound & SOUND_LOBBY) ? "Yes" : "No"]
" + dat += "Mute End Of Round Sounds: [(sound & SOUND_MUTE_END_OF_ROUND) ? "Yes" : "No"]
" dat += "Randomized Character Slot: [toggles2 & PREFTOGGLE_2_RANDOMSLOT ? "Yes" : "No"]
" dat += "View Range: [viewrange]
" dat += "Window Flashing: [(toggles2 & PREFTOGGLE_2_WINDOWFLASHING) ? "Yes" : "No"]
" diff --git a/code/modules/client/preference/preferences_toggles.dm b/code/modules/client/preference/preferences_toggles.dm index 5ffbc2f7cb0..fff8a914023 100644 --- a/code/modules/client/preference/preferences_toggles.dm +++ b/code/modules/client/preference/preferences_toggles.dm @@ -172,6 +172,16 @@ if(user.prefs.sound & ~SOUND_LOBBY) usr.stop_sound_channel(CHANNEL_ADMIN) +/datum/preference_toggle/toggle_end_of_round_sound + name = "Toggle Mute End of Round Sound" + description = "Toggles muting the end of round sound" + preftoggle_bitflag = SOUND_MUTE_END_OF_ROUND + preftoggle_toggle = PREFTOGGLE_SOUND + preftoggle_category = PREFTOGGLE_CATEGORY_GENERAL + enable_message = "You have muted the end of round sound." + disable_message = "You have unmuted the end of round sound." + blackbox_message = "Toggle End of Round Sound" + /datum/preference_toggle/toggle_ooc name = "Toggle OOC chat" description = "Toggles seeing OutOfCharacter chat"