From cc3d81df96a13acf617e7b96aff26cd02f2aea25 Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Sat, 15 May 2021 20:28:08 +0100 Subject: [PATCH] Server Update Update --- code/_globalvars/misc.dm | 1 - code/datums/tgs_event_handler.dm | 38 ++++++++++++++++-------- code/game/world.dm | 6 ++-- code/modules/world_topic/announce.dm | 3 -- code/modules/world_topic/hostannounce.dm | 7 ----- paradise.dme | 1 - tools/send2server.py | 3 ++ 7 files changed, 32 insertions(+), 27 deletions(-) delete mode 100644 code/modules/world_topic/hostannounce.dm diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index cb8920f30ed..6d28489127a 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -92,7 +92,6 @@ GLOBAL_VAR(map_name) // Self explanatory GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) // Station datacore, manifest, etc GLOBAL_VAR_INIT(panic_bunker_enabled, FALSE) // Is the panic bunker enabled -GLOBAL_VAR_INIT(pending_server_update, FALSE) GLOBAL_LIST_EMPTY(ability_verbs) // Create-level abilities GLOBAL_LIST_INIT(pipe_colors, list("grey" = PIPE_COLOR_GREY, "red" = PIPE_COLOR_RED, "blue" = PIPE_COLOR_BLUE, "cyan" = PIPE_COLOR_CYAN, "green" = PIPE_COLOR_GREEN, "yellow" = PIPE_COLOR_YELLOW, "purple" = PIPE_COLOR_PURPLE)) diff --git a/code/datums/tgs_event_handler.dm b/code/datums/tgs_event_handler.dm index df140ad6ff6..1c4ff9aa3f7 100644 --- a/code/datums/tgs_event_handler.dm +++ b/code/datums/tgs_event_handler.dm @@ -1,39 +1,53 @@ +/// Will our restart be slower? +GLOBAL_VAR_INIT(slower_restart, FALSE) + +/proc/server_announce_global(announcement_text) + to_chat(world, "\[Server] [announcement_text]") + +/proc/server_announce_adminonly(announcement_text) + to_chat(GLOB.admins, "\[Server] \[Admin] [announcement_text]") + /datum/tgs_event_handler/impl var/datum/timedevent/reattach_timer + /datum/tgs_event_handler/impl/HandleEvent(event_code, ...) switch(event_code) if(TGS_EVENT_REBOOT_MODE_CHANGE) var/list/reboot_mode_lookup = list ("[TGS_REBOOT_MODE_NORMAL]" = "be normal", "[TGS_REBOOT_MODE_SHUTDOWN]" = "shutdown the server", "[TGS_REBOOT_MODE_RESTART]" = "hard restart the server") var/old_reboot_mode = args[2] var/new_reboot_mode = args[3] - message_admins("\[Server]\[Info] Reboot will no longer [reboot_mode_lookup["[old_reboot_mode]"]], it will instead [reboot_mode_lookup["[new_reboot_mode]"]]") + if(new_reboot_mode == TGS_REBOOT_MODE_SHUTDOWN) + GLOB.slower_restart = TRUE + else + GLOB.slower_restart = FALSE + server_announce_adminonly("\[Info] Reboot will no longer [reboot_mode_lookup["[old_reboot_mode]"]], it will instead [reboot_mode_lookup["[new_reboot_mode]"]]") if(TGS_EVENT_PORT_SWAP) - message_admins("\[Server]\[Info] Changing port from [world.port] to [args[2]]") + server_announce_adminonly("\[Info] Changing port from [world.port] to [args[2]]") if(TGS_EVENT_INSTANCE_RENAMED) - message_admins("\[Server]\[Info] Instance renamed to from [world.TgsInstanceName()] to [args[2]]") + server_announce_adminonly("\[Info] Instance renamed to from [world.TgsInstanceName()] to [args[2]]") if(TGS_EVENT_COMPILE_START) - message_admins("\[Server]\[Info] Code deployment started, new game version incoming next round...") + server_announce_adminonly("\[Info] Code deployment started, new game version incoming next round...") if(TGS_EVENT_COMPILE_CANCELLED) - message_admins("\[Server]\[Warning] Code deployment cancelled!") + server_announce_adminonly("\[Warning] Code deployment cancelled! Consult a maintainer/host to see if this was intentional!") if(TGS_EVENT_COMPILE_FAILURE) - message_admins("\[Server]\[Error] Code deployment failed! Inform a maintainer/host immediately!") + server_announce_adminonly("\[Error] Code deployment failed! Inform a maintainer/host immediately!") if(TGS_EVENT_DEPLOYMENT_COMPLETE) - message_admins("\[Server]\[Info] Code deployment complete!") - to_chat(world, "Server updated, changes will be applied on the next round...") + server_announce_adminonly("\[Info] Code deployment complete!") + server_announce_global("Server update complete. Changes will be applied on the next round.") if(TGS_EVENT_WATCHDOG_DETACH) - message_admins("\[Server]\[Info] Server manager restarting...") + server_announce_adminonly("\[Info] Server manager restarting...") reattach_timer = addtimer(CALLBACK(src, .proc/LateOnReattach), 1 MINUTES, TIMER_STOPPABLE) if(TGS_EVENT_WATCHDOG_REATTACH) var/datum/tgs_version/old_version = world.TgsVersion() var/datum/tgs_version/new_version = args[2] if(!old_version.Equals(new_version)) - message_admins("\[Server]\[Info] Manager back online. TGS has been updated to v[new_version.deprefixed_parameter]") + server_announce_adminonly("\[Info] Server manager back online. TGS has been updated to v[new_version.deprefixed_parameter]") else - message_admins("\[Server]\[Info] Manager back online") + server_announce_adminonly("\[Info] Server manager back online") if(reattach_timer) deltimer(reattach_timer) reattach_timer = null /datum/tgs_event_handler/impl/proc/LateOnReattach() - message_admins("\[Server]\[Warning] TGS hasn't notified us of it coming back for a full minute! Is there a problem?") + server_announce_adminonly("\[Warning] TGS hasn't notified us of it coming back for a full minute! Is there a problem?") diff --git a/code/game/world.dm b/code/game/world.dm index b3abac365e8..8573327076a 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -142,11 +142,11 @@ GLOBAL_LIST_EMPTY(world_topic_handlers) return #endif - // If we had an update or pending TM, set a 60 second timeout + // If the server has been gracefully shutdown in TGS, have a 60 seconds grace period for SQL updates and stuff var/secs_before_auto_reconnect = 10 - if(GLOB.pending_server_update) + if(GLOB.slower_restart) secs_before_auto_reconnect = 60 - to_chat(world, "Reboot will take a little longer, due to pending updates.") + server_announce_global("Reboot will take a little longer due to pending backend changes.") // Send the reboot banner to all players for(var/client/C in GLOB.clients) diff --git a/code/modules/world_topic/announce.dm b/code/modules/world_topic/announce.dm index 99bc3d280cf..f84481c979f 100644 --- a/code/modules/world_topic/announce.dm +++ b/code/modules/world_topic/announce.dm @@ -4,8 +4,5 @@ /datum/world_topic_handler/announce/execute(list/input, key_valid) var/prtext = input["announce"] - var/pr_substring = copytext(prtext, 1, 23) - if(pr_substring == "Pull Request merged by") - GLOB.pending_server_update = TRUE for(var/client/C in GLOB.clients) to_chat(C, "PR: [prtext]") diff --git a/code/modules/world_topic/hostannounce.dm b/code/modules/world_topic/hostannounce.dm deleted file mode 100644 index 3deb5b3d717..00000000000 --- a/code/modules/world_topic/hostannounce.dm +++ /dev/null @@ -1,7 +0,0 @@ -/datum/world_topic_handler/hostannounce - topic_key = "hostannounce" - requires_commskey = TRUE - -/datum/world_topic_handler/hostannounce/execute(list/input, key_valid) - GLOB.pending_server_update = TRUE - to_chat(world, "