From d09af9ce28fa128af8df9c376df7ce730c1c4027 Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Sat, 14 May 2016 12:47:00 -0700 Subject: [PATCH] Map changing will now delay round end until it finishes --- code/world.dm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/code/world.dm b/code/world.dm index 478b3790af7..9f2eefed96d 100644 --- a/code/world.dm +++ b/code/world.dm @@ -178,6 +178,14 @@ var/last_irc_status = 0 if(ticker.delay_end) world << "Reboot was cancelled by an admin." return + if(mapchanging) + world << "Map change operation detected, delaying reboot." + rebootingpendingmapchange = 1 + spawn(1200) + if(mapchanging) + mapchanging = 0 //map rotation can in some cases be finished but never exit, this is a failsafe + Reboot("Map change timed out", time = 10) + return feedback_set_details("[feedback_c]","[feedback_r]") log_game("Rebooting World. [reason]") kick_clients_in_lobby("The round came to an end with you in the lobby.", 1) //second parameter ensures only afk clients are kicked @@ -386,17 +394,19 @@ var/failed_db_connections = 0 world << "Map rotation has chosen [VM.friendlyname] for next round!" var/datum/votablemap/nextmap - +var/mapchanging = 0 +var/rebootingpendingmapchange = 0 /proc/changemap(var/datum/votablemap/VM) if (!SERVERTOOLS) return if (!istype(VM)) return - + mapchanging = 1 log_game("Changing map to [VM.name]([VM.friendlyname])") var/file = file("setnewmap.bat") file << "\nset MAPROTATE=[VM.name]\n" . = shell("..\\bin\\maprotate.bat") + mapchanging = 0 switch (.) if (null) message_admins("Failed to change map: Could not run map rotator") @@ -426,3 +436,5 @@ var/datum/votablemap/nextmap else message_admins("Failed to change map: Unknown error: Error code #[.]") log_game("Failed to change map: Unknown error: Error code #[.]") + if(rebootingpendingmapchange) + world.Reboot("Map change finished", time = 10)