Skip to content

Commit

Permalink
tweak(admin): adds a second line of defense in restart proc
Browse files Browse the repository at this point in the history
Filatelele authored Apr 21, 2024

Verified

This commit was signed with the committer’s verified signature.
sr-gi Sergi Delgado
1 parent ab78d0a commit 1ed3e36
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions code/modules/admin/admin.dm
Original file line number Diff line number Diff line change
@@ -672,24 +672,30 @@ var/global/floorIsLava = 0

var/list/options = list("Regular Restart", "Hard Restart (Skip MC Shutdown)", "Hardest Restart (Direct world.Reboot) \[Dangerous\]")

var/result = input(usr, "Select reboot method", "World Reboot", options[1]) as null|anything in options
if(result)
feedback_set_details("end_error","admin reboot - by [key_name(usr)]")
feedback_add_details("admin_verb","R") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
var/init_by = "<span class='notice'>Initiated by [key_name(usr)].</span>"
switch(result)
if("Regular Restart")
to_world("<span class='danger'>Restarting world!</span> [init_by]")
log_admin("[key_name(usr)] initiated a reboot.")
world.Reboot()
if("Hard Restart (Skip MC Shutdown)")
to_world("<span class='boldannounce'>Hard world restart.</span> [init_by]")
log_admin("[key_name(usr)] initiated a hard reboot.")
world.Reboot(reboot_hardness = REBOOT_HARD)
if("Hardest Restart (Direct world.Reboot) \[Dangerous\]")
to_world("<span class='boldannounce'>Hardest world restart.</span> [init_by]")
log_admin("[key_name(usr)] initiated a hardest reboot.")
world.Reboot(reboot_hardness = REBOOT_REALLY_HARD)
var/result = tgui_input_list(usr, "Select reboot method", "World Reboot", options)
if(!result)
return

var/failsafe = tgui_input_text(usr, "To confirm, type \"Server Restart\" in the box below", "WORLD REBOOT. THINK TWICE!!!")
if(failsafe != "Server Restart")
return

feedback_set_details("end_error","admin reboot - by [key_name(usr)]")
feedback_add_details("admin_verb","R") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
var/init_by = "<span class='notice'>Initiated by [key_name(usr)].</span>"
switch(result)
if("Regular Restart")
to_world("<span class='danger'>Restarting world!</span> [init_by]")
log_admin("[key_name(usr)] initiated a reboot.")
world.Reboot()
if("Hard Restart (Skip MC Shutdown)")
to_world("<span class='boldannounce'>Hard world restart.</span> [init_by]")
log_admin("[key_name(usr)] initiated a hard reboot.")
world.Reboot(reboot_hardness = REBOOT_HARD)
if("Hardest Restart (Direct world.Reboot) \[Dangerous\]")
to_world("<span class='boldannounce'>Hardest world restart.</span> [init_by]")
log_admin("[key_name(usr)] initiated a hardest reboot.")
world.Reboot(reboot_hardness = REBOOT_REALLY_HARD)

/datum/admins/proc/end_round()
set category = "Server"

0 comments on commit 1ed3e36

Please sign in to comment.