From bbbe8c1d453e69bec29283ad1888292e1cb77227 Mon Sep 17 00:00:00 2001
From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Date: Tue, 17 Aug 2021 16:45:29 +0100
Subject: [PATCH] Even more stuff
---
code/controllers/subsystem/instancing.dm | 12 ++++++------
code/modules/world_topic/instance_announce.dm | 9 ++++++++-
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/code/controllers/subsystem/instancing.dm b/code/controllers/subsystem/instancing.dm
index 7abe4ba2b09..87ad3f06e7c 100644
--- a/code/controllers/subsystem/instancing.dm
+++ b/code/controllers/subsystem/instancing.dm
@@ -10,8 +10,8 @@ SUBSYSTEM_DEF(instancing)
// Do an initial peer check
check_peers(TRUE) // Force because of time memes
UNTIL(initial_check_complete) // Wait here a bit
- var/startup_msg = "The server [GLOB.configuration.general.server_name] is now starting up. The map is [SSmapping.map_datum.fluff_name] ([SSmapping.map_datum.technical_name])"
- message_all_peers(startup_msg)
+ var/startup_msg = "The server [GLOB.configuration.general.server_name] is now starting up. The map is [SSmapping.map_datum.fluff_name] ([SSmapping.map_datum.technical_name]). You can connect with the Switch Server verb."
+ message_all_peers(startup_msg, send_reping = TRUE)
return ..()
/datum/controller/subsystem/instancing/fire(resumed)
@@ -76,9 +76,9 @@ SUBSYSTEM_DEF(instancing)
* * message - Message to send to the other servers
* * include_offline - Whether to topic offline servers on the off chance they came online
*/
-/datum/controller/subsystem/instancing/proc/message_all_peers(message, include_offline = FALSE)
+/datum/controller/subsystem/instancing/proc/message_all_peers(message, include_offline = FALSE, send_reping = FALSE)
var/topic_string = "instance_announce&msg=[html_encode(message)]"
- topic_all_peers(topic_string, include_offline)
+ topic_all_peers(topic_string, include_offline, send_reping)
/**
* Sends a topic to all peers
@@ -89,7 +89,7 @@ SUBSYSTEM_DEF(instancing)
* * raw_topic - The raw topic to send to the other servers
* * include_offline - Whether to topic offline servers on the off chance they came online
*/
-/datum/controller/subsystem/instancing/proc/topic_all_peers(raw_topic, include_offline = FALSE)
+/datum/controller/subsystem/instancing/proc/topic_all_peers(raw_topic, include_offline = FALSE, send_reping = FALSE)
for(var/datum/peer_server/PS in GLOB.configuration.instancing.peers)
if(PS.online || include_offline)
- world.Export("byond://[PS.internal_ip]:[PS.server_port]?[raw_topic]&key=[PS.commskey]")
+ world.Export("byond://[PS.internal_ip]:[PS.server_port]?[raw_topic]&key=[PS.commskey][send_reping ? "&repoll=1" : ""]")
diff --git a/code/modules/world_topic/instance_announce.dm b/code/modules/world_topic/instance_announce.dm
index e63ce9a290c..250046cd53b 100644
--- a/code/modules/world_topic/instance_announce.dm
+++ b/code/modules/world_topic/instance_announce.dm
@@ -4,4 +4,11 @@
/datum/world_topic_handler/instance_announce/execute(list/input, key_valid)
var/msg = input["msg"]
- to_chat(world, "Attention: [msg]")
+ if(input["repoll"]) // Repoll peers
+ UNTIL(!SSinstancing.check_running) // If we are running, wait
+ SSinstancing.check_peers(TRUE) // Manually check, with FORCE
+ UNTIL(!SSinstancing.check_running) // Wait for completion
+
+ // Now that we repolled, we can tell the playerbase
+ to_chat(world, "