From 1907104d6f04a0ba57a0258e83c04aa4befc7bd7 Mon Sep 17 00:00:00 2001 From: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Date: Sat, 1 Mar 2025 07:53:15 -0600 Subject: [PATCH] Fix April Fools and Roundend title music (#89741) ## About The Pull Request 1. April Fools set the lobby music, but order of operations says holidays might be initialized before ticker. So we need to ensure it won't get overridden. 2. Lobby music pref was changed from a toggle to a number, but the proc already passed the number as an argument, so the arg did nothing. Now it'll (properly) play at half volume during end-of-round. 3. When using default repo lobby music, it will not play the same music after two rounds (as it does with configured lobby music) ## Changelog :cl: Melbert fix: Roundend title music will play at half volume again fix: April Fools lobby music will correctly always be clown music fix: Lobby Music will repeat across sequential rounds less often /:cl: --- code/__HELPERS/roundend.dm | 2 +- code/controllers/subsystem/ticker.dm | 17 +++++++++++++---- code/game/sound.dm | 8 ++++---- code/modules/holiday/holidays.dm | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/code/__HELPERS/roundend.dm b/code/__HELPERS/roundend.dm index 876e350e09d..97fbbb6dffb 100644 --- a/code/__HELPERS/roundend.dm +++ b/code/__HELPERS/roundend.dm @@ -224,7 +224,7 @@ GLOBAL_LIST_INIT(achievements_unlocked, list()) for(var/client/C in GLOB.clients) if(!C?.credits) C?.RollCredits() - C?.playtitlemusic(40) + C?.playtitlemusic(volume_multiplier = 0.5) if(speed_round && was_forced != ADMIN_FORCE_END_ROUND) C?.give_award(/datum/award/achievement/misc/speed_round, C?.mob) HandleRandomHardcoreScore(C) diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 7cb00f381f1..1f05fdb2fca 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -112,7 +112,7 @@ SUBSYSTEM_DEF(ticker) music += S var/old_login_music = trim(file2text("data/last_round_lobby_music.txt")) - if(music.len > 1) + if(length(music) > 1) music -= old_login_music for(var/S in music) @@ -125,10 +125,11 @@ SUBSYSTEM_DEF(ticker) if(!length(music)) music = world.file2list(ROUND_START_MUSIC_LIST, "\n") - login_music = pick(music) + if(length(music) > 1) + music -= old_login_music + set_lobby_music(pick(music)) else - login_music = "[global.config.directory]/title_music/sounds/[pick(music)]" - + set_lobby_music("[global.config.directory]/title_music/sounds/[pick(music)]") if(!GLOB.syndicate_code_phrase) GLOB.syndicate_code_phrase = generate_code_phrase(return_list=TRUE) @@ -793,5 +794,13 @@ SUBSYSTEM_DEF(ticker) if(possible_themes.len) return "[global.config.directory]/reboot_themes/[pick(possible_themes)]" +/// Updates the lobby music +/// Does not update if override is FALSE and login_music is already set +/datum/controller/subsystem/ticker/proc/set_lobby_music(new_music, override = FALSE) + if(!override && login_music) + return + + login_music = new_music + #undef ROUND_START_MUSIC_LIST #undef SS_TICKER_TRAIT diff --git a/code/game/sound.dm b/code/game/sound.dm index 2ffb94e7115..c87a10011a0 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -202,13 +202,13 @@ S.status = SOUND_UPDATE SEND_SOUND(src, S) -/client/proc/playtitlemusic(vol = 85) +/client/proc/playtitlemusic(volume_multiplier = 1) set waitfor = FALSE UNTIL(SSticker.login_music) //wait for SSticker init to set the login music - var/volume_modifier = prefs.read_preference(/datum/preference/numeric/volume/sound_lobby_volume) - if((prefs && volume_modifier) && !CONFIG_GET(flag/disallow_title_music)) - SEND_SOUND(src, sound(SSticker.login_music, repeat = 0, wait = 0, volume = volume_modifier, channel = CHANNEL_LOBBYMUSIC)) // MAD JAMS + var/music_volume = prefs.read_preference(/datum/preference/numeric/volume/sound_lobby_volume) * volume_multiplier + if((prefs && music_volume) && !CONFIG_GET(flag/disallow_title_music)) + SEND_SOUND(src, sound(SSticker.login_music, repeat = 0, wait = 0, volume = music_volume, channel = CHANNEL_LOBBYMUSIC)) // MAD JAMS ///get a random frequency. /proc/get_rand_frequency() diff --git a/code/modules/holiday/holidays.dm b/code/modules/holiday/holidays.dm index 3138fff9032..68ce6651450 100644 --- a/code/modules/holiday/holidays.dm +++ b/code/modules/holiday/holidays.dm @@ -257,7 +257,7 @@ /datum/holiday/april_fools/celebrate() . = ..() SSjob.set_overflow_role(/datum/job/clown) - SSticker.login_music = 'sound/music/lobby_music/clown.ogg' + SSticker.set_lobby_music('sound/music/lobby_music/clown.ogg', override = TRUE) for(var/i in GLOB.new_player_list) var/mob/dead/new_player/P = i if(P.client)