diff --git a/code/_globalvars/configuration.dm b/code/_globalvars/configuration.dm index 3e2d7d995d6..2d9b9761523 100644 --- a/code/_globalvars/configuration.dm +++ b/code/_globalvars/configuration.dm @@ -19,6 +19,10 @@ var/shuttle_left = 0 var/tinted_weldhelh = 1 var/mouse_respawn_time = 5 //Amount of time that must pass between a player dying as a mouse and repawning as a mouse. In minutes. +// Command to run if shutting down (SHUTDOWN_ON_REBOOT) instead of rebooting +// It's defined here as a global because this is a hilariously bad thing to have on the easily-edited config datum +var/global/shutdown_shell_command + // Debug is used exactly once (in living.dm) but is commented out in a lot of places. It is not set anywhere and only checked. // Debug2 is used in conjunction with a lot of admin verbs and therefore is actually legit. var/Debug = 0 // global debug switch diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 251494d9f89..c593296c30f 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -189,6 +189,8 @@ var/disable_ooc_emoji = 0 // prevents people from using emoji in OOC + var/shutdown_on_reboot = 0 // Whether to shut down the world instead of rebooting it + /datum/configuration/New() var/list/L = subtypesof(/datum/game_mode) for(var/T in L) @@ -585,6 +587,12 @@ if("disable_ooc_emoji") config.disable_ooc_emoji = 1 + if("shutdown_on_reboot") + config.shutdown_on_reboot = 1 + + if("shutdown_shell_command") + shutdown_shell_command = value + else diary << "Unknown setting in configuration: '[name]'" diff --git a/code/world.dm b/code/world.dm index c33b41388f4..c98f2acc2e3 100644 --- a/code/world.dm +++ b/code/world.dm @@ -261,7 +261,14 @@ var/world_topic_spam_protect_time = world.timeofday log_admin("[key_name(usr)] has requested an immediate world restart via client side debugging tools") spawn(0) to_chat(world, "Rebooting world immediately due to host request") - return ..(1) + if(config && config.shutdown_on_reboot) + sleep(0) + if(shutdown_shell_command) + shell(shutdown_shell_command) + del(world) + return + else + return ..(1) var/delay if(!isnull(time)) delay = max(0,time) @@ -287,10 +294,17 @@ var/world_topic_spam_protect_time = world.timeofday processScheduler.stop() - for(var/client/C in clients) - if(config.server) //if you set a server location in config.txt, it sends you there instead of trying to reconnect to the same world address. -- NeoFite - C << link("byond://[config.server]") - ..(0) + if(config && config.shutdown_on_reboot) + sleep(0) + if(shutdown_shell_command) + shell(shutdown_shell_command) + del(world) + return + else + for(var/client/C in clients) + if(config.server) //if you set a server location in config.txt, it sends you there instead of trying to reconnect to the same world address. -- NeoFite + C << link("byond://[config.server]") + ..(0) #define INACTIVITY_KICK 6000 //10 minutes in ticks (approx.) /world/proc/KickInactiveClients() diff --git a/config/example/config.txt b/config/example/config.txt index 5bcd469be87..d2ef1cf5062 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -334,4 +334,10 @@ DISABLE_SPACE_RUINS #MEDAL_HUB_PASSWORD ## Uncomment this if you want to disable usage of emoji in OOC -#DISABLE_OOC_EMOJI \ No newline at end of file +#DISABLE_OOC_EMOJI + +## Uncomment this to shut down the world any time it would normally reboot +#SHUTDOWN_ON_REBOOT +## A command to run prior to the world shutting down, only used if the above option is enabled +## This default value will kill Dream Daemon on Windows machines +#SHUTDOWN_SHELL_COMMAND taskkill /f /im dreamdaemon.exe \ No newline at end of file