Files
tbd-station-14/Content.Client/Administration/AdminVerbSystem.cs
wrexbe cea1b21832 Fixing some warnings (#6250)
Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com>
2022-01-21 10:38:35 +01:00

40 lines
1.4 KiB
C#

using Content.Shared.Verbs;
using Robust.Client.Console;
using Robust.Client.ViewVariables;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Client.Verbs
{
/// <summary>
/// Client-side admin verb system. These usually open some sort of UIs.
/// </summary>
class AdminVerbSystem : EntitySystem
{
[Dependency] private readonly IClientConGroupController _clientConGroupController = default!;
[Dependency] private readonly IClientConsoleHost _clientConsoleHost = default!;
public override void Initialize()
{
SubscribeLocalEvent<GetOtherVerbsEvent>(AddAdminVerbs);
}
private void AddAdminVerbs(GetOtherVerbsEvent args)
{
// Currently this is only the ViewVariables verb, but more admin-UI related verbs can be added here.
// View variables verbs
if (_clientConGroupController.CanViewVar())
{
Verb verb = new();
verb.Category = VerbCategory.Debug;
verb.Text = "View Variables";
verb.IconTexture = "/Textures/Interface/VerbIcons/vv.svg.192dpi.png";
verb.Act = () => _clientConsoleHost.ExecuteCommand($"vv {args.Target}");
verb.ClientExclusive = true; // opening VV window is client-side. Don't ask server to run this verb.
args.Verbs.Add(verb);
}
}
}
}