Skip to content

Commit

Permalink
Feat: add shutdown on reboot option
Browse files Browse the repository at this point in the history
  • Loading branch information
Bizzonium committed Aug 28, 2023
1 parent a659de2 commit b056806
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
11 changes: 10 additions & 1 deletion code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,16 @@ GLOBAL_VAR(restart_counter)
shutdown_logging() // Past this point, no logging procs can be used, at risk of data loss.
auxcleanup()

TgsReboot() // TGS can decide to kill us right here, so it's important to do it last
//SS220 EDIT CHANGE BEGIN - SHUTDOWN
if(CONFIG_GET(flag/shutdown_on_reboot))
if(CONFIG_GET(string/shutdown_shell_command))
shell(CONFIG_GET(string/shutdown_shell_command))
del(world)
TgsEndProcess()
return()

Check warning on line 330 in code/game/world.dm

View workflow job for this annotation

GitHub Actions / Run Linters

'()' should be replaced with 'null'
else
TgsReboot() // TGS can decide to kill us right here, so it's important to do it last
//SS220 EDIT CHANGE END

..()
#endif
Expand Down
7 changes: 7 additions & 0 deletions config/ss220/ss220_config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@
#FFMPEG_CPUAFFINITY 24-31

AUTO_CRYO_SSD_MIN 10

## 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
6 changes: 6 additions & 0 deletions modular_ss220/modules/shutdown/shutdown_config.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/datum/config_entry/flag/shutdown_on_reboot
default = FALSE
protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN

/datum/config_entry/string/shutdown_shell_command
protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -7387,6 +7387,7 @@
#include "modular_ss220\modules\paradise_keybindings\code\keybinding\mob.dm"
#include "modular_ss220\modules\paradise_keybindings\code\keybinding\movement.dm"
#include "modular_ss220\modules\paradise_keybindings\code\keybinding\robot.dm"
#include "modular_ss220\modules\shutdown\shutdown_config.dm"
#include "modular_ss220\modules\translations\code\customer_ru.dm"
#include "modular_ss220\modules\translations\code\moustache_ru.dm"
#include "modular_ss220\modules\tts\code\_tts_defines.dm"
Expand Down

0 comments on commit b056806

Please sign in to comment.