From ff3ca83a7d14d3a82c4647d415e537946548fe1b Mon Sep 17 00:00:00 2001 From: Spookerton <918997+Spookerton@users.noreply.github.com> Date: Sat, 11 Jan 2025 19:07:13 +0000 Subject: [PATCH] [MIRROR] clean up server location config --- code/controllers/configuration.dm | 17 +++++------------ code/game/world.dm | 15 +++++++-------- code/modules/ext_scripts/irc.dm | 10 +++------- config/example/config.txt | 8 ++------ 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 1705a5ab05fdf..45f17d79e3422 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -4,9 +4,6 @@ /// server name (for world name / status) var/static/server_name = "Space Station 13" - /// generate numeric suffix based on server port - var/static/server_suffix = FALSE - /// for topic status requests var/static/game_version = "Baystation12" @@ -201,9 +198,7 @@ var/static/debugparanoid = FALSE - var/static/serverurl - - var/static/server + var/static/server_address var/static/banappeals @@ -633,14 +628,12 @@ respawn_menu_delay = respawn_menu_delay > 0 ? respawn_menu_delay : 0 if ("server_name") server_name = value - if ("serversuffix") - server_suffix = TRUE if ("hostedby") hostedby = value - if ("serverurl") - serverurl = value - if ("server") - server = value + if ("server_address") + server_address = value + if (copytext(server_address, 1, 9) != "byond://") + server_address = "byond://[server_address]" if ("banappeals") banappeals = value if ("wiki_url") diff --git a/code/game/world.dm b/code/game/world.dm index b638efa8ba7c6..89d6384efeaed 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -519,14 +519,13 @@ GLOBAL_VAR_INIT(world_topic_last, world.timeofday) Master.Shutdown() - var/datum/chatOutput/co - for(var/client/C in GLOB.clients) - co = C.chatOutput - if(co) - co.ehjax_send(data = "roundrestart") - if(config.server) //if you set a server location in config.txt, it sends you there instead of trying to reconnect to the same world address. -- NeoFite - for(var/client/C in GLOB.clients) - send_link(C, "byond://[config.server]") + var/datum/chatOutput/chat_output + for (var/client/client in GLOB.clients) + chat_output = client.chatOutput + if (chat_output) + chat_output.ehjax_send(data = "roundrestart") + if (config.server_address) + send_link(client, config.server_address) // [SIERRA-ADD] - RUST_G - Past this point, no logging procs can be used, at risk of data loss. rustg_log_close_all() diff --git a/code/modules/ext_scripts/irc.dm b/code/modules/ext_scripts/irc.dm index 7a8e8b314f283..9143960edf8a8 100644 --- a/code/modules/ext_scripts/irc.dm +++ b/code/modules/ext_scripts/irc.dm @@ -45,13 +45,9 @@ export2irc(params) /proc/get_world_url() - . = "byond://" - if(config.serverurl) - . += config.serverurl - else if(config.server) - . += config.server - else - . += "[world.address]:[world.port]" + if (config.server_address) + return config.server_address + return "byond://[world.address]:[world.port]" /proc/send_to_admin_discord(type, message) if(config.admin_discord && config.excom_address) diff --git a/config/example/config.txt b/config/example/config.txt index 6d1edc4963eeb..52dc684f8eee7 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -195,12 +195,8 @@ GUEST_BAN ## Uncomment to 1 to jobban, leave commented out to allow these positions for everyone (but see GUEST_JOBBAN above and regular jobbans) # USEWHITELIST -## set a server location for world reboot. Don't include the byond://, just give the address and port. -#SERVER server.net:port - -## set a server URL for the IRC bot to use; like SERVER, don't include the byond:// -## Unlike SERVER, this one shouldn't break auto-reconnect -#SERVERURL server.net:port +## Set a server location for world rejoins. May be either "address:port" or "byond://address:port". +#SERVER_ADDRESS server.address:port ## Wiki address ## Where your server's documentation lives