]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
prevent opening debug menus without perms (#25091)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Sat, 10 Feb 2024 08:00:52 +0000 (03:00 -0500)
committerGitHub <noreply@github.com>
Sat, 10 Feb 2024 08:00:52 +0000 (19:00 +1100)
prevent people without permissions from opening the tile, entityspawn, or decal menus

Content.Client/UserInterface/Systems/Sandbox/SandboxUIController.cs

index 3ab36a9166a3eef69b6742bf52f1ed6f68679684..752c89ca9705bd913459158b4228acd4d61c5f02 100644 (file)
@@ -30,6 +30,7 @@ public sealed class SandboxUIController : UIController, IOnStateChanged<Gameplay
     [Dependency] private readonly IEyeManager _eye = default!;
     [Dependency] private readonly IInputManager _input = default!;
     [Dependency] private readonly ILightManager _light = default!;
+    [Dependency] private readonly IClientAdminManager _admin = default!;
 
     [UISystemDependency] private readonly DebugPhysicsSystem _debugPhysics = default!;
     [UISystemDependency] private readonly MarkerSystem _marker = default!;
@@ -53,13 +54,28 @@ public sealed class SandboxUIController : UIController, IOnStateChanged<Gameplay
         CheckSandboxVisibility();
 
         _input.SetInputCommand(ContentKeyFunctions.OpenEntitySpawnWindow,
-            InputCmdHandler.FromDelegate(_ => EntitySpawningController.ToggleWindow()));
+            InputCmdHandler.FromDelegate(_ =>
+            {
+                if (!_admin.CanAdminPlace())
+                    return;
+                EntitySpawningController.ToggleWindow();
+            }));
         _input.SetInputCommand(ContentKeyFunctions.OpenSandboxWindow,
             InputCmdHandler.FromDelegate(_ => ToggleWindow()));
         _input.SetInputCommand(ContentKeyFunctions.OpenTileSpawnWindow,
-            InputCmdHandler.FromDelegate(_ => TileSpawningController.ToggleWindow()));
+            InputCmdHandler.FromDelegate(_ =>
+            {
+                if (!_admin.CanAdminPlace())
+                    return;
+                TileSpawningController.ToggleWindow();
+            }));
         _input.SetInputCommand(ContentKeyFunctions.OpenDecalSpawnWindow,
-            InputCmdHandler.FromDelegate(_ => DecalPlacerController.ToggleWindow()));
+            InputCmdHandler.FromDelegate(_ =>
+            {
+                if (!_admin.CanAdminPlace())
+                    return;
+                DecalPlacerController.ToggleWindow();
+            }));
 
         CommandBinds.Builder
             .Bind(ContentKeyFunctions.EditorCopyObject, new PointerInputCmdHandler(Copy))