]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix not showing ahelp relay label to players (#15327)
authorDrSmugleaf <DrSmugleaf@users.noreply.github.com>
Wed, 12 Apr 2023 00:19:09 +0000 (17:19 -0700)
committerGitHub <noreply@github.com>
Wed, 12 Apr 2023 00:19:09 +0000 (10:19 +1000)
Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs
Content.Server/Administration/Systems/BwoinkSystem.cs
Content.Shared/Administration/SharedBwoinkSystem.cs

index 871708a711243160cd5b02305caadc29cf962fc4..ee2f082a1c260351fee3a7b826094c083fbc8f7a 100644 (file)
@@ -39,7 +39,7 @@ public sealed class AHelpUIController: UIController, IOnStateChanged<GameplaySta
     {
         base.Initialize();
 
-        SubscribeNetworkEvent<SharedBwoinkSystem.BwoinkDiscordRelayUpdated>(DiscordRelayUpdated);
+        SubscribeNetworkEvent<BwoinkDiscordRelayUpdated>(DiscordRelayUpdated);
     }
 
     public void OnStateEntered(GameplayState state)
@@ -137,7 +137,7 @@ public sealed class AHelpUIController: UIController, IOnStateChanged<GameplaySta
         UIHelper!.Receive(message);
     }
 
-    private void DiscordRelayUpdated(SharedBwoinkSystem.BwoinkDiscordRelayUpdated args, EntitySessionEventArgs session)
+    private void DiscordRelayUpdated(BwoinkDiscordRelayUpdated args, EntitySessionEventArgs session)
     {
         _discordRelayActive = args.DiscordRelayEnabled;
         UIHelper?.DiscordRelayChanged(_discordRelayActive);
index 2cc3d2d3c76ad3be5167d4af377db44d254fc12c..822fbf18f19d88dd1ccff75befde07220fd636b7 100644 (file)
@@ -15,6 +15,7 @@ using JetBrains.Annotations;
 using Robust.Server.Player;
 using Robust.Shared;
 using Robust.Shared.Configuration;
+using Robust.Shared.Enums;
 using Robust.Shared.Network;
 using Robust.Shared.Utility;
 
@@ -63,10 +64,19 @@ namespace Content.Server.Administration.Systems
             _config.OnValueChanged(CVars.GameHostName, OnServerNameChanged, true);
             _sawmill = IoCManager.Resolve<ILogManager>().GetSawmill("AHELP");
             _maxAdditionalChars = GenerateAHelpMessage("", "", true).Length;
+            _playerManager.PlayerStatusChanged += OnPlayerStatusChanged;
 
             SubscribeLocalEvent<GameRunLevelChangedEvent>(OnGameRunLevelChanged);
         }
 
+        private void OnPlayerStatusChanged(object? sender, SessionStatusEventArgs e)
+        {
+            if (e.NewStatus != SessionStatus.InGame)
+                return;
+
+            RaiseNetworkEvent(new BwoinkDiscordRelayUpdated(!string.IsNullOrWhiteSpace(_webhookUrl)), e.Session);
+        }
+
         private void OnGameRunLevelChanged(GameRunLevelChangedEvent args)
         {
             // Don't make a new embed if we
index 597d2c0a6cdc3d0cf50b8088d1e25a4d58c3890a..d8d719857ac5a908db9c27677e5706347d310d71 100644 (file)
@@ -46,20 +46,20 @@ namespace Content.Shared.Administration
                 Text = text;
             }
         }
+    }
 
-        /// <summary>
-        ///     Sent by the server to notify all clients when the webhook url is sent.
-        ///     The webhook url itself is not and should not be sent.
-        /// </summary>
-        [Serializable, NetSerializable]
-        public sealed class BwoinkDiscordRelayUpdated : EntityEventArgs
-        {
-            public bool DiscordRelayEnabled { get; }
+    /// <summary>
+    ///     Sent by the server to notify all clients when the webhook url is sent.
+    ///     The webhook url itself is not and should not be sent.
+    /// </summary>
+    [Serializable, NetSerializable]
+    public sealed class BwoinkDiscordRelayUpdated : EntityEventArgs
+    {
+        public bool DiscordRelayEnabled { get; }
 
-            public BwoinkDiscordRelayUpdated(bool enabled)
-            {
-                DiscordRelayEnabled = enabled;
-            }
+        public BwoinkDiscordRelayUpdated(bool enabled)
+        {
+            DiscordRelayEnabled = enabled;
         }
     }
 }