From c25d7ba7bdef84b27c60d3ef138a970a12048bf8 Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Tue, 11 Apr 2023 17:19:09 -0700 Subject: [PATCH] Fix not showing ahelp relay label to players (#15327) --- .../Systems/Bwoink/AHelpUIController.cs | 4 ++-- .../Administration/Systems/BwoinkSystem.cs | 10 ++++++++ .../Administration/SharedBwoinkSystem.cs | 24 +++++++++---------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs index 871708a711..ee2f082a1c 100644 --- a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs +++ b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs @@ -39,7 +39,7 @@ public sealed class AHelpUIController: UIController, IOnStateChanged(DiscordRelayUpdated); + SubscribeNetworkEvent(DiscordRelayUpdated); } public void OnStateEntered(GameplayState state) @@ -137,7 +137,7 @@ public sealed class AHelpUIController: UIController, IOnStateChanged().GetSawmill("AHELP"); _maxAdditionalChars = GenerateAHelpMessage("", "", true).Length; + _playerManager.PlayerStatusChanged += OnPlayerStatusChanged; SubscribeLocalEvent(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 diff --git a/Content.Shared/Administration/SharedBwoinkSystem.cs b/Content.Shared/Administration/SharedBwoinkSystem.cs index 597d2c0a6c..d8d719857a 100644 --- a/Content.Shared/Administration/SharedBwoinkSystem.cs +++ b/Content.Shared/Administration/SharedBwoinkSystem.cs @@ -46,20 +46,20 @@ namespace Content.Shared.Administration Text = text; } } + } - /// - /// 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. - /// - [Serializable, NetSerializable] - public sealed class BwoinkDiscordRelayUpdated : EntityEventArgs - { - public bool DiscordRelayEnabled { get; } + /// + /// 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. + /// + [Serializable, NetSerializable] + public sealed class BwoinkDiscordRelayUpdated : EntityEventArgs + { + public bool DiscordRelayEnabled { get; } - public BwoinkDiscordRelayUpdated(bool enabled) - { - DiscordRelayEnabled = enabled; - } + public BwoinkDiscordRelayUpdated(bool enabled) + { + DiscordRelayEnabled = enabled; } } } -- 2.51.2