From 01eba3bbdd3ad3d28b0ca32be49028ec3f6121ef Mon Sep 17 00:00:00 2001 From: Timberpoes Date: Tue, 8 Jun 2021 23:00:00 +0100 Subject: [PATCH] Admins will no longer accidentally undelay round end or reboot the server when multiple admins attempt to delay it at the same time. (#59551) Delaying/undelaying round end is no longer a toggle under the same href. Delaying and undelaying the round end are now explicit operations. If two admins attempt to delay round end at the same time, the first admin to input a reason wins and the second admin instead gets an alert that the round end is already delayed along with the reason instead of accidentally untoggling it. FINALLY, undelaying round end will no longer trigger an immediate auto server reboot when SSticker.ready_for_reboot is TRUE. The admins are messaged that they must Reboot World manually. This is the final guard against admins accidentally undelaying when they're not actually ready to do so. --- code/modules/admin/check_antagonists.dm | 5 ++- code/modules/admin/topic.dm | 48 +++++++++++++++++-------- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/code/modules/admin/check_antagonists.dm b/code/modules/admin/check_antagonists.dm index b07cb49ddbe..d5d8bebc5f0 100644 --- a/code/modules/admin/check_antagonists.dm +++ b/code/modules/admin/check_antagonists.dm @@ -138,7 +138,10 @@ else dat += "ETA: [(timeleft / 60) % 60]:[add_leading(num2text(timeleft % 60), 2, "0")]
" dat += "End Round Now
" - dat += "[SSticker.delay_end ? "End Round Normally" : "Delay Round End"]
" + if(SSticker.delay_end) + dat += "End Round Normally
" + else + dat += "Delay Round End
" dat += "Enable/Disable CTF
" dat += "Reboot World
" dat += "Check Teams" diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 6a3c85fc0cd..a6f20b79f28 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -159,22 +159,40 @@ else if(href_list["delay_round_end"]) if(!check_rights(R_SERVER)) return - if(!SSticker.delay_end) - SSticker.admin_delay_notice = input(usr, "Enter a reason for delaying the round end", "Round Delay Reason") as null|text - if(isnull(SSticker.admin_delay_notice)) - return - else - if(tgui_alert(usr, "Really cancel current round end delay? The reason for the current delay is: \"[SSticker.admin_delay_notice]\"", "Undelay round end", list("Yes", "No")) != "Yes") - return - SSticker.admin_delay_notice = null - SSticker.delay_end = !SSticker.delay_end - var/reason = SSticker.delay_end ? "for reason: [SSticker.admin_delay_notice]" : "."//laziness - var/msg = "[SSticker.delay_end ? "delayed" : "undelayed"] the round end [reason]" - log_admin("[key_name(usr)] [msg]") - message_admins("[key_name_admin(usr)] [msg]") - if(SSticker.ready_for_reboot && !SSticker.delay_end) //we undelayed after standard reboot would occur - SSticker.standard_reboot() + if(SSticker.delay_end) + tgui_alert(usr, "The round end is already delayed. The reason for the current delay is: \"[SSticker.admin_delay_notice]\"", "Alert", list("Ok")) + return + + var/delay_reason = input(usr, "Enter a reason for delaying the round end", "Round Delay Reason") as null|text + + if(isnull(delay_reason)) + return + + if(SSticker.delay_end) + tgui_alert(usr, "The round end is already delayed. The reason for the current delay is: \"[SSticker.admin_delay_notice]\"", "Alert", list("Ok")) + return + + SSticker.delay_end = TRUE + SSticker.admin_delay_notice = delay_reason + + log_admin("[key_name(usr)] delayed the round end for reason: [SSticker.admin_delay_notice]") + message_admins("[key_name_admin(usr)] delayed the round end for reason: [SSticker.admin_delay_notice]") + else if(href_list["undelay_round_end"]) + if(!check_rights(R_SERVER)) + return + + if(tgui_alert(usr, "Really cancel current round end delay? The reason for the current delay is: \"[SSticker.admin_delay_notice]\"", "Undelay round end", list("Yes", "No")) == "No") + return + + SSticker.admin_delay_notice = null + SSticker.delay_end = FALSE + + log_admin("[key_name(usr)] undelayed the round end.") + if(SSticker.ready_for_reboot) + message_admins("[key_name_admin(usr)] undelayed the round end. You must now manually Reboot World to start the next shift.") + else + message_admins("[key_name_admin(usr)] undelayed the round end.") else if(href_list["end_round"]) if(!check_rights(R_ADMIN)) return