diff --git a/Content.Client/DebugMon/DebugMonitorSystem.cs b/Content.Client/DebugMon/DebugMonitorSystem.cs new file mode 100644 index 0000000000..c64e111b65 --- /dev/null +++ b/Content.Client/DebugMon/DebugMonitorSystem.cs @@ -0,0 +1,25 @@ +using Content.Client.Administration.Managers; +using Content.Shared.CCVar; +using Robust.Client.UserInterface; +using Robust.Shared.Configuration; + + +namespace Content.Client.DebugMon; + +/// +/// This handles preventing certain debug monitors from appearing. +/// +public sealed class DebugMonitorSystem : EntitySystem +{ + [Dependency] private readonly IConfigurationManager _cfg = default!; + [Dependency] private readonly IClientAdminManager _admin = default!; + [Dependency] private readonly IUserInterfaceManager _userInterface = default!; + + public override void FrameUpdate(float frameTime) + { + if (!_admin.IsActive() && _cfg.GetCVar(CCVars.DebugCoordinatesAdminOnly)) + _userInterface.DebugMonitors.SetMonitor(DebugMonitor.Coords, false); + else + _userInterface.DebugMonitors.SetMonitor(DebugMonitor.Coords, true); + } +} \ No newline at end of file diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index b8b46daf6f..31fe466eec 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -285,6 +285,12 @@ namespace Content.Shared.CCVar public static readonly CVarDef LocalStatusIconsEnabled = CVarDef.Create("game.local_status_icons_enabled", true, CVar.CLIENTONLY); + /// + /// Whether or not coordinates on the Debug overlay should only be available to admins. + /// + public static readonly CVarDef DebugCoordinatesAdminOnly = + CVarDef.Create("game.debug_coordinates_admin_only", false, CVar.SERVER | CVar.REPLICATED); + #if EXCEPTION_TOLERANCE /// /// Amount of times round start must fail before the server is shut down.