prevent opening debug menus without perms (#25091)
prevent people without permissions from opening the tile, entityspawn, or decal menus
This commit is contained in:
@@ -30,6 +30,7 @@ public sealed class SandboxUIController : UIController, IOnStateChanged<Gameplay
|
|||||||
[Dependency] private readonly IEyeManager _eye = default!;
|
[Dependency] private readonly IEyeManager _eye = default!;
|
||||||
[Dependency] private readonly IInputManager _input = default!;
|
[Dependency] private readonly IInputManager _input = default!;
|
||||||
[Dependency] private readonly ILightManager _light = default!;
|
[Dependency] private readonly ILightManager _light = default!;
|
||||||
|
[Dependency] private readonly IClientAdminManager _admin = default!;
|
||||||
|
|
||||||
[UISystemDependency] private readonly DebugPhysicsSystem _debugPhysics = default!;
|
[UISystemDependency] private readonly DebugPhysicsSystem _debugPhysics = default!;
|
||||||
[UISystemDependency] private readonly MarkerSystem _marker = default!;
|
[UISystemDependency] private readonly MarkerSystem _marker = default!;
|
||||||
@@ -53,13 +54,28 @@ public sealed class SandboxUIController : UIController, IOnStateChanged<Gameplay
|
|||||||
CheckSandboxVisibility();
|
CheckSandboxVisibility();
|
||||||
|
|
||||||
_input.SetInputCommand(ContentKeyFunctions.OpenEntitySpawnWindow,
|
_input.SetInputCommand(ContentKeyFunctions.OpenEntitySpawnWindow,
|
||||||
InputCmdHandler.FromDelegate(_ => EntitySpawningController.ToggleWindow()));
|
InputCmdHandler.FromDelegate(_ =>
|
||||||
|
{
|
||||||
|
if (!_admin.CanAdminPlace())
|
||||||
|
return;
|
||||||
|
EntitySpawningController.ToggleWindow();
|
||||||
|
}));
|
||||||
_input.SetInputCommand(ContentKeyFunctions.OpenSandboxWindow,
|
_input.SetInputCommand(ContentKeyFunctions.OpenSandboxWindow,
|
||||||
InputCmdHandler.FromDelegate(_ => ToggleWindow()));
|
InputCmdHandler.FromDelegate(_ => ToggleWindow()));
|
||||||
_input.SetInputCommand(ContentKeyFunctions.OpenTileSpawnWindow,
|
_input.SetInputCommand(ContentKeyFunctions.OpenTileSpawnWindow,
|
||||||
InputCmdHandler.FromDelegate(_ => TileSpawningController.ToggleWindow()));
|
InputCmdHandler.FromDelegate(_ =>
|
||||||
|
{
|
||||||
|
if (!_admin.CanAdminPlace())
|
||||||
|
return;
|
||||||
|
TileSpawningController.ToggleWindow();
|
||||||
|
}));
|
||||||
_input.SetInputCommand(ContentKeyFunctions.OpenDecalSpawnWindow,
|
_input.SetInputCommand(ContentKeyFunctions.OpenDecalSpawnWindow,
|
||||||
InputCmdHandler.FromDelegate(_ => DecalPlacerController.ToggleWindow()));
|
InputCmdHandler.FromDelegate(_ =>
|
||||||
|
{
|
||||||
|
if (!_admin.CanAdminPlace())
|
||||||
|
return;
|
||||||
|
DecalPlacerController.ToggleWindow();
|
||||||
|
}));
|
||||||
|
|
||||||
CommandBinds.Builder
|
CommandBinds.Builder
|
||||||
.Bind(ContentKeyFunctions.EditorCopyObject, new PointerInputCmdHandler(Copy))
|
.Bind(ContentKeyFunctions.EditorCopyObject, new PointerInputCmdHandler(Copy))
|
||||||
|
|||||||
Reference in New Issue
Block a user