I think this is instance communication

This commit is contained in:
AffectedArc07
2021-09-20 23:50:51 +01:00
parent 9c14b6b732
commit 890e7e5ce5
16 changed files with 163 additions and 127 deletions
-1
View File
@@ -139,7 +139,6 @@ GLOBAL_LIST_INIT(admin_verbs_server, list(
/client/proc/set_ooc,
/client/proc/reset_ooc,
/client/proc/set_next_map,
/client/proc/refresh_instances,
/client/proc/manage_queue,
/client/proc/add_queue_server_bypass
))
+3 -9
View File
@@ -7,6 +7,8 @@
return
to_chat(usr, "<b>Server instances info</b>")
to_chat(usr, "<b>AA you need to finish this you lazy oaf</b>")
/*
for(var/datum/peer_server/PS in GLOB.configuration.instancing.peers)
// We havnt even been discovered, so we cant even be online
if(!PS.discovered)
@@ -20,13 +22,5 @@
// If we are here, we are online, so we can do a rich report
to_chat(usr, "ID [PS.server_id] - <font color='green'><b>ONLINE</b></font> (Players: [PS.playercount])")
*/
/client/proc/refresh_instances()
set name = "Force Refresh Server Instances"
set desc = "Force refresh the local cache of server instances"
set category = "Server"
if(!check_rights(R_SERVER))
return
SSinstancing.check_peers(TRUE) // Force check
+5
View File
@@ -326,12 +326,16 @@
if(length(related_accounts_cid))
log_admin("[key_name(src)] Alts by CID: [jointext(related_accounts_cid, " ")]")
// This sleeps so it has to go here. Dont fucking move it.
SSinstancing.update_playercache(ckey)
// This has to go here to avoid issues
// If you sleep past this point, you will get SSinput errors as well as goonchat errors
// DO NOT STUFF RANDOM SQL QUERIES BELOW THIS POINT WITHOUT USING `INVOKE_ASYNC()` OR SIMILAR
// YOU WILL BREAK STUFF. SERIOUSLY. -aa07
GLOB.clients += src
spawn() // Goonchat does some non-instant checks in start()
chatOutput.start()
@@ -434,6 +438,7 @@
GLOB.admins -= src
GLOB.directory -= ckey
GLOB.clients -= src
SSinstancing.update_playercache() // Clear us out
QDEL_NULL(chatOutput)
if(movingmob)
movingmob.client_mobs_in_contents -= mob
@@ -3,12 +3,5 @@
requires_commskey = TRUE
/datum/world_topic_handler/instance_announce/execute(list/input, key_valid)
var/msg = input["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, "<center><span class='boldannounce'><big>Attention</big></span></center><hr>[msg]<hr>")
to_chat(world, "<center><span class='boldannounce'><big>Attention</big></span></center><hr>[input["msg"]]<hr>")
SEND_SOUND(world, sound('sound/misc/notice2.ogg')) // Same as captains priority announce
@@ -1,12 +0,0 @@
/datum/world_topic_handler/server_discovery
topic_key = "server_discovery"
requires_commskey = TRUE
/datum/world_topic_handler/server_discovery/execute(list/input, key_valid)
// We need to send the stuff to make a /datum/peer_server on the other side
var/list/server_data = list()
server_data["external_ip"] = world.internet_address
server_data["server_id"] = GLOB.configuration.instancing.server_id
server_data["server_name"] = GLOB.configuration.general.server_name
server_data["playercount"] = length(GLOB.clients)
return json_encode(server_data)