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.
This commit is contained in:
Krausus
2017-02-17 12:33:45 -05:00
parent a4ab111354
commit 366361b7d7
2 changed files with 17 additions and 5 deletions
+9 -1
View File
@@ -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()
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
)
+8 -4
View File
@@ -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, "<span class='boldannounce'>An admin has delayed the round end.</span>")
return
to_chat(world, "<span class='boldannounce'>Rebooting world in [delay/10] [delay > 10 ? "seconds" : "second"]. [reason]</span>")
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("<span class='boldannounce'>Rebooting world. [reason]</span>")
//kick_clients_in_lobby("<span class='boldannounce'>The round came to an end with you in the lobby.</span>", 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)