From 9a0948ed37bb6321b9bd4bf1d9a94c8a3adf2ece Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Thu, 27 Jun 2024 16:58:51 +0200 Subject: [PATCH] Fix coords monitor in replays (#29512) The F3 coords manager is blocked if you're not an admin. This check happened even when playing a replay, where you actually aren't. There's now a check to make sure you are actually server-connected-to-game before running the logic. Also moved it to a manager because this *shouldn't be a bloody entity system in the first place*. (cherry picked from commit 3697509682a3d6f76bf9ea96dc9c3bf7b8739fab) --- ...gMonitorSystem.cs => DebugMonitorManager.cs} | 17 +++++++++++------ Content.Client/Entry/EntryPoint.cs | 12 ++++++++++++ Content.Client/IoC/ClientContentIoC.cs | 1 + 3 files changed, 24 insertions(+), 6 deletions(-) rename Content.Client/DebugMon/{DebugMonitorSystem.cs => DebugMonitorManager.cs} (51%) diff --git a/Content.Client/DebugMon/DebugMonitorSystem.cs b/Content.Client/DebugMon/DebugMonitorManager.cs similarity index 51% rename from Content.Client/DebugMon/DebugMonitorSystem.cs rename to Content.Client/DebugMon/DebugMonitorManager.cs index fb5cd4f51a..7e1dca0d6f 100644 --- a/Content.Client/DebugMon/DebugMonitorSystem.cs +++ b/Content.Client/DebugMon/DebugMonitorManager.cs @@ -1,23 +1,28 @@ -using Content.Client.Administration.Managers; +using Content.Client.Administration.Managers; using Content.Shared.CCVar; +using Robust.Client; using Robust.Client.UserInterface; using Robust.Shared.Configuration; - namespace Content.Client.DebugMon; /// -/// This handles preventing certain debug monitors from appearing. +/// This handles preventing certain debug monitors from being usable by non-admins. /// -public sealed class DebugMonitorSystem : EntitySystem +internal sealed class DebugMonitorManager { [Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IClientAdminManager _admin = default!; [Dependency] private readonly IUserInterfaceManager _userInterface = default!; + [Dependency] private readonly IBaseClient _baseClient = default!; - public override void FrameUpdate(float frameTime) + public void FrameUpdate() { - if (!_admin.IsActive() && _cfg.GetCVar(CCVars.DebugCoordinatesAdminOnly)) + if (_baseClient.RunLevel == ClientRunLevel.InGame + && !_admin.IsActive() + && _cfg.GetCVar(CCVars.DebugCoordinatesAdminOnly)) + { _userInterface.DebugMonitors.SetMonitor(DebugMonitor.Coords, false); + } } } diff --git a/Content.Client/Entry/EntryPoint.cs b/Content.Client/Entry/EntryPoint.cs index 05d3454f48..8907d9bd47 100644 --- a/Content.Client/Entry/EntryPoint.cs +++ b/Content.Client/Entry/EntryPoint.cs @@ -3,6 +3,7 @@ using Content.Client.Changelog; using Content.Client.Chat.Managers; using Content.Client.DiscordAuth; using Content.Client.JoinQueue; +using Content.Client.DebugMon; using Content.Client.Eui; using Content.Client.Flash; using Content.Client.Fullscreen; @@ -36,6 +37,7 @@ using Robust.Shared.Configuration; using Robust.Shared.ContentPack; using Robust.Shared.Prototypes; using Robust.Shared.Replays; +using Robust.Shared.Timing; namespace Content.Client.Entry { @@ -72,6 +74,8 @@ namespace Content.Client.Entry [Dependency] private readonly ILogManager _logManager = default!; [Dependency] private readonly JoinQueueManager _joinQueue = default!; [Dependency] private readonly DiscordAuthManager _discordAuth = default!; + [Dependency] private readonly ContentReplayPlaybackManager _replayMan = default!; + [Dependency] private readonly DebugMonitorManager _debugMonitorManager = default!; public override void Init() { @@ -213,5 +217,13 @@ namespace Content.Client.Entry _stateManager.RequestStateChange(); } } + + public override void Update(ModUpdateLevel level, FrameEventArgs frameEventArgs) + { + if (level == ModUpdateLevel.FramePreEngine) + { + _debugMonitorManager.FrameUpdate(); + } + } } } diff --git a/Content.Client/IoC/ClientContentIoC.cs b/Content.Client/IoC/ClientContentIoC.cs index 0107e90495..41d2ff33e4 100644 --- a/Content.Client/IoC/ClientContentIoC.cs +++ b/Content.Client/IoC/ClientContentIoC.cs @@ -5,6 +5,7 @@ using Content.Client.Clickable; using Content.Client.DeltaV.NanoChat; using Content.Client.DiscordAuth; using Content.Client.JoinQueue; +using Content.Client.DebugMon; using Content.Client.Eui; using Content.Client.Fullscreen; using Content.Client.GhostKick;