From 366361b7d7ef5aa197f2966c9022f40aab6d2dea Mon Sep 17 00:00:00 2001 From: Krausus Date: Fri, 17 Feb 2017 12:33:45 -0500 Subject: [PATCH] Makes end-of-round sounds play before reboot Based on their length, they will now start playing early enough to finish playing right as the server reboots, so long as there's time to do so. --- code/_globalvars/lists/misc.dm | 10 +++++++++- code/world.dm | 12 ++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/code/_globalvars/lists/misc.dm b/code/_globalvars/lists/misc.dm index eb5c500573b..6c6a02b265f 100644 --- a/code/_globalvars/lists/misc.dm +++ b/code/_globalvars/lists/misc.dm @@ -20,4 +20,12 @@ var/list/restricted_camera_networks = list( //Those networks can only be accesse var/list/mineral_turfs = list() -var/list/ruin_landmarks = list() \ No newline at end of file +var/list/ruin_landmarks = list() + +var/list/round_end_sounds = list( // Maps available round end sounds to their duration + 'sound/AI/newroundsexy.ogg' = 2.3 SECONDS, + 'sound/misc/apcdestroyed.ogg' = 3 SECONDS, + 'sound/misc/bangindonk.ogg' = 1.6 SECONDS, + 'sound/goonstation/misc/newround1.ogg' = 6.9 SECONDS, + 'sound/goonstation/misc/newround2.ogg' = 14.8 SECONDS + ) diff --git a/code/world.dm b/code/world.dm index c98f2acc2e3..f37fd273e86 100644 --- a/code/world.dm +++ b/code/world.dm @@ -269,6 +269,7 @@ var/world_topic_spam_protect_time = world.timeofday return else return ..(1) + var/delay if(!isnull(time)) delay = max(0,time) @@ -278,6 +279,13 @@ var/world_topic_spam_protect_time = world.timeofday to_chat(world, "An admin has delayed the round end.") return to_chat(world, "Rebooting world in [delay/10] [delay > 10 ? "seconds" : "second"]. [reason]") + + var/round_end_sound = pick(round_end_sounds) + var/sound_length = round_end_sounds[round_end_sound] + if(delay > sound_length) // If there's time, play the round-end sound before rebooting + spawn(delay - sound_length) + if(!ticker.delay_end) + world << round_end_sound sleep(delay) if(blackbox) blackbox.save_all_data_to_sql() @@ -288,10 +296,6 @@ var/world_topic_spam_protect_time = world.timeofday log_game("Rebooting world. [reason]") //kick_clients_in_lobby("The round came to an end with you in the lobby.", 1) - spawn(0) - world << sound(pick('sound/AI/newroundsexy.ogg','sound/misc/apcdestroyed.ogg','sound/misc/bangindonk.ogg', 'sound/goonstation/misc/newround1.ogg', 'sound/goonstation/misc/newround2.ogg'))// random end sounds!! - LastyBatsy - - processScheduler.stop() if(config && config.shutdown_on_reboot)