]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix coords monitor in replays (#29512)
authorPieter-Jan Briers <pieterjan.briers+git@gmail.com>
Thu, 27 Jun 2024 14:58:51 +0000 (16:58 +0200)
committerGitHub <noreply@github.com>
Thu, 27 Jun 2024 14:58:51 +0000 (16:58 +0200)
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*.

Content.Client/DebugMon/DebugMonitorManager.cs [moved from Content.Client/DebugMon/DebugMonitorSystem.cs with 51% similarity]
Content.Client/Entry/EntryPoint.cs
Content.Client/IoC/ClientContentIoC.cs

similarity index 51%
rename from Content.Client/DebugMon/DebugMonitorSystem.cs
rename to Content.Client/DebugMon/DebugMonitorManager.cs
index fb5cd4f51a4a3c1ecee5663d9af3b0e999e5f92b..7e1dca0d6f0342a5db23762337ab5bf2a889976d 100644 (file)
@@ -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;
 
 /// <summary>
-/// This handles preventing certain debug monitors from appearing.
+/// This handles preventing certain debug monitors from being usable by non-admins.
 /// </summary>
-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);
+        }
     }
 }
index dd7e781f0bb4448f0ebf3b5e3754e032894739fd..6caefb9a7e95185c9d03331f244f3cb6cc1de57d 100644 (file)
@@ -1,6 +1,7 @@
 using Content.Client.Administration.Managers;
 using Content.Client.Changelog;
 using Content.Client.Chat.Managers;
+using Content.Client.DebugMon;
 using Content.Client.Eui;
 using Content.Client.Fullscreen;
 using Content.Client.GhostKick;
@@ -33,6 +34,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
 {
@@ -68,6 +70,7 @@ namespace Content.Client.Entry
         [Dependency] private readonly IReplayLoadManager _replayLoad = default!;
         [Dependency] private readonly ILogManager _logManager = default!;
         [Dependency] private readonly ContentReplayPlaybackManager _replayMan = default!;
+        [Dependency] private readonly DebugMonitorManager _debugMonitorManager = default!;
 
         public override void Init()
         {
@@ -205,5 +208,13 @@ namespace Content.Client.Entry
                 _stateManager.RequestStateChange<MainScreen>();
             }
         }
+
+        public override void Update(ModUpdateLevel level, FrameEventArgs frameEventArgs)
+        {
+            if (level == ModUpdateLevel.FramePreEngine)
+            {
+                _debugMonitorManager.FrameUpdate();
+            }
+        }
     }
 }
index d1c595ae9b7c9a44859fd06a9e52e7ed44930c3f..328cf41d0d4f74f2972375cb152369d6ba843720 100644 (file)
@@ -2,6 +2,7 @@ using Content.Client.Administration.Managers;
 using Content.Client.Changelog;
 using Content.Client.Chat.Managers;
 using Content.Client.Clickable;
+using Content.Client.DebugMon;
 using Content.Client.Eui;
 using Content.Client.GhostKick;
 using Content.Client.Launcher;
@@ -48,6 +49,7 @@ namespace Content.Client.IoC
             collection.Register<DocumentParsingManager>();
             collection.Register<ContentReplayPlaybackManager, ContentReplayPlaybackManager>();
             collection.Register<ISharedPlaytimeManager, JobRequirementsManager>();
+            collection.Register<DebugMonitorManager>();
         }
     }
 }