Add context menu to AdminMenu PlayerTab entries (#5904)

* XAML PlayerTab entries

* Move command execution to PlayerTab

* Move command logic to the AdminSystem

* Clean up

* Add examine and context menu keybind handling to PlayerTab

* Fix remote admin verbs

* Remove examine for now

* Add server verbs

* Fix requests of verb by non-admins

* Clean up AdminSystem.Menu
This commit is contained in:
ShadowCommander
2021-12-30 14:11:30 -08:00
committed by GitHub
parent a28dba915f
commit dc1ca30f7c
8 changed files with 38 additions and 11 deletions

View File

@@ -3,6 +3,7 @@ using Content.Client.Administration.Managers;
using Content.Client.Administration.UI;
using Content.Client.Administration.UI.Tabs.PlayerTab;
using Content.Client.HUD;
using Content.Client.Verbs;
using Content.Shared.Input;
using Robust.Client.Console;
using Robust.Client.Graphics;
@@ -11,6 +12,7 @@ using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.IoC;
using Robust.Shared.Network;
@@ -30,6 +32,8 @@ namespace Content.Client.Administration
[Dependency] private readonly IEntityLookup _entityLookup = default!;
[Dependency] private readonly IClientConsoleHost _clientConsoleHost = default!;
[Dependency] private readonly VerbSystem _verbSystem = default!;
private AdminMenuWindow? _window;
private readonly List<BaseWindow> _commandWindows = new();
@@ -142,7 +146,17 @@ namespace Content.Client.Administration
|| button.PlayerUid == null)
return;
_clientConsoleHost.ExecuteCommand($"vv {button.PlayerUid}");
var uid = button.PlayerUid.Value;
var function = args.Event.Function;
if (function == EngineKeyFunctions.UIClick)
_clientConsoleHost.ExecuteCommand($"vv {uid}");
else if (function == ContentKeyFunctions.OpenContextMenu)
_verbSystem.VerbMenu.OpenVerbMenu(uid, true);
else
return;
args.Event.Handle();
}
}
}