]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Lobby chat width and custom lobby titles (#33783)
authorErrant <35878406+Errant-4@users.noreply.github.com>
Sun, 5 Jan 2025 20:56:01 +0000 (21:56 +0100)
committerGitHub <noreply@github.com>
Sun, 5 Jan 2025 20:56:01 +0000 (21:56 +0100)
* lobby name cvar

* panel width

* skrek

* server name localization fix

* comment format fix

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>
* remove redundant newline

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>
* string.empty

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>
* use SetWidth

* Update Resources/Locale/en-US/lobby/lobby-gui.ftl

---------

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Content.Client/Lobby/LobbyState.cs
Content.Client/Lobby/UI/LobbyGui.xaml
Content.Shared/CCVar/CCVars.Server.cs
Resources/Locale/en-US/lobby/lobby-gui.ftl

index 1361ca57cd282cd92519714d540a252f9cb6c806..4677245509e496086eb179e6f36565dbc6b54e80 100644 (file)
@@ -5,19 +5,21 @@ using Content.Client.Lobby.UI;
 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;
 
-
 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 +51,17 @@ namespace Content.Client.Lobby
 
             _voteManager.SetPopupContainer(Lobby.VoteContainer);
             LayoutContainer.SetAnchorPreset(Lobby, LayoutContainer.LayoutPreset.Wide);
-            Lobby.ServerName.Text = _baseClient.GameInfo?.ServerName; //The eye of refactor gazes upon you...
+
+            var lobbyNameCvar = _cfg.GetCVar(CCVars.ServerLobbyName);
+            var serverName = _baseClient.GameInfo?.ServerName ?? string.Empty;
+
+            Lobby.ServerName.Text = string.IsNullOrEmpty(lobbyNameCvar)
+                ? Loc.GetString("ui-lobby-title", ("serverName", serverName))
+                : lobbyNameCvar;
+
+            var width = _cfg.GetCVar(CCVars.ServerLobbyRightPanelWidth);
+            Lobby.RightSide.SetWidth = width;
+
             UpdateLobbyUi();
 
             Lobby.CharacterPreview.CharacterSetupButton.OnPressed += OnSetupPressed;
index 4a158fd811f15ec7ed60c3a00c5d9239c303779f..615d8cb2711802e0f38d6847ffae2ee16fd9fb39 100644 (file)
                 <Control Access="Public" Visible="False" Name="CharacterSetupState" VerticalExpand="True" />
             </BoxContainer>
             <!-- Right Panel -->
-            <PanelContainer Name="RightSide" StyleClasses="AngleRect" HorizontalAlignment="Right" VerticalExpand="True"
+            <PanelContainer Name="RightSide" Access="Public" StyleClasses="AngleRect" HorizontalAlignment="Right" VerticalExpand="True"
                             VerticalAlignment="Stretch">
                 <BoxContainer Orientation="Vertical" HorizontalExpand="True">
                     <!-- Top row -->
                     <BoxContainer Orientation="Horizontal" MinSize="0 40" Name="HeaderContainer" Access="Public"
                                   SeparationOverride="4">
-                        <Label Margin="8 0 0 0" StyleClasses="LabelHeadingBigger" VAlign="Center"
-                               Text="{Loc 'ui-lobby-title'}" />
                         <Label Name="ServerName" Access="Public" StyleClasses="LabelHeadingBigger" VAlign="Center"
                                HorizontalExpand="True" HorizontalAlignment="Center" />
                     </BoxContainer>
index 2c861584afc9f82f4a9b3061747f9015564fdb54..88e7b251ba071f7af441c8f28a4a4f6a5503873e 100644 (file)
@@ -40,4 +40,17 @@ public sealed partial class CCVars
     /// </remarks>
     public static readonly CVarDef<int> ServerUptimeRestartMinutes =
         CVarDef.Create("server.uptime_restart_minutes", 0, CVar.SERVERONLY);
+
+    /// <summary>
+    ///     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
+    /// </summary>
+    public static readonly CVarDef<string> ServerLobbyName =
+        CVarDef.Create("server.lobby_name", "", CVar.REPLICATED | CVar.SERVER);
+
+    /// <summary>
+    ///     The width of the right side (chat) panel in the lobby
+    /// </summary>
+    public static readonly CVarDef<int> ServerLobbyRightPanelWidth =
+        CVarDef.Create("server.lobby_right_panel_width", 650, CVar.REPLICATED | CVar.SERVER);
 }
index e7f131e93b020031a38fdef7a74bb5c6ad1b63be..14cc85a5a9997cccea98dd7f20ffc6031389234f 100644 (file)
@@ -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