mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +00:00
Add system to let the restart script know when a round ends so it doesn't kill the round.
This commit is contained in:
@@ -842,6 +842,7 @@
|
||||
#include "code\modules\events\wallrot.dm"
|
||||
#include "code\modules\ext_scripts\irc.dm"
|
||||
#include "code\modules\ext_scripts\python.dm"
|
||||
#include "code\modules\ext_scripts\watchdog.dm"
|
||||
#include "code\modules\flufftext\Dreaming.dm"
|
||||
#include "code\modules\flufftext\Hallucination.dm"
|
||||
#include "code\modules\flufftext\TextFilters.dm"
|
||||
|
||||
@@ -302,7 +302,13 @@ var/global/datum/controller/gameticker/ticker
|
||||
|
||||
emergency_shuttle.process()
|
||||
|
||||
var/mode_finished = mode.check_finished() || (emergency_shuttle.location == 2 && emergency_shuttle.alert == 1)
|
||||
var/force_round_end=0
|
||||
|
||||
// If server's empty, force round end.
|
||||
if(watchdog.waiting && player_list.len == 0)
|
||||
force_round_end=1
|
||||
|
||||
var/mode_finished = mode.check_finished() || (emergency_shuttle.location == 2 && emergency_shuttle.alert == 1) || force_round_end
|
||||
if(!mode.explosion_in_progress && mode_finished)
|
||||
current_state = GAME_STATE_FINISHED
|
||||
|
||||
@@ -312,18 +318,20 @@ var/global/datum/controller/gameticker/ticker
|
||||
spawn(50)
|
||||
if (mode.station_was_nuked)
|
||||
feedback_set_details("end_proper","nuke")
|
||||
if(!delay_end)
|
||||
if(!delay_end && !watchdog.waiting)
|
||||
world << "\blue <B>Rebooting due to destruction of station in [restart_timeout/10] seconds</B>"
|
||||
else
|
||||
feedback_set_details("end_proper","proper completion")
|
||||
if(!delay_end)
|
||||
if(!delay_end && !watchdog.waiting)
|
||||
world << "\blue <B>Restarting in [restart_timeout/10] seconds</B>"
|
||||
|
||||
|
||||
if(blackbox)
|
||||
blackbox.save_all_data_to_sql()
|
||||
|
||||
if(!delay_end)
|
||||
if (watchdog.waiting)
|
||||
world << "\blue <B>Server will shut down for an automatic update in a few seconds.</B>"
|
||||
watchdog.signal_ready()
|
||||
else if(!delay_end)
|
||||
sleep(restart_timeout)
|
||||
if(!delay_end)
|
||||
world.Reboot()
|
||||
|
||||
@@ -47,6 +47,10 @@
|
||||
|
||||
if(blackbox)
|
||||
blackbox.save_all_data_to_sql()
|
||||
if (watchdog.waiting)
|
||||
world << "\blue <B>Server will shut down for an automatic update in a few seconds.</B>"
|
||||
watchdog.signal_ready()
|
||||
return
|
||||
sleep(50)
|
||||
world.Reboot()
|
||||
return
|
||||
|
||||
@@ -306,6 +306,11 @@ var/bomb_set
|
||||
|
||||
if(blackbox)
|
||||
blackbox.save_all_data_to_sql()
|
||||
|
||||
if (watchdog.waiting)
|
||||
world << "\blue <B>Server will shut down for an automatic update in a few seconds.</B>"
|
||||
watchdog.signal_ready()
|
||||
return
|
||||
sleep(300)
|
||||
log_game("Rebooting due to nuclear detonation")
|
||||
world.Reboot()
|
||||
|
||||
@@ -685,6 +685,11 @@ var/global/floorIsLava = 0
|
||||
if(blackbox)
|
||||
blackbox.save_all_data_to_sql()
|
||||
|
||||
if (watchdog.waiting)
|
||||
world << "\blue <B>Server will shut down for an automatic update in a few seconds.</B>"
|
||||
watchdog.signal_ready()
|
||||
return
|
||||
|
||||
sleep(50)
|
||||
world.Reboot()
|
||||
|
||||
@@ -871,6 +876,11 @@ var/global/floorIsLava = 0
|
||||
if(blackbox)
|
||||
blackbox.save_all_data_to_sql()
|
||||
|
||||
if (watchdog.waiting)
|
||||
world << "\blue <B>Server will shut down for an automatic update in a few seconds.</B>"
|
||||
watchdog.signal_ready()
|
||||
return
|
||||
|
||||
world.Reboot()
|
||||
|
||||
/datum/admins/proc/unprison(var/mob/M in mob_list)
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
|
||||
var/command = config.python_path + " " + script + " " + args
|
||||
|
||||
return shell(command)
|
||||
return shell(command)
|
||||
17
code/modules/ext_scripts/watchdog.dm
Normal file
17
code/modules/ext_scripts/watchdog.dm
Normal file
@@ -0,0 +1,17 @@
|
||||
var/global/datum/watchdog/watchdog = new
|
||||
|
||||
/datum/watchdog
|
||||
var/waiting=0 // Waiting for the server to end round or empty.
|
||||
var/const/update_signal_file="data/UPDATE_READY.txt"
|
||||
var/const/server_signal_file="data/SERVER_READY.txt"
|
||||
|
||||
/datum/watchdog/proc/check_for_update()
|
||||
if(waiting)
|
||||
return
|
||||
if(fexists(update_signal_file) == 1)
|
||||
waiting=1
|
||||
|
||||
/datum/watchdog/proc/signal_ready()
|
||||
var/signal = file(server_signal_file)
|
||||
fdel(signal)
|
||||
signal << "READY"
|
||||
Reference in New Issue
Block a user