From c83c0495c2859d826302593b10469a17c26dd95e Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Wed, 4 Dec 2024 20:19:38 +0100 Subject: [PATCH 1/9] lobby name cvar --- Content.Client/Lobby/LobbyState.cs | 10 +++++++++- Content.Client/Lobby/UI/LobbyGui.xaml | 2 -- Content.Shared/CCVar/CCVars.Server.cs | 7 +++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Content.Client/Lobby/LobbyState.cs b/Content.Client/Lobby/LobbyState.cs index 1361ca57cd28..9ff3e3d57c82 100644 --- a/Content.Client/Lobby/LobbyState.cs +++ b/Content.Client/Lobby/LobbyState.cs @@ -5,11 +5,13 @@ using Content.Client.Message; using Content.Client.UserInterface.Systems.Chat; using Content.Client.Voting; +using Content.Shared.CCVar; using Robust.Client; using Robust.Client.Console; using Robust.Client.ResourceManagement; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; +using Robust.Shared.Configuration; using Robust.Shared.Timing; @@ -18,6 +20,7 @@ namespace Content.Client.Lobby public sealed class LobbyState : Robust.Client.State.State { [Dependency] private readonly IBaseClient _baseClient = default!; + [Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IClientConsoleHost _consoleHost = default!; [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IResourceCache _resourceCache = default!; @@ -49,7 +52,12 @@ protected override void Startup() _voteManager.SetPopupContainer(Lobby.VoteContainer); LayoutContainer.SetAnchorPreset(Lobby, LayoutContainer.LayoutPreset.Wide); - Lobby.ServerName.Text = _baseClient.GameInfo?.ServerName; //The eye of refactor gazes upon you... + + var serverLobbyName = _cfg.GetCVar(CCVars.ServerLobbyName); + Lobby.ServerName.Text = string.IsNullOrEmpty(serverLobbyName) + ? Loc.GetString("ui-lobby-title") + " " + _baseClient.GameInfo?.ServerName + : serverLobbyName; + UpdateLobbyUi(); Lobby.CharacterPreview.CharacterSetupButton.OnPressed += OnSetupPressed; diff --git a/Content.Client/Lobby/UI/LobbyGui.xaml b/Content.Client/Lobby/UI/LobbyGui.xaml index 4a158fd811f1..29681130da1a 100644 --- a/Content.Client/Lobby/UI/LobbyGui.xaml +++ b/Content.Client/Lobby/UI/LobbyGui.xaml @@ -68,8 +68,6 @@ - diff --git a/Content.Shared/CCVar/CCVars.Server.cs b/Content.Shared/CCVar/CCVars.Server.cs index 2c861584afc9..3e370289d935 100644 --- a/Content.Shared/CCVar/CCVars.Server.cs +++ b/Content.Shared/CCVar/CCVars.Server.cs @@ -40,4 +40,11 @@ public sealed partial class CCVars /// public static readonly CVarDef ServerUptimeRestartMinutes = CVarDef.Create("server.uptime_restart_minutes", 0, CVar.SERVERONLY); + + /// + /// This will be the title shown in the lobby + /// If empty, the title will be {ui-lobby-title} + the server's full name from the hub + /// + public static readonly CVarDef ServerLobbyName = + CVarDef.Create("server.lobby_name", "", CVar.REPLICATED | CVar.SERVER); } From b069a84c6a694e19b721ae2234aed8d530eaeebe Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Sun, 8 Dec 2024 13:44:40 +0100 Subject: [PATCH 2/9] panel width --- Content.Client/Lobby/LobbyState.cs | 10 +++++++--- Content.Client/Lobby/UI/LobbyGui.xaml | 2 +- Content.Shared/CCVar/CCVars.Interface.cs | 6 ++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Content.Client/Lobby/LobbyState.cs b/Content.Client/Lobby/LobbyState.cs index 9ff3e3d57c82..41d5e42f9dd6 100644 --- a/Content.Client/Lobby/LobbyState.cs +++ b/Content.Client/Lobby/LobbyState.cs @@ -53,10 +53,14 @@ protected override void Startup() _voteManager.SetPopupContainer(Lobby.VoteContainer); LayoutContainer.SetAnchorPreset(Lobby, LayoutContainer.LayoutPreset.Wide); - var serverLobbyName = _cfg.GetCVar(CCVars.ServerLobbyName); - Lobby.ServerName.Text = string.IsNullOrEmpty(serverLobbyName) + var lobbyNameCvar = _cfg.GetCVar(CCVars.ServerLobbyName); + Lobby.ServerName.Text = string.IsNullOrEmpty(lobbyNameCvar) ? Loc.GetString("ui-lobby-title") + " " + _baseClient.GameInfo?.ServerName - : serverLobbyName; + : lobbyNameCvar; + + var width = _cfg.GetCVar(CCVars.ServerLobbyRightPanelWidth); + Lobby.RightSide.MinWidth = width; + Lobby.RightSide.MaxWidth = width; UpdateLobbyUi(); diff --git a/Content.Client/Lobby/UI/LobbyGui.xaml b/Content.Client/Lobby/UI/LobbyGui.xaml index 29681130da1a..615d8cb27118 100644 --- a/Content.Client/Lobby/UI/LobbyGui.xaml +++ b/Content.Client/Lobby/UI/LobbyGui.xaml @@ -62,7 +62,7 @@ - diff --git a/Content.Shared/CCVar/CCVars.Interface.cs b/Content.Shared/CCVar/CCVars.Interface.cs index 79a28e6b4e6a..3ba304f385d4 100644 --- a/Content.Shared/CCVar/CCVars.Interface.cs +++ b/Content.Shared/CCVar/CCVars.Interface.cs @@ -21,4 +21,10 @@ public sealed partial class CCVars public static readonly CVarDef OutlineEnabled = CVarDef.Create("outline.enabled", true, CVar.CLIENTONLY); + + // + // The width of the right side (chat) panel in the lobby + // + public static readonly CVarDef ServerLobbyRightPanelWidth = + CVarDef.Create("server.lobby_right_panel_width", 650, CVar.REPLICATED | CVar.SERVER); } From daa432d32d07baf487d8298cfe980a06bac0838b Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Sun, 8 Dec 2024 15:37:46 +0100 Subject: [PATCH 3/9] skrek --- Content.Shared/CCVar/CCVars.Interface.cs | 6 ------ Content.Shared/CCVar/CCVars.Server.cs | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Content.Shared/CCVar/CCVars.Interface.cs b/Content.Shared/CCVar/CCVars.Interface.cs index 3ba304f385d4..79a28e6b4e6a 100644 --- a/Content.Shared/CCVar/CCVars.Interface.cs +++ b/Content.Shared/CCVar/CCVars.Interface.cs @@ -21,10 +21,4 @@ public sealed partial class CCVars public static readonly CVarDef OutlineEnabled = CVarDef.Create("outline.enabled", true, CVar.CLIENTONLY); - - // - // The width of the right side (chat) panel in the lobby - // - public static readonly CVarDef ServerLobbyRightPanelWidth = - CVarDef.Create("server.lobby_right_panel_width", 650, CVar.REPLICATED | CVar.SERVER); } diff --git a/Content.Shared/CCVar/CCVars.Server.cs b/Content.Shared/CCVar/CCVars.Server.cs index 3e370289d935..7cbd39188bbf 100644 --- a/Content.Shared/CCVar/CCVars.Server.cs +++ b/Content.Shared/CCVar/CCVars.Server.cs @@ -47,4 +47,10 @@ public sealed partial class CCVars /// public static readonly CVarDef ServerLobbyName = CVarDef.Create("server.lobby_name", "", CVar.REPLICATED | CVar.SERVER); + + // + // The width of the right side (chat) panel in the lobby + // + public static readonly CVarDef ServerLobbyRightPanelWidth = + CVarDef.Create("server.lobby_right_panel_width", 650, CVar.REPLICATED | CVar.SERVER); } From 3fe52fab9b14a7b9230fedaf732befccbd9f3781 Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Sun, 8 Dec 2024 21:05:03 +0100 Subject: [PATCH 4/9] server name localization fix --- Content.Client/Lobby/LobbyState.cs | 4 +++- Resources/Locale/en-US/lobby/lobby-gui.ftl | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Content.Client/Lobby/LobbyState.cs b/Content.Client/Lobby/LobbyState.cs index 41d5e42f9dd6..8c4bfc366bf9 100644 --- a/Content.Client/Lobby/LobbyState.cs +++ b/Content.Client/Lobby/LobbyState.cs @@ -54,8 +54,10 @@ protected override void Startup() LayoutContainer.SetAnchorPreset(Lobby, LayoutContainer.LayoutPreset.Wide); var lobbyNameCvar = _cfg.GetCVar(CCVars.ServerLobbyName); + var serverName = _baseClient.GameInfo?.ServerName ?? ""; + Lobby.ServerName.Text = string.IsNullOrEmpty(lobbyNameCvar) - ? Loc.GetString("ui-lobby-title") + " " + _baseClient.GameInfo?.ServerName + ? Loc.GetString("ui-lobby-title", ("serverName", serverName)) : lobbyNameCvar; var width = _cfg.GetCVar(CCVars.ServerLobbyRightPanelWidth); diff --git a/Resources/Locale/en-US/lobby/lobby-gui.ftl b/Resources/Locale/en-US/lobby/lobby-gui.ftl index e7f131e93b02..5575c6d53903 100644 --- a/Resources/Locale/en-US/lobby/lobby-gui.ftl +++ b/Resources/Locale/en-US/lobby/lobby-gui.ftl @@ -1,4 +1,4 @@ -ui-lobby-title = Lobby +ui-lobby-title = Lobby {$serverName} ui-lobby-ahelp-button = AHelp ui-lobby-options-button = Options ui-lobby-leave-button = Leave From 3d1cbe05083e058ed9e4c61b957764ff2e651a7d Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Sun, 15 Dec 2024 10:13:48 +0100 Subject: [PATCH 5/9] comment format fix Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com> --- Content.Shared/CCVar/CCVars.Server.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Content.Shared/CCVar/CCVars.Server.cs b/Content.Shared/CCVar/CCVars.Server.cs index 7cbd39188bbf..88e7b251ba07 100644 --- a/Content.Shared/CCVar/CCVars.Server.cs +++ b/Content.Shared/CCVar/CCVars.Server.cs @@ -48,9 +48,9 @@ public sealed partial class CCVars public static readonly CVarDef ServerLobbyName = CVarDef.Create("server.lobby_name", "", CVar.REPLICATED | CVar.SERVER); - // - // The width of the right side (chat) panel in the lobby - // + /// + /// The width of the right side (chat) panel in the lobby + /// public static readonly CVarDef ServerLobbyRightPanelWidth = CVarDef.Create("server.lobby_right_panel_width", 650, CVar.REPLICATED | CVar.SERVER); } From 145b6898a205d4ae3d160de3c76ef7458ec54258 Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Wed, 25 Dec 2024 22:36:46 +0100 Subject: [PATCH 6/9] remove redundant newline Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com> --- Content.Client/Lobby/LobbyState.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Content.Client/Lobby/LobbyState.cs b/Content.Client/Lobby/LobbyState.cs index 8c4bfc366bf9..bfe685131992 100644 --- a/Content.Client/Lobby/LobbyState.cs +++ b/Content.Client/Lobby/LobbyState.cs @@ -14,7 +14,6 @@ using Robust.Shared.Configuration; using Robust.Shared.Timing; - namespace Content.Client.Lobby { public sealed class LobbyState : Robust.Client.State.State From 7e9683da815fbe365b44395a38adccd4eed3938d Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Wed, 25 Dec 2024 22:38:43 +0100 Subject: [PATCH 7/9] string.empty Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com> --- Content.Client/Lobby/LobbyState.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Client/Lobby/LobbyState.cs b/Content.Client/Lobby/LobbyState.cs index bfe685131992..f9a852291e47 100644 --- a/Content.Client/Lobby/LobbyState.cs +++ b/Content.Client/Lobby/LobbyState.cs @@ -53,7 +53,7 @@ protected override void Startup() LayoutContainer.SetAnchorPreset(Lobby, LayoutContainer.LayoutPreset.Wide); var lobbyNameCvar = _cfg.GetCVar(CCVars.ServerLobbyName); - var serverName = _baseClient.GameInfo?.ServerName ?? ""; + var serverName = _baseClient.GameInfo?.ServerName ?? string.Empty; Lobby.ServerName.Text = string.IsNullOrEmpty(lobbyNameCvar) ? Loc.GetString("ui-lobby-title", ("serverName", serverName)) From 88b7e1a5f55bfe5b1a03a44b254868db567a2089 Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Wed, 25 Dec 2024 23:01:23 +0100 Subject: [PATCH 8/9] use SetWidth --- Content.Client/Lobby/LobbyState.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Content.Client/Lobby/LobbyState.cs b/Content.Client/Lobby/LobbyState.cs index f9a852291e47..4677245509e4 100644 --- a/Content.Client/Lobby/LobbyState.cs +++ b/Content.Client/Lobby/LobbyState.cs @@ -60,8 +60,7 @@ protected override void Startup() : lobbyNameCvar; var width = _cfg.GetCVar(CCVars.ServerLobbyRightPanelWidth); - Lobby.RightSide.MinWidth = width; - Lobby.RightSide.MaxWidth = width; + Lobby.RightSide.SetWidth = width; UpdateLobbyUi(); From dd49df3fa5019d8331e9c96d384265271e424611 Mon Sep 17 00:00:00 2001 From: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Date: Sun, 5 Jan 2025 21:55:03 +0100 Subject: [PATCH 9/9] Update Resources/Locale/en-US/lobby/lobby-gui.ftl --- Resources/Locale/en-US/lobby/lobby-gui.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Locale/en-US/lobby/lobby-gui.ftl b/Resources/Locale/en-US/lobby/lobby-gui.ftl index 5575c6d53903..14cc85a5a999 100644 --- a/Resources/Locale/en-US/lobby/lobby-gui.ftl +++ b/Resources/Locale/en-US/lobby/lobby-gui.ftl @@ -1,4 +1,4 @@ -ui-lobby-title = Lobby {$serverName} +ui-lobby-title = Lobby: {$serverName} ui-lobby-ahelp-button = AHelp ui-lobby-options-button = Options ui-lobby-leave-button = Leave