From 40730237f260ebbb554fe63e4471ef7fc97b24e3 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Thu, 5 May 2022 14:52:53 -0400 Subject: [PATCH] Hub refresh - Cleans up update_status(), adds more hub-related config options, and more! --- code/_globalvars/lists/flavor_misc.dm | 2 + .../configuration/entries/server.dm | 6 ++ code/game/world.dm | 80 ++++++++----------- config/entries/server.txt | 10 +++ strings/server_taglines.txt | 1 + 5 files changed, 51 insertions(+), 48 deletions(-) create mode 100644 strings/server_taglines.txt diff --git a/code/_globalvars/lists/flavor_misc.dm b/code/_globalvars/lists/flavor_misc.dm index 599f90b0af..f325e7cb95 100644 --- a/code/_globalvars/lists/flavor_misc.dm +++ b/code/_globalvars/lists/flavor_misc.dm @@ -292,6 +292,8 @@ GLOBAL_LIST_INIT(station_names, world.file2list("strings/station_names.txt" + "" GLOBAL_LIST_INIT(station_suffixes, world.file2list("strings/station_suffixes.txt")) +GLOBAL_LIST_INIT(server_taglines, world.file2list("strings/server_taglines.txt")) + GLOBAL_LIST_INIT(greek_letters, world.file2list("strings/greek_letters.txt")) GLOBAL_LIST_INIT(phonetic_alphabet, world.file2list("strings/phonetic_alphabet.txt")) diff --git a/code/controllers/configuration/entries/server.dm b/code/controllers/configuration/entries/server.dm index ee40df573c..77e5dcf950 100644 --- a/code/controllers/configuration/entries/server.dm +++ b/code/controllers/configuration/entries/server.dm @@ -2,9 +2,15 @@ /datum/config_entry/string/servername // server name (the name of the game window) +/datum/config_entry/string/communityshortname // short name of the server's community + +/datum/config_entry/string/communitylink // link to the server's website + /datum/config_entry/string/servertagline config_entry_value = "We forgot to set the server's tagline in config.txt" +/datum/config_entry/flag/usetaglinestrings + /datum/config_entry/string/serversqlname // short form server name used for the DB /datum/config_entry/string/stationname // station name (the name of the station in-game) diff --git a/code/game/world.dm b/code/game/world.dm index 84d39d42f7..cd0e156312 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -285,63 +285,47 @@ GLOBAL_LIST(topic_status_cache) ..() /world/proc/update_status() + . = "" + if(!config) + status = "SERVER LOADING OR BROKEN. (18+)" + return - var/list/features = list() + game_state = (CONFIG_GET(number/extreme_popcap) && GLOB.clients.len >= CONFIG_GET(number/extreme_popcap)) - // if(GLOB.master_mode) - // features += GLOB.master_mode + // ---Hub title--- + var/servername = CONFIG_GET(string/servername) + var/stationname = station_name() + var/defaultstation = CONFIG_GET(string/stationname) + if(servername || stationname != defaultstation) + . += (servername ? "[servername] - " : "") + . += (stationname != defaultstation ? "[stationname]\] " : "\] ") - // if (!GLOB.enter_allowed) - // features += "closed" + var/communityname = CONFIG_GET(string/communityshortname) + var/communitylink = CONFIG_GET(string/communitylink) + if(communityname) + . += (communitylink ? "([communityname]) " : "([communityname]) ") - var/s = "" - var/hostedby - if(config) - var/server_name = CONFIG_GET(string/servername) - if (server_name) - s += "[server_name] — " - // features += "[CONFIG_GET(flag/norespawn) ? "no " : ""]respawn" - // if(CONFIG_GET(flag/allow_vote_mode)) - // features += "vote" - // if(CONFIG_GET(flag/allow_ai)) - // features += "AI allowed" - hostedby = CONFIG_GET(string/hostedby) - - s += "[station_name()]"; - s += " (" - s += "" //Change this to wherever you want the hub to link to. - s += "Citadel" //Replace this with something else. Or ever better, delete it and uncomment the game version. - s += "" - s += ")\]" //CIT CHANGE - encloses the server title in brackets to make the hub entry fancier - s += "
[CONFIG_GET(string/servertagline)]
" //CIT CHANGE - adds a tagline! - - var/players = GLOB.clients.len - - if(SSmapping.config) // this just stops the runtime, honk. - features += "[SSmapping.config.map_name]" //CIT CHANGE - makes the hub entry display the current map - - if(NUM2SECLEVEL(GLOB.security_level))//CIT CHANGE - makes the hub entry show the security level - features += "[NUM2SECLEVEL(GLOB.security_level)] alert" - - var/popcaptext = "" var/popcap = max(CONFIG_GET(number/extreme_popcap), CONFIG_GET(number/hard_popcap), CONFIG_GET(number/soft_popcap)) - if (popcap) - popcaptext = "/[popcap]" + if(popcap) + . += "([GLOB.clients.len]/[popcap]) " - if (players > 1) - features += "[players][popcaptext] players" - else if (players > 0) - features += "[players][popcaptext] player" + . += "(18+)
" //This is obligatory forr obvious reasons. - game_state = (CONFIG_GET(number/extreme_popcap) && players >= CONFIG_GET(number/extreme_popcap)) //tells the hub if we are full + // ---Hub body--- + var/tagline = (CONFIG_GET(flag/usetaglinestrings) ? pick(GLOB.server_taglines) : CONFIG_GET(string/servertagline)) + if(tagline) + . += "[tagline]
" - if (!host && hostedby) - features += "hosted by [hostedby]" + // ---Hub footer--- + . += "\[" + if(SSmapping.config) + . += "[SSmapping.config.map_name], " + if(NUM2SECLEVEL(GLOB.security_level)) + . += "[NUM2SECLEVEL(GLOB.security_level)] alert, " + + . += "[get_active_player_count(afk_check = TRUE)] playing" - if (features) - s += "\[[jointext(features, ", ")]" - - status = s + status = . /world/proc/update_hub_visibility(new_visibility) if(new_visibility == GLOB.hub_visibility) diff --git a/config/entries/server.txt b/config/entries/server.txt index 2b905810cd..0187c641ef 100644 --- a/config/entries/server.txt +++ b/config/entries/server.txt @@ -4,9 +4,19 @@ ## Server name: This appears at the top of the screen in-game and in the BYOND hub. Uncomment and replace 'tgstation' with the name of your choice. # SERVERNAME tgstation +## Community short-name: This appears in parentheses after the server's active station name +# COMMUNITYSHORTNAME tg??? + +## Community link: Requires a community short-name defined. Attaches a link to the community's shortname, and requires a short-name defined. +## You could alternatively just add raw HTML to the above, but this is more newbie-friendly +# COMMUNITYLINK http://crouton.net + ## Server tagline: This will appear right below the server's title. # SERVERTAGLINE A generic TG-based server +## Use tagline strings: Uncomment to have the server's tagline be randomly selected from taglines.txt +# USETAGLINESTRINGS + ## Server SQL name: This is the name used to identify the server to the SQL DB, distinct from SERVERNAME as it must be at most 32 characters. # SERVERSQLNAME tgstation diff --git a/strings/server_taglines.txt b/strings/server_taglines.txt new file mode 100644 index 0000000000..f0dc702673 --- /dev/null +++ b/strings/server_taglines.txt @@ -0,0 +1 @@ +Fill in your own community quotes and memery here! \ No newline at end of file