using Content.Shared.Verbs; using Robust.Client.Console; using Robust.Client.ViewVariables; using Robust.Shared.GameObjects; using Robust.Shared.IoC; namespace Content.Client.Verbs { /// /// Client-side admin verb system. These usually open some sort of UIs. /// sealed class AdminVerbSystem : EntitySystem { [Dependency] private readonly IClientConGroupController _clientConGroupController = default!; [Dependency] private readonly IClientConsoleHost _clientConsoleHost = default!; public override void Initialize() { SubscribeLocalEvent>(AddAdminVerbs); } private void AddAdminVerbs(GetVerbsEvent 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); } } } }