adds hub visibility toggling and config option

This commit is contained in:
spookerton
2023-04-26 21:19:11 +01:00
parent 6f9ca19d1c
commit f189a48cce
7 changed files with 37 additions and 17 deletions

View File

@@ -88,6 +88,8 @@ var/global/list/gamemode_cache = list()
var/static/automute_on = 0 //enables automuting/spam prevention
var/static/jobs_have_minimal_access = 0 //determines whether jobs use minimal access or expanded access.
var/static/hub_visible = FALSE
var/cult_ghostwriter = 1 //Allows ghosts to write in blood in cult rounds...
var/cult_ghostwriter_req_cultists = 10 //...so long as this many cultists are active.
@@ -365,6 +367,9 @@ var/global/list/gamemode_cache = list()
if ("log_ooc")
config.log_ooc = 1
if ("hub_visible")
config.hub_visible = TRUE
if ("log_access")
config.log_access = 1

View File

@@ -10,13 +10,13 @@
config.post_load()
if(config && config.server_name != null && config.server_suffix && world.port > 0)
// dumb and hardcoded but I don't care~
config.server_name += " #[(world.port % 1000) / 100]"
if(config && config.log_runtime)
if (config.server_name)
name = config.server_name
if (config.log_runtime)
log = file("data/logs/runtime/[time2text(world.realtime,"YYYY-MM-DD-(hh-mm-ss)")]-runtime.log")
update_hub_visibility(config.hub_visible)
GLOB.timezoneOffset = get_timezone_offset()
callHook("startup")

View File

@@ -1,15 +1,12 @@
/world
hub = "Exadv1.spacestation13"
//hub_password = "SORRYNOPASSWORD"
hub_password = "kMZy3U5jJHSiBQjr"
name = "Space Station 13"
/* This is for any host that would like their server to appear on the main SS13 hub.
To use it, simply replace the password above, with the password found below, and it should work.
If not, let us know on the main tgstation IRC channel of irc.rizon.net #tgstation13 we can help you there.
hub = "Exadv1.spacestation13"
hub_password = "kMZy3U5jJHSiBQjr"
name = "Space Station 13"
*/
/world/proc/update_hub_visibility(new_status)
if (isnull(new_status))
new_status = !config.hub_visible
config.hub_visible = new_status
if (config.hub_visible)
hub_password = "kMZy3U5jJHSiBQjr"
else
hub_password = "SORRYNOPASSWORD"

View File

@@ -1652,3 +1652,16 @@ var/global/floorIsLava = 0
qdel(P)
faxreply = null
return
/datum/admins/proc/toggle_hub_visibility()
set category = "Server"
set desc = "Globally Toggles Hub Visibility"
set name = "Toggle Hub Visibility"
if(!check_rights(R_ADMIN))
return
world.update_hub_visibility()
var/long_message = "Updated hub visibility. The server is now [config.hub_visible ? "visible" : "invisible"]."
if (config.hub_visible && !world.reachable)
message_admins("WARNING: The server will not show up on the hub because byond is detecting that a firewall is blocking incoming connections.")
log_and_message_admins(long_message)

View File

@@ -109,7 +109,8 @@ var/global/list/admin_verbs_admin = list(
/datum/admins/proc/view_feedback,
/client/proc/debug_global_variables,
/client/proc/admin_add_whitelist,
/client/proc/admin_del_whitelist
/client/proc/admin_del_whitelist,
/datum/admins/proc/toggle_hub_visibility
)
var/global/list/admin_verbs_ban = list(

View File

@@ -683,6 +683,7 @@
stat("Instances:","[world.contents.len]")
stat("World Time:", world.time)
stat("Real time of day:", REALTIMEOFDAY)
stat("Hub:", "Visibility [config.hub_visible?"On":"Off"], [world.reachable?"":"NOT"] Reachable")
stat(null)
if(GLOB)
GLOB.stat_entry()

View File

@@ -1,6 +1,9 @@
## Server name: This appears at the top of the screen in-game. In this case it will read "tgstation: station_name" where station_name is the randomly generated name of the station for the round. Remove the # infront of SERVERNAME and replace 'tgstation' with the name of your choice
# SERVERNAME spacestation13
## Uncomment to make the server default to being listed on the BYOND hub.
#HUB_VISIBLE
## Alert levels
ALERT_GREEN All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced.
ALERT_BLUE_UPTO The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible, random searches are permitted.