From 94ab6f40e70ce933dc64cdfe76c3afd41c25e6b6 Mon Sep 17 00:00:00 2001 From: PowerfulBacon <26465327+PowerfulBacon@users.noreply.github.com> Date: Sat, 20 Apr 2024 16:18:06 +0100 Subject: [PATCH] Updates the hub entry (#10898) * Updates the server tagline * Update world.dm * Call to action * Auto update * Fixes the config entry not being included * Updates the default discord URL since its not a valid URL * Updates the status to account for the 255 character limit * Shifts stuff around * Removes the unused website URL link * Fixes 1 too many characters --- beestation.dme | 1 + .../configuration/entries/general.dm | 2 + code/controllers/subsystem/hub.dm | 7 ++ code/game/world.dm | 85 +++++++++++++------ code/modules/admin/admin.dm | 3 - code/modules/admin/battle_royale.dm | 2 - config/config.txt | 5 +- 7 files changed, 72 insertions(+), 33 deletions(-) create mode 100644 code/controllers/subsystem/hub.dm diff --git a/beestation.dme b/beestation.dme index 9c9c0aee1d73b..1b2f5cb91e932 100644 --- a/beestation.dme +++ b/beestation.dme @@ -421,6 +421,7 @@ #include "code\controllers\subsystem\fail2topic.dm" #include "code\controllers\subsystem\fire_burning.dm" #include "code\controllers\subsystem\garbage.dm" +#include "code\controllers\subsystem\hub.dm" #include "code\controllers\subsystem\icon_smooth.dm" #include "code\controllers\subsystem\idlenpcpool.dm" #include "code\controllers\subsystem\input.dm" diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 6d2bc588b21aa..da1792bed879e 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -23,6 +23,8 @@ /datum/config_entry/string/servername // server name (the name of the game window) +/datum/config_entry/string/servertag // Server tagline for displaying on the hub + /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/controllers/subsystem/hub.dm b/code/controllers/subsystem/hub.dm new file mode 100644 index 0000000000000..020aff20a7f70 --- /dev/null +++ b/code/controllers/subsystem/hub.dm @@ -0,0 +1,7 @@ +SUBSYSTEM_DEF(hub) + name = "Hub Entry" + flags = SS_NO_INIT + wait = 1 MINUTES + +/datum/controller/subsystem/hub/fire(resumed) + world.update_status() diff --git a/code/game/world.dm b/code/game/world.dm index fac2213f04d4e..07541e1cef9a9 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -356,43 +356,74 @@ GLOBAL_VAR(restart_counter) ..() /world/proc/update_status() - - var/list/features = list() - - if (!GLOB.enter_allowed) - features += "closed" - var/s = "" - var/hostedby - if(config) - var/server_name = CONFIG_GET(string/servername) - if (server_name) - s += "[server_name] — " - - hostedby = CONFIG_GET(string/hostedby) - - s += "[station_name()]"; - var/discordurl = CONFIG_GET(string/discordurl) - s += " (Discord|Website)" + // Remove the https: since // is good enough + var/discordurl = replacetext(CONFIG_GET(string/discordurl), "https:", "") + var/server_name = CONFIG_GET(string/servername) + var/server_tag = CONFIG_GET(string/servertag) + var/station_name = station_name() var/players = GLOB.clients.len - var/popcaptext = "" var/popcap = max(CONFIG_GET(number/extreme_popcap), CONFIG_GET(number/hard_popcap), CONFIG_GET(number/soft_popcap)) if (popcap) popcaptext = "/[popcap]" - game_state = (CONFIG_GET(number/extreme_popcap) && players >= CONFIG_GET(number/extreme_popcap)) //tells the hub if we are full - - if (!host && hostedby) - features += "hosted by [hostedby]" + // Determine our character usage + var/character_usage = 86 // Base character usage + // Discord URL is needed + if (discordurl) + character_usage += length(discordurl) + // Server name is needed + if (server_name) + character_usage += length(server_name) + // We also need this stuff + character_usage += length("[players][popcaptext][SSmapping.config?.map_name || "Loading..."][server_tag]") + var/station_name_limit = 255 - character_usage + + if (station_name_limit <= 10) + // Too few characters to display the station name + if (discordurl) + if (server_name) + s += "[server_name]
" + else + s += "
" + else + if (server_name) + s += "[server_name]
" + else + s += "Space Station 13
" + if (station_name_limit < length(station_name)) + // Station name is going to be truncated with ... + if (discordurl) + if (server_name) + s += "[server_name] - [copytext(station_name, 1, station_name_limit - 3)]...
" + else + s += "[copytext(station_name, 1, station_name_limit - 3)]...
" + else + if (server_name) + s += "[server_name] - [copytext(station_name, 1, station_name_limit - 3)]...
" + else + s += "[copytext(station_name, 1, station_name_limit - 3)]...
" + else + // Station name can be displayed in full + if (discordurl) + if (server_name) + s += "[server_name] - [station_name]
" + else + s += "[station_name]
" + else + if (server_name) + s += "[server_name] - [station_name]
" + else + s += "[station_name]
" - if(length(features)) - s += ": [jointext(features, ", ")]" + if (server_tag) + s += "[server_tag]

" - s += "
Time: [gameTimestamp("hh:mm")]" - s += "
Alert: [capitalize(get_security_level())]" - s += "
Players: [players][popcaptext]" + s += "Time: [gameTimestamp("hh:mm:ss")]
" + s += "Players: [players][popcaptext]
" + s += "Map: [SSmapping.config?.map_name || "Loading..."]" status = s diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 162f719fbb8e3..9ff4dcaff230a 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -438,7 +438,6 @@ to_chat(world, "New players may now enter the game.") log_admin("[key_name(usr)] toggled new player game entering.") message_admins("[key_name_admin(usr)] toggled new player game entering.") - world.update_status() SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Toggle Entering", "[GLOB.enter_allowed ? "Enabled" : "Disabled"]")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /datum/admins/proc/toggleAI() @@ -452,7 +451,6 @@ else to_chat(world, "The AI job is chooseable now.") log_admin("[key_name(usr)] toggled AI allowed.") - world.update_status() SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Toggle AI", "[!alai ? "Disabled" : "Enabled"]")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /datum/admins/proc/toggleaban() @@ -467,7 +465,6 @@ to_chat(world, "You may no longer respawn :(") message_admins("[key_name_admin(usr)] toggled respawn to [!new_nores ? "On" : "Off"].") log_admin("[key_name(usr)] toggled respawn to [!new_nores ? "On" : "Off"].") - world.update_status() SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Toggle Respawn", "[!new_nores ? "Enabled" : "Disabled"]")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /datum/admins/proc/delay() diff --git a/code/modules/admin/battle_royale.dm b/code/modules/admin/battle_royale.dm index f41c66b940926..461686526b6fb 100644 --- a/code/modules/admin/battle_royale.dm +++ b/code/modules/admin/battle_royale.dm @@ -206,7 +206,6 @@ GLOBAL_DATUM(battle_royale, /datum/battle_royale_controller) //BR finished? Let people play as borgs/golems again ENABLE_BITFIELD(GLOB.ghost_role_flags, (GHOSTROLE_SPAWNER | GHOSTROLE_SILICONS)) - world.update_status() GLOB.battle_royale = null //Trigger random events and shit, update the world border @@ -275,7 +274,6 @@ GLOBAL_DATUM(battle_royale, /datum/battle_royale_controller) //Don't let anyone join as posibrains/golems etc DISABLE_BITFIELD(GLOB.ghost_role_flags, (GHOSTROLE_SPAWNER | GHOSTROLE_SILICONS)) - world.update_status() if(SSticker.current_state < GAME_STATE_PREGAME) to_chat(world, "Battle Royale: Waiting for server to be ready...") SSticker.start_immediately = FALSE diff --git a/config/config.txt b/config/config.txt index 20d176e33d118..cbacc4e0d3db8 100644 --- a/config/config.txt +++ b/config/config.txt @@ -32,6 +32,9 @@ $include policies.txt ## Server name: This appears at the top of the screen in-game and in the BYOND hub. Uncomment and replace 'beestation' with the name of your choice. #@SERVERNAME beestation +## Server Tagline: The tag that will appear on the HUB +@SERVERTAG Join us for a new-player friendly, classic space station 13 roleplaying experience! + ## 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 ss13newbs @@ -285,7 +288,7 @@ GITHUBURL https://www.github.com/beestation/beestation-hornet DONATEURL https://www.patreon.com/user?u=10639001 ## Discord Invite -DISCORDURL https://discord.gg/zUe34rs +DISCORDURL https://discord.gg/ss13 ## Round specific stats address ## Link to round specific parsed logs; IE statbus. It is appended with the RoundID automatically by ticker/Reboot()