prevent opening debug menus without perms (#25091)

prevent people without permissions from opening the tile, entityspawn, or decal menus
This commit is contained in:
Nemanja
2024-02-10 03:00:52 -05:00
committed by GitHub
parent 0a6eab23e5
commit 2293f46bca

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