Fix not showing ahelp relay label to players (#15327)

This commit is contained in:
DrSmugleaf
2023-04-11 17:19:09 -07:00
committed by GitHub
parent 21378f6e41
commit c25d7ba7bd
3 changed files with 24 additions and 14 deletions

View 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);

View 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

View 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
/// <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)
{
public bool DiscordRelayEnabled { get; }
public BwoinkDiscordRelayUpdated(bool enabled)
{
DiscordRelayEnabled = enabled;
}
DiscordRelayEnabled = enabled;
}
}
}