diff --git a/Content.Client/Administration/AdminVerbSystem.cs b/Content.Client/Administration/AdminVerbSystem.cs index 6e8998cd7a..e8dc2f5589 100644 --- a/Content.Client/Administration/AdminVerbSystem.cs +++ b/Content.Client/Administration/AdminVerbSystem.cs @@ -16,10 +16,10 @@ namespace Content.Client.Verbs public override void Initialize() { - SubscribeLocalEvent(AddAdminVerbs); + SubscribeLocalEvent>(AddAdminVerbs); } - private void AddAdminVerbs(GetOtherVerbsEvent args) + private void AddAdminVerbs(GetVerbsEvent args) { // Currently this is only the ViewVariables verb, but more admin-UI related verbs can be added here. diff --git a/Content.Client/Examine/ExamineSystem.cs b/Content.Client/Examine/ExamineSystem.cs index a85ea488ba..e9201cebe0 100644 --- a/Content.Client/Examine/ExamineSystem.cs +++ b/Content.Client/Examine/ExamineSystem.cs @@ -41,7 +41,7 @@ namespace Content.Client.Examine { UpdatesOutsidePrediction = true; - SubscribeLocalEvent(AddExamineVerb); + SubscribeLocalEvent>(AddExamineVerb); CommandBinds.Builder .Bind(ContentKeyFunctions.ExamineEntity, new PointerInputCmdHandler(HandleExamine, outsidePrediction: true)) @@ -90,7 +90,7 @@ namespace Content.Client.Examine return true; } - private void AddExamineVerb(GetOtherVerbsEvent args) + private void AddExamineVerb(GetVerbsEvent args) { if (!CanExamine(args.User, args.Target)) return; diff --git a/Content.Client/Stylesheets/StyleNano.cs b/Content.Client/Stylesheets/StyleNano.cs index 3e15c299cd..67d73c1225 100644 --- a/Content.Client/Stylesheets/StyleNano.cs +++ b/Content.Client/Stylesheets/StyleNano.cs @@ -7,6 +7,7 @@ using Content.Client.Resources; using Content.Client.Targeting; using Content.Client.UserInterface.Controls; using Content.Client.Verbs.UI; +using Content.Shared.Verbs; using Robust.Client.Graphics; using Robust.Client.ResourceManagement; using Robust.Client.UserInterface; @@ -615,16 +616,16 @@ namespace Content.Client.Stylesheets .Prop(Control.StylePropertyModulateSelf, ButtonColorContextDisabled), // Context Menu Labels - Element().Class(VerbMenuElement.StyleClassVerbInteractionText) + Element().Class(InteractionVerb.DefaultTextStyleClass) .Prop(Label.StylePropertyFont, notoSansBoldItalic12), - Element().Class(VerbMenuElement.StyleClassVerbActivationText) + Element().Class(ActivationVerb.DefaultTextStyleClass) .Prop(Label.StylePropertyFont, notoSansBold12), - Element().Class(VerbMenuElement.StyleClassVerbAlternativeText) + Element().Class(AlternativeVerb.DefaultTextStyleClass) .Prop(Label.StylePropertyFont, notoSansItalic12), - Element().Class(VerbMenuElement.StyleClassVerbOtherText) + Element().Class(Verb.DefaultTextStyleClass) .Prop(Label.StylePropertyFont, notoSans12), Element().Class(ContextMenuElement.StyleClassContextMenuExpansionTexture) diff --git a/Content.Client/Verbs/UI/ConfirmationMenuElement.cs b/Content.Client/Verbs/UI/ConfirmationMenuElement.cs index 35ede2f118..fd9943d6f7 100644 --- a/Content.Client/Verbs/UI/ConfirmationMenuElement.cs +++ b/Content.Client/Verbs/UI/ConfirmationMenuElement.cs @@ -10,7 +10,6 @@ public partial class ConfirmationMenuElement : ContextMenuElement public const string StyleClassConfirmationContextMenuButton = "confirmationContextMenuButton"; public readonly Verb Verb; - public readonly VerbType Type; public override string Text { @@ -23,10 +22,9 @@ public partial class ConfirmationMenuElement : ContextMenuElement } } - public ConfirmationMenuElement(Verb verb, string? text, VerbType type) : base(text) + public ConfirmationMenuElement(Verb verb, string? text) : base(text) { Verb = verb; - Type = type; Icon.Visible = false; SetOnlyStyleClass(StyleClassConfirmationContextMenuButton); diff --git a/Content.Client/Verbs/UI/VerbMenuElement.cs b/Content.Client/Verbs/UI/VerbMenuElement.cs index f8b6ccc00b..fd53fd7870 100644 --- a/Content.Client/Verbs/UI/VerbMenuElement.cs +++ b/Content.Client/Verbs/UI/VerbMenuElement.cs @@ -1,8 +1,11 @@ using Content.Client.ContextMenu.UI; using Content.Shared.Verbs; +using Robust.Client.GameObjects; using Robust.Client.UserInterface.Controls; using Robust.Client.Utility; -using Robust.Shared.Utility; +using Robust.Shared.GameObjects; +using Robust.Shared.IoC; +using Robust.Shared.Maths; namespace Content.Client.Verbs.UI { @@ -12,10 +15,6 @@ namespace Content.Client.Verbs.UI /// public partial class VerbMenuElement : ContextMenuElement { - public const string StyleClassVerbInteractionText = "InteractionVerb"; - public const string StyleClassVerbActivationText = "ActivationVerb"; - public const string StyleClassVerbAlternativeText = "AlternativeVerb"; - public const string StyleClassVerbOtherText = "OtherVerb"; public const string StyleClassVerbMenuConfirmationTexture = "verbMenuConfirmationTexture"; public const float VerbTooltipDelay = 0.5f; @@ -27,50 +26,37 @@ namespace Content.Client.Verbs.UI // Top quality variable naming public Verb? Verb; - public VerbType Type; - - public VerbMenuElement(string? text, SpriteSpecifier? icon, VerbType verbType) : base(text) - { - Icon.AddChild(new TextureRect() - { - Texture = icon?.Frame0(), - Stretch = TextureRect.StretchMode.KeepAspectCentered - }); - - Type = verbType; - - // Set text font style based on verb type - switch (verbType) - { - case VerbType.Interaction: - Label.SetOnlyStyleClass(StyleClassVerbInteractionText); - break; - case VerbType.Activation: - Label.SetOnlyStyleClass(StyleClassVerbActivationText); - break; - case VerbType.Alternative: - Label.SetOnlyStyleClass(StyleClassVerbAlternativeText); - break; - default: - Label.SetOnlyStyleClass(StyleClassVerbOtherText); - break; - } - } - - public VerbMenuElement(Verb verb, VerbType verbType) : this(verb.Text, verb.Icon, verbType) + public VerbMenuElement(Verb verb) : base(verb.Text) { ToolTip = verb.Message; TooltipDelay = VerbTooltipDelay; Disabled = verb.Disabled; Verb = verb; + Label.SetOnlyStyleClass(verb.TextStyleClass); + if (verb.ConfirmationPopup) { ExpansionIndicator.SetOnlyStyleClass(StyleClassVerbMenuConfirmationTexture); ExpansionIndicator.Visible = true; } + + Icon.AddChild(new TextureRect() + { + Texture = verb.Icon?.Frame0(), + Stretch = TextureRect.StretchMode.KeepAspectCentered + }); } - public VerbMenuElement(VerbCategory category, VerbType verbType) : this(category.Text, category.Icon, verbType) { } + public VerbMenuElement(VerbCategory category, string styleClass) : base(category.Text) + { + Label.SetOnlyStyleClass(styleClass); + + Icon.AddChild(new TextureRect() + { + Texture = category.Icon?.Frame0(), + Stretch = TextureRect.StretchMode.KeepAspectCentered + }); + } } } diff --git a/Content.Client/Verbs/UI/VerbMenuPresenter.cs b/Content.Client/Verbs/UI/VerbMenuPresenter.cs index 10f3254bd3..cb69cd92db 100644 --- a/Content.Client/Verbs/UI/VerbMenuPresenter.cs +++ b/Content.Client/Verbs/UI/VerbMenuPresenter.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using Content.Client.ContextMenu.UI; @@ -30,7 +31,7 @@ namespace Content.Client.Verbs.UI private readonly VerbSystem _verbSystem; public EntityUid CurrentTarget; - public Dictionary> CurrentVerbs = new(); + public SortedSet CurrentVerbs = new(); public VerbMenuPresenter(VerbSystem verbSystem) { @@ -51,7 +52,7 @@ namespace Content.Client.Verbs.UI Close(); CurrentTarget = target; - CurrentVerbs = _verbSystem.GetVerbs(target, user, VerbType.All, force); + CurrentVerbs = _verbSystem.GetVerbs(target, user, Verb.VerbTypes, force); if (!target.IsClientSide()) { @@ -73,26 +74,17 @@ namespace Content.Client.Verbs.UI if (RootMenu == null) return; - // Add verbs to pop-up, grouped by type. Order determined by how types are defined VerbTypes - var types = CurrentVerbs.Keys.ToList(); - types.Sort(); - foreach (var type in types) + HashSet listedCategories = new(); + foreach (var verb in CurrentVerbs) { - if (!CurrentVerbs.TryGetValue(type, out var verbs)) - continue; - - HashSet listedCategories = new(); - foreach (var verb in verbs) + if (verb.Category == null) { - if (verb.Category == null) - { - var element = new VerbMenuElement(verb, type); - AddElement(RootMenu, element); - } - - else if (listedCategories.Add(verb.Category.Text)) - AddVerbCategory(verb.Category, verbs, type); + var element = new VerbMenuElement(verb); + AddElement(RootMenu, element); } + + else if (listedCategories.Add(verb.Category.Text)) + AddVerbCategory(verb.Category); } RootMenu.InvalidateMeasure(); @@ -101,12 +93,12 @@ namespace Content.Client.Verbs.UI /// /// Add a verb category button to the pop-up /// - public void AddVerbCategory(VerbCategory category, SortedSet verbs, VerbType type) + public void AddVerbCategory(VerbCategory category) { // Get a list of the verbs in this category List verbsInCategory = new(); var drawIcons = false; - foreach (var verb in verbs) + foreach (var verb in CurrentVerbs) { if (verb.Category?.Text == category.Text) { @@ -118,14 +110,14 @@ namespace Content.Client.Verbs.UI if (verbsInCategory.Count == 0) return; - var element = new VerbMenuElement(category, type); + var element = new VerbMenuElement(category, verbsInCategory[0].TextStyleClass); AddElement(RootMenu, element); // Create the pop-up that appears when hovering over this element element.SubMenu = new ContextMenuPopup(this, element); foreach (var verb in verbsInCategory) { - var subElement = new VerbMenuElement(verb, type) + var subElement = new VerbMenuElement(verb) { IconVisible = drawIcons, TextVisible = !category.IconsOnly @@ -140,7 +132,7 @@ namespace Content.Client.Verbs.UI /// /// Add verbs from the server to and update the verb menu. /// - public void AddServerVerbs(Dictionary>? verbs) + public void AddServerVerbs(List? verbs) { RootMenu.MenuBody.DisposeAllChildren(); @@ -152,15 +144,7 @@ namespace Content.Client.Verbs.UI return; } - // Add the new server-side verbs. - foreach (var (verbType, verbSet) in verbs) - { - if (!CurrentVerbs.TryAdd(verbType, new SortedSet(verbSet))) - { - CurrentVerbs[verbType].UnionWith(verbSet); - } - } - + CurrentVerbs.UnionWith(verbs); FillVerbPopup(); } @@ -175,7 +159,7 @@ namespace Content.Client.Verbs.UI return; args.Handle(); - ExecuteVerb(confElement.Verb, confElement.Type); + ExecuteVerb(confElement.Verb); return; } @@ -208,7 +192,7 @@ namespace Content.Client.Verbs.UI { if (verbElement.SubMenu == null) { - var popupElement = new ConfirmationMenuElement(verb, "Confirm", verbElement.Type); + var popupElement = new ConfirmationMenuElement(verb, "Confirm"); verbElement.SubMenu = new ContextMenuPopup(this, verbElement); AddElement(verbElement.SubMenu, popupElement); } @@ -217,13 +201,13 @@ namespace Content.Client.Verbs.UI } else { - ExecuteVerb(verb, verbElement.Type); + ExecuteVerb(verb); } } - private void ExecuteVerb(Verb verb, VerbType verbType) + private void ExecuteVerb(Verb verb) { - _verbSystem.ExecuteVerb(CurrentTarget, verb, verbType); + _verbSystem.ExecuteVerb(CurrentTarget, verb); if (verb.CloseMenu) _verbSystem.CloseAllMenus(); } diff --git a/Content.Client/Verbs/VerbSystem.cs b/Content.Client/Verbs/VerbSystem.cs index 8584f8a260..11567ea3bf 100644 --- a/Content.Client/Verbs/VerbSystem.cs +++ b/Content.Client/Verbs/VerbSystem.cs @@ -181,7 +181,7 @@ namespace Content.Client.Verbs /// Ask the server to send back a list of server-side verbs, and for now return an incomplete list of verbs /// (only those defined locally). /// - public Dictionary> GetVerbs(EntityUid target, EntityUid user, VerbType verbTypes, + public SortedSet GetVerbs(EntityUid target, EntityUid user, List verbTypes, bool force = false) { if (!target.IsClientSide()) @@ -198,7 +198,7 @@ namespace Content.Client.Verbs /// /// Unless this is a client-exclusive verb, this will also tell the server to run the same verb. /// - public void ExecuteVerb(EntityUid target, Verb verb, VerbType verbType) + public void ExecuteVerb(EntityUid target, Verb verb) { var user = _playerManager.LocalPlayer?.ControlledEntity; if (user == null) @@ -218,10 +218,10 @@ namespace Content.Client.Verbs // is this a client exclusive (gui) verb? ExecuteVerb(verb, user.Value, target); else - EntityManager.RaisePredictiveEvent(new ExecuteVerbEvent(target, verb, verbType)); + EntityManager.RaisePredictiveEvent(new ExecuteVerbEvent(target, verb)); } - public override void ExecuteVerb(Verb verb, EntityUid user, EntityUid target, bool forced = false) + public override void ExecuteVerb(Verb verb, EntityUid user, EntityUid target, bool forced = false) { // invoke any relevant actions verb.Act?.Invoke(); diff --git a/Content.Server/Administration/AdminVerbSystem.cs b/Content.Server/Administration/AdminVerbSystem.cs index 37c2712fdb..e30b8d4b0d 100644 --- a/Content.Server/Administration/AdminVerbSystem.cs +++ b/Content.Server/Administration/AdminVerbSystem.cs @@ -51,13 +51,13 @@ namespace Content.Server.Administration public override void Initialize() { - SubscribeLocalEvent(AddAdminVerbs); - SubscribeLocalEvent(AddDebugVerbs); + SubscribeLocalEvent>(AddAdminVerbs); + SubscribeLocalEvent>(AddDebugVerbs); SubscribeLocalEvent(Reset); SubscribeLocalEvent(OnSolutionChanged); } - private void AddAdminVerbs(GetOtherVerbsEvent args) + private void AddAdminVerbs(GetVerbsEvent args) { if (!EntityManager.TryGetComponent(args.User, out var actor)) return; @@ -121,7 +121,7 @@ namespace Content.Server.Administration } } - private void AddDebugVerbs(GetOtherVerbsEvent args) + private void AddDebugVerbs(GetVerbsEvent args) { if (!EntityManager.TryGetComponent(args.User, out var actor)) return; diff --git a/Content.Server/Animals/Systems/UdderSystem.cs b/Content.Server/Animals/Systems/UdderSystem.cs index 6158582a6f..c5ae24963e 100644 --- a/Content.Server/Animals/Systems/UdderSystem.cs +++ b/Content.Server/Animals/Systems/UdderSystem.cs @@ -26,7 +26,7 @@ namespace Content.Server.Animals.Systems { base.Initialize(); - SubscribeLocalEvent(AddMilkVerb); + SubscribeLocalEvent>(AddMilkVerb); SubscribeLocalEvent(OnMilkingFinished); SubscribeLocalEvent(OnMilkingFailed); } @@ -117,14 +117,14 @@ namespace Content.Server.Animals.Systems component.BeingMilked = false; } - private void AddMilkVerb(EntityUid uid, UdderComponent component, GetAlternativeVerbsEvent args) + private void AddMilkVerb(EntityUid uid, UdderComponent component, GetVerbsEvent args) { if (args.Using == null || !args.CanInteract || !EntityManager.HasComponent(args.Using.Value)) return; - Verb verb = new() + AlternativeVerb verb = new() { Act = () => { diff --git a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs index 856d9acfc0..05ade9fc31 100644 --- a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs @@ -19,15 +19,15 @@ namespace Content.Server.Atmos.EntitySystems public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(AddOpenUIVerb); + SubscribeLocalEvent>(AddOpenUIVerb); } - private void AddOpenUIVerb(EntityUid uid, GasTankComponent component, GetActivationVerbsEvent args) + private void AddOpenUIVerb(EntityUid uid, GasTankComponent component, GetVerbsEvent args) { if (!args.CanAccess || !EntityManager.TryGetComponent(args.User, out var actor)) return; - Verb verb = new(); + ActivationVerb verb = new(); verb.Act = () => component.OpenInterface(actor.PlayerSession); verb.Text = Loc.GetString("control-verb-open-control-panel-text"); // TODO VERBS add "open UI" icon? diff --git a/Content.Server/Buckle/Systems/BuckleSystem.cs b/Content.Server/Buckle/Systems/BuckleSystem.cs index ddc6043374..8f3aa8f804 100644 --- a/Content.Server/Buckle/Systems/BuckleSystem.cs +++ b/Content.Server/Buckle/Systems/BuckleSystem.cs @@ -34,15 +34,15 @@ namespace Content.Server.Buckle.Systems SubscribeLocalEvent(HandleInteractHand); - SubscribeLocalEvent(AddUnbuckleVerb); + SubscribeLocalEvent>(AddUnbuckleVerb); } - private void AddUnbuckleVerb(EntityUid uid, BuckleComponent component, GetInteractionVerbsEvent args) + private void AddUnbuckleVerb(EntityUid uid, BuckleComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract || !component.Buckled) return; - Verb verb = new() + InteractionVerb verb = new() { Act = () => component.TryUnbuckle(args.User), Text = Loc.GetString("verb-categories-unbuckle"), diff --git a/Content.Server/Buckle/Systems/StrapSystem.cs b/Content.Server/Buckle/Systems/StrapSystem.cs index 660bae255f..0e20cdbd24 100644 --- a/Content.Server/Buckle/Systems/StrapSystem.cs +++ b/Content.Server/Buckle/Systems/StrapSystem.cs @@ -22,7 +22,7 @@ namespace Content.Server.Buckle.Systems { base.Initialize(); - SubscribeLocalEvent(AddStrapVerbs); + SubscribeLocalEvent>(AddStrapVerbs); SubscribeLocalEvent(OnInsertAttempt); } @@ -37,7 +37,7 @@ namespace Content.Server.Buckle.Systems // functions. Whenever these are fully ECSed, maybe do it in a way that allows for these verbs to be handled in // a sensible manner in a single system? - private void AddStrapVerbs(EntityUid uid, StrapComponent component, GetInteractionVerbsEvent args) + private void AddStrapVerbs(EntityUid uid, StrapComponent component, GetVerbsEvent args) { if (args.Hands == null || !args.CanAccess || !args.CanInteract || !component.Enabled) return; @@ -53,7 +53,7 @@ namespace Content.Server.Buckle.Systems if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target, range: buckledComp.Range)) continue; - Verb verb = new() + InteractionVerb verb = new() { Act = () => buckledComp.TryUnbuckle(args.User), Category = VerbCategory.Unbuckle @@ -79,7 +79,7 @@ namespace Content.Server.Buckle.Systems component.HasSpace(buckle) && _interactionSystem.InRangeUnobstructed(args.User, args.Target, range: buckle.Range)) { - Verb verb = new() + InteractionVerb verb = new() { Act = () => buckle.TryBuckle(args.User, args.Target), Category = VerbCategory.Buckle, @@ -99,7 +99,7 @@ namespace Content.Server.Buckle.Systems if (!_interactionSystem.InRangeUnobstructed(@using, args.Target, usingBuckle.Range, predicate: Ignored)) return; - Verb verb = new() + InteractionVerb verb = new() { Act = () => usingBuckle.TryBuckle(args.User, args.Target), Category = VerbCategory.Buckle, diff --git a/Content.Server/Cabinet/ItemCabinetSystem.cs b/Content.Server/Cabinet/ItemCabinetSystem.cs index 7fcdbde124..cb4d8c3fb8 100644 --- a/Content.Server/Cabinet/ItemCabinetSystem.cs +++ b/Content.Server/Cabinet/ItemCabinetSystem.cs @@ -25,7 +25,7 @@ namespace Content.Server.Cabinet SubscribeLocalEvent(OnComponentStartup); SubscribeLocalEvent(OnActivateInWorld); - SubscribeLocalEvent(AddToggleOpenVerb); + SubscribeLocalEvent>(AddToggleOpenVerb); SubscribeLocalEvent(OnContainerModified); SubscribeLocalEvent(OnContainerModified); @@ -65,13 +65,13 @@ namespace Content.Server.Cabinet UpdateAppearance(uid, cabinet); } - private void AddToggleOpenVerb(EntityUid uid, ItemCabinetComponent cabinet, GetActivationVerbsEvent args) + private void AddToggleOpenVerb(EntityUid uid, ItemCabinetComponent cabinet, GetVerbsEvent args) { if (args.Hands == null || !args.CanAccess || !args.CanInteract) return; // Toggle open verb - Verb toggleVerb = new(); + ActivationVerb toggleVerb = new(); toggleVerb.Act = () => ToggleItemCabinet(uid, cabinet); if (cabinet.Opened) { diff --git a/Content.Server/Chemistry/EntitySystems/SolutionTransferSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionTransferSystem.cs index 7208f76c49..c287637a8e 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionTransferSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionTransferSystem.cs @@ -24,10 +24,10 @@ namespace Content.Server.Chemistry.EntitySystems { base.Initialize(); - SubscribeLocalEvent(AddSetTransferVerbs); + SubscribeLocalEvent>(AddSetTransferVerbs); } - private void AddSetTransferVerbs(EntityUid uid, SolutionTransferComponent component, GetAlternativeVerbsEvent args) + private void AddSetTransferVerbs(EntityUid uid, SolutionTransferComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract || !component.CanChangeTransferAmount) return; @@ -36,7 +36,7 @@ namespace Content.Server.Chemistry.EntitySystems return; // Custom transfer verb - Verb custom = new(); + AlternativeVerb custom = new(); custom.Text = Loc.GetString("comp-solution-transfer-verb-custom-amount"); custom.Category = VerbCategory.SetTransferAmount; custom.Act = () => component.UserInterface?.Open(actor.PlayerSession); @@ -50,7 +50,7 @@ namespace Content.Server.Chemistry.EntitySystems if ( amount < component.MinimumTransferAmount.Int() || amount > component.MaximumTransferAmount.Int()) continue; - Verb verb = new(); + AlternativeVerb verb = new(); verb.Text = Loc.GetString("comp-solution-transfer-verb-amount", ("amount", amount)); verb.Category = VerbCategory.SetTransferAmount; verb.Act = () => diff --git a/Content.Server/Climbing/ClimbSystem.cs b/Content.Server/Climbing/ClimbSystem.cs index dce147c66e..ca97ce6213 100644 --- a/Content.Server/Climbing/ClimbSystem.cs +++ b/Content.Server/Climbing/ClimbSystem.cs @@ -32,7 +32,7 @@ namespace Content.Server.Climbing base.Initialize(); SubscribeLocalEvent(Reset); - SubscribeLocalEvent(AddClimbVerb); + SubscribeLocalEvent>(AddClimbVerb); SubscribeLocalEvent(OnGlassClimbed); } @@ -44,7 +44,7 @@ namespace Content.Server.Climbing UnsetTransitionBoolAfterBufferTime(uid, component); } - private void AddClimbVerb(EntityUid uid, ClimbableComponent component, GetAlternativeVerbsEvent args) + private void AddClimbVerb(EntityUid uid, ClimbableComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract || !_actionBlockerSystem.CanMove(args.User)) return; @@ -55,7 +55,7 @@ namespace Content.Server.Climbing return; // Add a climb verb - Verb verb = new(); + AlternativeVerb verb = new(); verb.Act = () => component.TryClimb(args.User, args.Target); verb.Text = Loc.GetString("comp-climbable-verb-climb"); // TODO VERBS ICON add a climbing icon? diff --git a/Content.Server/Clothing/MagbootsSystem.cs b/Content.Server/Clothing/MagbootsSystem.cs index 9486e18e33..c5252ebec0 100644 --- a/Content.Server/Clothing/MagbootsSystem.cs +++ b/Content.Server/Clothing/MagbootsSystem.cs @@ -20,7 +20,7 @@ namespace Content.Server.Clothing { base.Initialize(); - SubscribeLocalEvent(AddToggleVerb); + SubscribeLocalEvent>(AddToggleVerb); SubscribeLocalEvent(OnSlipAttempt); SubscribeLocalEvent(OnRefreshMovespeed); SubscribeLocalEvent(OnGotEquipped); @@ -69,12 +69,12 @@ namespace Content.Server.Clothing args.ModifySpeed(component.WalkSpeedModifier, component.SprintSpeedModifier); } - private void AddToggleVerb(EntityUid uid, MagbootsComponent component, GetActivationVerbsEvent args) + private void AddToggleVerb(EntityUid uid, MagbootsComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; - Verb verb = new(); + ActivationVerb verb = new(); verb.Text = Loc.GetString("toggle-magboots-verb-get-data-text"); verb.Act = () => component.On = !component.On; // TODO VERB ICON add toggle icon? maybe a computer on/off symbol? diff --git a/Content.Server/Construction/ConstructionSystem.Guided.cs b/Content.Server/Construction/ConstructionSystem.Guided.cs index 11132a16cb..7c1ed4dbec 100644 --- a/Content.Server/Construction/ConstructionSystem.Guided.cs +++ b/Content.Server/Construction/ConstructionSystem.Guided.cs @@ -18,7 +18,7 @@ namespace Content.Server.Construction private void InitializeGuided() { SubscribeNetworkEvent(OnGuideRequested); - SubscribeLocalEvent(AddDeconstructVerb); + SubscribeLocalEvent>(AddDeconstructVerb); SubscribeLocalEvent(HandleConstructionExamined); } @@ -31,7 +31,7 @@ namespace Content.Server.Construction RaiseNetworkEvent(new ResponseConstructionGuide(msg.ConstructionId, guide), args.SenderSession.ConnectedClient); } - private void AddDeconstructVerb(EntityUid uid, ConstructionComponent component, GetOtherVerbsEvent args) + private void AddDeconstructVerb(EntityUid uid, ConstructionComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; diff --git a/Content.Server/Cuffs/CuffableSystem.cs b/Content.Server/Cuffs/CuffableSystem.cs index 0e4145ea13..4ad2953664 100644 --- a/Content.Server/Cuffs/CuffableSystem.cs +++ b/Content.Server/Cuffs/CuffableSystem.cs @@ -27,10 +27,10 @@ namespace Content.Server.Cuffs SubscribeLocalEvent(OnHandCountChanged); SubscribeLocalEvent(OnUncuffAttempt); - SubscribeLocalEvent(AddUncuffVerb); + SubscribeLocalEvent>(AddUncuffVerb); } - private void AddUncuffVerb(EntityUid uid, CuffableComponent component, GetOtherVerbsEvent args) + private void AddUncuffVerb(EntityUid uid, CuffableComponent component, GetVerbsEvent args) { // Can the user access the cuffs, and is there even anything to uncuff? if (!args.CanAccess || component.CuffedHandCount == 0) diff --git a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs index 32b9546a2f..250501eebc 100644 --- a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs +++ b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs @@ -25,11 +25,11 @@ namespace Content.Server.Disposal.Tube SubscribeLocalEvent(BodyTypeChanged); SubscribeLocalEvent(OnRelayMovement); - SubscribeLocalEvent(AddOpenUIVerbs); - SubscribeLocalEvent(AddOpenUIVerbs); + SubscribeLocalEvent>(AddOpenUIVerbs); + SubscribeLocalEvent>(AddOpenUIVerbs); } - private void AddOpenUIVerbs(EntityUid uid, DisposalTaggerComponent component, GetInteractionVerbsEvent args) + private void AddOpenUIVerbs(EntityUid uid, DisposalTaggerComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; @@ -38,14 +38,14 @@ namespace Content.Server.Disposal.Tube return; var player = actor.PlayerSession; - Verb verb = new(); + InteractionVerb verb = new(); verb.Text = Loc.GetString("configure-verb-get-data-text"); verb.IconTexture = "/Textures/Interface/VerbIcons/settings.svg.192dpi.png"; verb.Act = () => component.OpenUserInterface(actor); args.Verbs.Add(verb); } - private void AddOpenUIVerbs(EntityUid uid, DisposalRouterComponent component, GetInteractionVerbsEvent args) + private void AddOpenUIVerbs(EntityUid uid, DisposalRouterComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; @@ -54,7 +54,7 @@ namespace Content.Server.Disposal.Tube return; var player = actor.PlayerSession; - Verb verb = new(); + InteractionVerb verb = new(); verb.Text = Loc.GetString("configure-verb-get-data-text"); verb.IconTexture = "/Textures/Interface/VerbIcons/settings.svg.192dpi.png"; verb.Act = () => component.OpenUserInterface(actor); diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs index 7da3f24cfe..3a305477cc 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs @@ -68,9 +68,9 @@ namespace Content.Server.Disposal.Unit.EntitySystems SubscribeLocalEvent(HandleDestruction); // Verbs - SubscribeLocalEvent(AddInsertVerb); - SubscribeLocalEvent(AddFlushEjectVerbs); - SubscribeLocalEvent(AddClimbInsideVerb); + SubscribeLocalEvent>(AddInsertVerb); + SubscribeLocalEvent>(AddFlushEjectVerbs); + SubscribeLocalEvent>(AddClimbInsideVerb); // Units SubscribeLocalEvent(DoInsertDisposalUnit); @@ -79,13 +79,13 @@ namespace Content.Server.Disposal.Unit.EntitySystems SubscribeLocalEvent(OnUiButtonPressed); } - private void AddFlushEjectVerbs(EntityUid uid, DisposalUnitComponent component, GetAlternativeVerbsEvent args) + private void AddFlushEjectVerbs(EntityUid uid, DisposalUnitComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract || component.Container.ContainedEntities.Count == 0) return; // Verbs to flush the unit - Verb flushVerb = new(); + AlternativeVerb flushVerb = new(); flushVerb.Act = () => Engage(component); flushVerb.Text = Loc.GetString("disposal-flush-verb-get-data-text"); flushVerb.IconTexture = "/Textures/Interface/VerbIcons/delete_transparent.svg.192dpi.png"; @@ -93,14 +93,14 @@ namespace Content.Server.Disposal.Unit.EntitySystems args.Verbs.Add(flushVerb); // Verb to eject the contents - Verb ejectVerb = new(); + AlternativeVerb ejectVerb = new(); ejectVerb.Act = () => TryEjectContents(component); ejectVerb.Category = VerbCategory.Eject; ejectVerb.Text = Loc.GetString("disposal-eject-verb-contents"); args.Verbs.Add(ejectVerb); } - private void AddClimbInsideVerb(EntityUid uid, DisposalUnitComponent component, GetOtherVerbsEvent args) + private void AddClimbInsideVerb(EntityUid uid, DisposalUnitComponent component, GetVerbsEvent args) { // This is not an interaction, activation, or alternative verb type because unfortunately most users are // unwilling to accept that this is where they belong and don't want to accidentally climb inside. @@ -123,7 +123,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems args.Verbs.Add(verb); } - private void AddInsertVerb(EntityUid uid, DisposalUnitComponent component, GetInteractionVerbsEvent args) + private void AddInsertVerb(EntityUid uid, DisposalUnitComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract || args.Hands == null || args.Using == null) return; @@ -134,7 +134,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems if (!CanInsert(component, args.Using.Value)) return; - Verb insertVerb = new() + InteractionVerb insertVerb = new() { Text = Name(args.Using.Value), Category = VerbCategory.Insert, diff --git a/Content.Server/Engineering/EntitySystems/DisassembleOnAltVerbSystem.cs b/Content.Server/Engineering/EntitySystems/DisassembleOnAltVerbSystem.cs index 36bef9b7c1..eb27670d1f 100644 --- a/Content.Server/Engineering/EntitySystems/DisassembleOnAltVerbSystem.cs +++ b/Content.Server/Engineering/EntitySystems/DisassembleOnAltVerbSystem.cs @@ -4,26 +4,24 @@ using Content.Server.Hands.Components; using Content.Shared.Interaction.Helpers; using Content.Shared.Item; using Content.Shared.Verbs; -using Robust.Shared.GameObjects; -using Robust.Shared.Localization; using JetBrains.Annotations; namespace Content.Server.Engineering.EntitySystems { [UsedImplicitly] - public class DisassembleOnAltVerbSystem : EntitySystem + public sealed class DisassembleOnAltVerbSystem : EntitySystem { public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(AddDisassembleVerb); + SubscribeLocalEvent>(AddDisassembleVerb); } - private void AddDisassembleVerb(EntityUid uid, DisassembleOnAltVerbComponent component, GetAlternativeVerbsEvent args) + private void AddDisassembleVerb(EntityUid uid, DisassembleOnAltVerbComponent component, GetVerbsEvent args) { if (!args.CanInteract) return; - Verb verb = new() + AlternativeVerb verb = new() { Act = () => { diff --git a/Content.Server/Extinguisher/FireExtinguisherSystem.cs b/Content.Server/Extinguisher/FireExtinguisherSystem.cs index 74d7aa5d8c..a76a72e7bd 100644 --- a/Content.Server/Extinguisher/FireExtinguisherSystem.cs +++ b/Content.Server/Extinguisher/FireExtinguisherSystem.cs @@ -31,7 +31,7 @@ public class FireExtinguisherSystem : EntitySystem SubscribeLocalEvent(OnDropped); SubscribeLocalEvent(OnUseInHand); SubscribeLocalEvent(OnAfterInteract); - SubscribeLocalEvent(OnGetInteractionVerbs); + SubscribeLocalEvent>(OnGetInteractionVerbs); SubscribeLocalEvent(OnSprayAttempt); } @@ -103,12 +103,12 @@ public class FireExtinguisherSystem : EntitySystem } } - private void OnGetInteractionVerbs(EntityUid uid, FireExtinguisherComponent component, GetInteractionVerbsEvent args) + private void OnGetInteractionVerbs(EntityUid uid, FireExtinguisherComponent component, GetVerbsEvent args) { if (!args.CanInteract) return; - var verb = new Verb + var verb = new InteractionVerb { Act = () => ToggleSafety(uid, args.User, component), Text = Loc.GetString("fire-extinguisher-component-verb-text"), diff --git a/Content.Server/Fluids/EntitySystems/SpillableSystem.cs b/Content.Server/Fluids/EntitySystems/SpillableSystem.cs index d24716406c..b3a8ab6469 100644 --- a/Content.Server/Fluids/EntitySystems/SpillableSystem.cs +++ b/Content.Server/Fluids/EntitySystems/SpillableSystem.cs @@ -36,7 +36,7 @@ public class SpillableSystem : EntitySystem { base.Initialize(); SubscribeLocalEvent(SpillOnLand); - SubscribeLocalEvent(AddSpillVerb); + SubscribeLocalEvent>(AddSpillVerb); SubscribeLocalEvent(OnGotEquipped); } @@ -98,7 +98,7 @@ public class SpillableSystem : EntitySystem SpillAt(drainedSolution, EntityManager.GetComponent(uid).Coordinates, "PuddleSmear"); } - private void AddSpillVerb(EntityUid uid, SpillableComponent component, GetOtherVerbsEvent args) + private void AddSpillVerb(EntityUid uid, SpillableComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; diff --git a/Content.Server/Foldable/FoldableSystem.cs b/Content.Server/Foldable/FoldableSystem.cs index 9b49a9e54a..3159e2ac2c 100644 --- a/Content.Server/Foldable/FoldableSystem.cs +++ b/Content.Server/Foldable/FoldableSystem.cs @@ -21,7 +21,7 @@ namespace Content.Server.Foldable base.Initialize(); SubscribeLocalEvent(OnFoldableOpenAttempt); - SubscribeLocalEvent(AddFoldVerb); + SubscribeLocalEvent>(AddFoldVerb); } private void OnFoldableOpenAttempt(EntityUid uid, FoldableComponent component, StorageOpenAttemptEvent args) @@ -91,12 +91,12 @@ namespace Content.Server.Foldable #region Verb - private void AddFoldVerb(EntityUid uid, FoldableComponent component, GetAlternativeVerbsEvent args) + private void AddFoldVerb(EntityUid uid, FoldableComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract || !CanToggleFold(uid, component)) return; - Verb verb = new() + AlternativeVerb verb = new() { Act = () => TryToggleFold(component), Text = component.IsFolded ? Loc.GetString("unfold-verb") : Loc.GetString("fold-verb"), diff --git a/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs b/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs index 3a933c63bf..d3bb622ea0 100644 --- a/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs +++ b/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs @@ -22,7 +22,7 @@ namespace Content.Server.Light.EntitySystems SubscribeLocalEvent(OnExpLightInit); SubscribeLocalEvent(OnExpLightUse); - SubscribeLocalEvent(AddIgniteVerb); + SubscribeLocalEvent>(AddIgniteVerb); } public override void Update(float frameTime) @@ -179,7 +179,7 @@ namespace Content.Server.Light.EntitySystems args.Handled = true; } - private void AddIgniteVerb(EntityUid uid, ExpendableLightComponent component, GetActivationVerbsEvent args) + private void AddIgniteVerb(EntityUid uid, ExpendableLightComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; @@ -189,7 +189,7 @@ namespace Content.Server.Light.EntitySystems // Ignite the flare or make the glowstick glow. // Also hot damn, those are some shitty glowsticks, we need to get a refund. - Verb verb = new() + ActivationVerb verb = new() { Text = Loc.GetString("expendable-light-start-verb"), IconTexture = "/Textures/Interface/VerbIcons/light.svg.192dpi.png", diff --git a/Content.Server/Light/EntitySystems/HandheldLightSystem.cs b/Content.Server/Light/EntitySystems/HandheldLightSystem.cs index 38df9586ac..001867f050 100644 --- a/Content.Server/Light/EntitySystems/HandheldLightSystem.cs +++ b/Content.Server/Light/EntitySystems/HandheldLightSystem.cs @@ -45,7 +45,7 @@ namespace Content.Server.Light.EntitySystems SubscribeLocalEvent(OnGetState); SubscribeLocalEvent(OnExamine); - SubscribeLocalEvent(AddToggleLightVerb); + SubscribeLocalEvent>(AddToggleLightVerb); SubscribeLocalEvent(OnActivate); } @@ -135,11 +135,11 @@ namespace Content.Server.Light.EntitySystems } } - private void AddToggleLightVerb(EntityUid uid, HandheldLightComponent component, GetActivationVerbsEvent args) + private void AddToggleLightVerb(EntityUid uid, HandheldLightComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; - Verb verb = new() + ActivationVerb verb = new() { Text = Loc.GetString("verb-common-toggle-light"), IconTexture = "/Textures/Interface/VerbIcons/light.svg.192dpi.png", diff --git a/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs b/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs index 09201ecaf2..74dc3c641f 100644 --- a/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs +++ b/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs @@ -18,15 +18,15 @@ namespace Content.Server.Light.EntitySystems { base.Initialize(); - SubscribeLocalEvent(AddToggleLightVerbs); + SubscribeLocalEvent>(AddToggleLightVerbs); } - private void AddToggleLightVerbs(EntityUid uid, UnpoweredFlashlightComponent component, GetActivationVerbsEvent args) + private void AddToggleLightVerbs(EntityUid uid, UnpoweredFlashlightComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; - Verb verb = new(); + ActivationVerb verb = new(); verb.Text = Loc.GetString("toggle-flashlight-verb-get-data-text"); verb.IconTexture = "/Textures/Interface/VerbIcons/light.svg.192dpi.png"; verb.Act = () => ToggleLight(component); diff --git a/Content.Server/Lock/LockSystem.cs b/Content.Server/Lock/LockSystem.cs index e70d63b5bb..c1ecc097ef 100644 --- a/Content.Server/Lock/LockSystem.cs +++ b/Content.Server/Lock/LockSystem.cs @@ -32,7 +32,7 @@ namespace Content.Server.Lock SubscribeLocalEvent(OnStartup); SubscribeLocalEvent(OnActivated); SubscribeLocalEvent(OnExamined); - SubscribeLocalEvent(AddToggleLockVerb); + SubscribeLocalEvent>(AddToggleLockVerb); } private void OnStartup(EntityUid uid, LockComponent lockComp, ComponentStartup args) @@ -169,12 +169,12 @@ namespace Content.Server.Lock return true; } - private void AddToggleLockVerb(EntityUid uid, LockComponent component, GetAlternativeVerbsEvent args) + private void AddToggleLockVerb(EntityUid uid, LockComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract || !CanToggleLock(uid, args.User)) return; - Verb verb = new(); + AlternativeVerb verb = new(); verb.Act = component.Locked ? () => TryUnlock(uid, args.User, component) : () => TryLock(uid, args.User, component); diff --git a/Content.Server/Medical/MedicalScannerSystem.cs b/Content.Server/Medical/MedicalScannerSystem.cs index 1e69034e91..62b1345e0d 100644 --- a/Content.Server/Medical/MedicalScannerSystem.cs +++ b/Content.Server/Medical/MedicalScannerSystem.cs @@ -22,11 +22,11 @@ namespace Content.Server.Medical base.Initialize(); SubscribeLocalEvent(OnRelayMovement); - SubscribeLocalEvent(AddInsertOtherVerb); - SubscribeLocalEvent(AddAlternativeVerbs); + SubscribeLocalEvent>(AddInsertOtherVerb); + SubscribeLocalEvent>(AddAlternativeVerbs); } - private void AddInsertOtherVerb(EntityUid uid, MedicalScannerComponent component, GetInteractionVerbsEvent args) + private void AddInsertOtherVerb(EntityUid uid, MedicalScannerComponent component, GetVerbsEvent args) { if (args.Using == null || !args.CanAccess || @@ -35,14 +35,14 @@ namespace Content.Server.Medical !component.CanInsert(args.Using.Value)) return; - Verb verb = new(); + InteractionVerb verb = new(); verb.Act = () => component.InsertBody(args.Using.Value); verb.Category = VerbCategory.Insert; verb.Text = EntityManager.GetComponent(args.Using.Value).EntityName; args.Verbs.Add(verb); } - private void AddAlternativeVerbs(EntityUid uid, MedicalScannerComponent component, GetAlternativeVerbsEvent args) + private void AddAlternativeVerbs(EntityUid uid, MedicalScannerComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; @@ -50,7 +50,7 @@ namespace Content.Server.Medical // Eject verb if (component.IsOccupied) { - Verb verb = new(); + AlternativeVerb verb = new(); verb.Act = () => component.EjectBody(); verb.Category = VerbCategory.Eject; verb.Text = Loc.GetString("medical-scanner-verb-noun-occupant"); @@ -62,7 +62,7 @@ namespace Content.Server.Medical component.CanInsert(args.User) && _actionBlockerSystem.CanMove(args.User)) { - Verb verb = new(); + AlternativeVerb verb = new(); verb.Act = () => component.InsertBody(args.User); verb.Text = Loc.GetString("medical-scanner-verb-enter"); // TODO VERN ICON diff --git a/Content.Server/Medical/SuitSensors/SuitSensorSystem.cs b/Content.Server/Medical/SuitSensors/SuitSensorSystem.cs index 38964142da..7471f6b6c7 100644 --- a/Content.Server/Medical/SuitSensors/SuitSensorSystem.cs +++ b/Content.Server/Medical/SuitSensors/SuitSensorSystem.cs @@ -41,7 +41,7 @@ namespace Content.Server.Medical.SuitSensors SubscribeLocalEvent(OnEquipped); SubscribeLocalEvent(OnUnequipped); SubscribeLocalEvent(OnExamine); - SubscribeLocalEvent(OnVerb); + SubscribeLocalEvent>(OnVerb); } public override void Update(float frameTime) @@ -135,7 +135,7 @@ namespace Content.Server.Medical.SuitSensors args.PushMarkup(Loc.GetString(msg)); } - private void OnVerb(EntityUid uid, SuitSensorComponent component, GetInteractionVerbsEvent args) + private void OnVerb(EntityUid uid, SuitSensorComponent component, GetVerbsEvent args) { // check if user can change sensor if (component.ControlsLocked) diff --git a/Content.Server/Morgue/MorgueSystem.cs b/Content.Server/Morgue/MorgueSystem.cs index 611a4d0e07..8929681cbd 100644 --- a/Content.Server/Morgue/MorgueSystem.cs +++ b/Content.Server/Morgue/MorgueSystem.cs @@ -18,15 +18,15 @@ namespace Content.Server.Morgue { base.Initialize(); - SubscribeLocalEvent(AddCremateVerb); + SubscribeLocalEvent>(AddCremateVerb); } - private void AddCremateVerb(EntityUid uid, CrematoriumEntityStorageComponent component, GetAlternativeVerbsEvent args) + private void AddCremateVerb(EntityUid uid, CrematoriumEntityStorageComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract || component.Cooking || component.Open) return; - Verb verb = new(); + AlternativeVerb verb = new(); verb.Text = Loc.GetString("cremate-verb-get-data-text"); // TODO VERB ICON add flame/burn symbol? verb.Act = () => component.TryCremate(); diff --git a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs index 905ab2c7e7..25605c7a4c 100644 --- a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs @@ -49,7 +49,7 @@ namespace Content.Server.Nutrition.EntitySystems SubscribeLocalEvent(OnUseFoodInHand); SubscribeLocalEvent(OnFeedFood); - SubscribeLocalEvent(AddEatVerb); + SubscribeLocalEvent>(AddEatVerb); SubscribeLocalEvent(OnFeed); SubscribeLocalEvent(OnFeedCancelled); SubscribeLocalEvent(OnInventoryIngestAttempt); @@ -245,7 +245,7 @@ namespace Content.Server.Nutrition.EntitySystems EntityManager.QueueDeleteEntity(component.Owner); } - private void AddEatVerb(EntityUid uid, FoodComponent component, GetInteractionVerbsEvent ev) + private void AddEatVerb(EntityUid uid, FoodComponent component, GetVerbsEvent ev) { if (component.CancelToken != null) return; @@ -260,7 +260,7 @@ namespace Content.Server.Nutrition.EntitySystems if (EntityManager.TryGetComponent(uid, out var mobState) && mobState.IsAlive()) return; - Verb verb = new() + InteractionVerb verb = new() { Act = () => { diff --git a/Content.Server/PAI/PAISystem.cs b/Content.Server/PAI/PAISystem.cs index 2d16a96533..8a7ca864b4 100644 --- a/Content.Server/PAI/PAISystem.cs +++ b/Content.Server/PAI/PAISystem.cs @@ -29,7 +29,7 @@ namespace Content.Server.PAI SubscribeLocalEvent(OnUseInHand); SubscribeLocalEvent(OnMindAdded); SubscribeLocalEvent(OnMindRemoved); - SubscribeLocalEvent(AddWipeVerb); + SubscribeLocalEvent>(AddWipeVerb); } private void OnExamined(EntityUid uid, PAIComponent component, ExaminedEvent args) @@ -127,14 +127,14 @@ namespace Content.Server.PAI } } - private void AddWipeVerb(EntityUid uid, PAIComponent pai, GetActivationVerbsEvent args) + private void AddWipeVerb(EntityUid uid, PAIComponent pai, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; if (EntityManager.TryGetComponent(uid, out var mind) && mind.HasMind) { - Verb verb = new(); + ActivationVerb verb = new(); verb.Text = Loc.GetString("pai-system-wipe-device-verb-text"); verb.Act = () => { if (pai.Deleted) @@ -153,7 +153,7 @@ namespace Content.Server.PAI } else if (EntityManager.HasComponent(uid)) { - Verb verb = new(); + ActivationVerb verb = new(); verb.Text = Loc.GetString("pai-system-stop-searching-verb-text"); verb.Act = () => { if (pai.Deleted) diff --git a/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs b/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs index 0e3bc6c7d9..a5ded0841d 100644 --- a/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs +++ b/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs @@ -45,8 +45,8 @@ namespace Content.Server.PneumaticCannon SubscribeLocalEvent(OnComponentInit); SubscribeLocalEvent(OnInteractUsing); SubscribeLocalEvent(OnAfterInteract); - SubscribeLocalEvent(OnAlternativeVerbs); - SubscribeLocalEvent(OnOtherVerbs); + SubscribeLocalEvent>(OnAlternativeVerbs); + SubscribeLocalEvent>(OnOtherVerbs); } public override void Update(float frameTime) @@ -285,20 +285,20 @@ namespace Content.Server.PneumaticCannon return false; } - private void OnAlternativeVerbs(EntityUid uid, PneumaticCannonComponent component, GetAlternativeVerbsEvent args) + private void OnAlternativeVerbs(EntityUid uid, PneumaticCannonComponent component, GetVerbsEvent args) { if (component.GasTankSlot.ContainedEntities.Count == 0 || !component.GasTankRequired) return; if (!args.CanInteract) return; - Verb ejectTank = new(); + AlternativeVerb ejectTank = new(); ejectTank.Act = () => TryRemoveGasTank(component, args.User); ejectTank.Text = Loc.GetString("pneumatic-cannon-component-verb-gas-tank-name"); args.Verbs.Add(ejectTank); } - private void OnOtherVerbs(EntityUid uid, PneumaticCannonComponent component, GetOtherVerbsEvent args) + private void OnOtherVerbs(EntityUid uid, PneumaticCannonComponent component, GetVerbsEvent args) { if (!args.CanInteract) return; diff --git a/Content.Server/Pointing/EntitySystems/PointingSystem.cs b/Content.Server/Pointing/EntitySystems/PointingSystem.cs index dd8905829a..c76f2c5d4e 100644 --- a/Content.Server/Pointing/EntitySystems/PointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/PointingSystem.cs @@ -194,7 +194,7 @@ namespace Content.Server.Pointing.EntitySystems { base.Initialize(); - SubscribeLocalEvent(AddPointingVerb); + SubscribeLocalEvent>(AddPointingVerb); _playerManager.PlayerStatusChanged += OnPlayerStatusChanged; @@ -203,7 +203,7 @@ namespace Content.Server.Pointing.EntitySystems .Register(); } - private void AddPointingVerb(GetOtherVerbsEvent args) + private void AddPointingVerb(GetVerbsEvent args) { if (args.Hands == null) return; diff --git a/Content.Server/Rotatable/RotatableSystem.cs b/Content.Server/Rotatable/RotatableSystem.cs index 93735132b8..0d47e75adb 100644 --- a/Content.Server/Rotatable/RotatableSystem.cs +++ b/Content.Server/Rotatable/RotatableSystem.cs @@ -16,11 +16,11 @@ namespace Content.Server.Rotatable { public override void Initialize() { - SubscribeLocalEvent(AddFlipVerb); - SubscribeLocalEvent(AddRotateVerbs); + SubscribeLocalEvent>(AddFlipVerb); + SubscribeLocalEvent>(AddRotateVerbs); } - private void AddFlipVerb(EntityUid uid, FlippableComponent component, GetOtherVerbsEvent args) + private void AddFlipVerb(EntityUid uid, FlippableComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract || component.MirrorEntity == null) return; @@ -32,7 +32,7 @@ namespace Content.Server.Rotatable args.Verbs.Add(verb); } - private void AddRotateVerbs(EntityUid uid, RotatableComponent component, GetOtherVerbsEvent args) + private void AddRotateVerbs(EntityUid uid, RotatableComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; diff --git a/Content.Server/Shuttles/EntitySystems/DockingSystem.cs b/Content.Server/Shuttles/EntitySystems/DockingSystem.cs index 5df0d8ad30..aa891cad21 100644 --- a/Content.Server/Shuttles/EntitySystems/DockingSystem.cs +++ b/Content.Server/Shuttles/EntitySystems/DockingSystem.cs @@ -39,7 +39,7 @@ namespace Content.Server.Shuttles.EntitySystems SubscribeLocalEvent(OnPowerChange); SubscribeLocalEvent(OnAnchorChange); - SubscribeLocalEvent(OnVerb); + SubscribeLocalEvent>(OnVerb); SubscribeLocalEvent(OnAutoClose); } @@ -50,12 +50,12 @@ namespace Content.Server.Shuttles.EntitySystems args.Cancel(); } - private void OnVerb(EntityUid uid, DockingComponent component, GetInteractionVerbsEvent args) + private void OnVerb(EntityUid uid, DockingComponent component, GetVerbsEvent args) { if (!args.CanInteract || !args.CanAccess) return; - Verb? verb; + InteractionVerb? verb; // TODO: Have it open the UI and have the UI do this. if (!component.Docked && @@ -67,7 +67,7 @@ namespace Content.Server.Shuttles.EntitySystems if (component.Enabled) otherDock = GetDockable(body, xform); - verb = new Verb + verb = new InteractionVerb { Disabled = otherDock == null, Text = Loc.GetString("docking-component-dock"), @@ -80,7 +80,7 @@ namespace Content.Server.Shuttles.EntitySystems } else if (component.Docked) { - verb = new Verb + verb = new InteractionVerb { Disabled = !component.Docked, Text = Loc.GetString("docking-component-undock"), diff --git a/Content.Server/Shuttles/EntitySystems/ShuttleConsoleSystem.cs b/Content.Server/Shuttles/EntitySystems/ShuttleConsoleSystem.cs index 577f53677a..c060da4298 100644 --- a/Content.Server/Shuttles/EntitySystems/ShuttleConsoleSystem.cs +++ b/Content.Server/Shuttles/EntitySystems/ShuttleConsoleSystem.cs @@ -34,13 +34,13 @@ namespace Content.Server.Shuttles.EntitySystems SubscribeLocalEvent(HandleConsoleShutdown); SubscribeLocalEvent(HandleConsoleInteract); SubscribeLocalEvent(HandlePowerChange); - SubscribeLocalEvent(OnConsoleInteract); + SubscribeLocalEvent>(OnConsoleInteract); SubscribeLocalEvent(HandlePilotShutdown); SubscribeLocalEvent(HandlePilotMove); } - private void OnConsoleInteract(EntityUid uid, ShuttleConsoleComponent component, GetInteractionVerbsEvent args) + private void OnConsoleInteract(EntityUid uid, ShuttleConsoleComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) @@ -52,7 +52,7 @@ namespace Content.Server.Shuttles.EntitySystems if (!_mapManager.TryGetGrid(xform.GridID, out var grid) || !EntityManager.TryGetComponent(grid.GridEntityId, out ShuttleComponent? shuttle)) return; - Verb verb = new() + InteractionVerb verb = new() { Text = Loc.GetString("shuttle-mode-toggle"), Act = () => ToggleShuttleMode(args.User, component, shuttle), diff --git a/Content.Server/Stack/StackSystem.cs b/Content.Server/Stack/StackSystem.cs index 0db324eb08..8164517fb9 100644 --- a/Content.Server/Stack/StackSystem.cs +++ b/Content.Server/Stack/StackSystem.cs @@ -33,7 +33,7 @@ namespace Content.Server.Stack base.Initialize(); SubscribeLocalEvent(OnStackInteractUsing); - SubscribeLocalEvent(OnStackAlternativeInteract); + SubscribeLocalEvent>(OnStackAlternativeInteract); } /// @@ -126,12 +126,12 @@ namespace Content.Server.Stack args.Handled = true; } - private void OnStackAlternativeInteract(EntityUid uid, StackComponent stack, GetAlternativeVerbsEvent args) + private void OnStackAlternativeInteract(EntityUid uid, StackComponent stack, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; - Verb halve = new() + AlternativeVerb halve = new() { Text = Loc.GetString("comp-stack-split-halve"), Category = VerbCategory.Split, @@ -146,7 +146,7 @@ namespace Content.Server.Stack if (amount >= stack.Count) continue; - Verb verb = new() + AlternativeVerb verb = new() { Text = amount.ToString(), Category = VerbCategory.Split, diff --git a/Content.Server/Storage/EntitySystems/StorageSystem.cs b/Content.Server/Storage/EntitySystems/StorageSystem.cs index 1f52ff11a1..06f5f01812 100644 --- a/Content.Server/Storage/EntitySystems/StorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/StorageSystem.cs @@ -32,8 +32,8 @@ namespace Content.Server.Storage.EntitySystems SubscribeLocalEvent(HandleEntityRemovedFromContainer); SubscribeLocalEvent(HandleEntityInsertedIntoContainer); - SubscribeLocalEvent(AddToggleOpenVerb); - SubscribeLocalEvent(AddOpenUiVerb); + SubscribeLocalEvent>(AddToggleOpenVerb); + SubscribeLocalEvent>(AddOpenUiVerb); SubscribeLocalEvent(OnRelayMovement); SubscribeLocalEvent(OnStorageFillMapInit); @@ -63,7 +63,7 @@ namespace Content.Server.Storage.EntitySystems } } - private void AddToggleOpenVerb(EntityUid uid, EntityStorageComponent component, GetInteractionVerbsEvent args) + private void AddToggleOpenVerb(EntityUid uid, EntityStorageComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; @@ -71,7 +71,7 @@ namespace Content.Server.Storage.EntitySystems if (!component.CanOpen(args.User, silent: true)) return; - Verb verb = new(); + InteractionVerb verb = new(); if (component.Open) { verb.Text = Loc.GetString("verb-common-close"); @@ -86,7 +86,7 @@ namespace Content.Server.Storage.EntitySystems args.Verbs.Add(verb); } - private void AddOpenUiVerb(EntityUid uid, ServerStorageComponent component, GetActivationVerbsEvent args) + private void AddOpenUiVerb(EntityUid uid, ServerStorageComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; @@ -102,7 +102,7 @@ namespace Content.Server.Storage.EntitySystems // Does this player currently have the storage UI open? var uiOpen = component.SubscribedSessions.Contains(session); - Verb verb = new(); + ActivationVerb verb = new(); verb.Act = () => component.OpenStorageUI(args.User); if (uiOpen) { diff --git a/Content.Server/Strip/StrippableSystem.cs b/Content.Server/Strip/StrippableSystem.cs index 61557d73e6..7f93355b41 100644 --- a/Content.Server/Strip/StrippableSystem.cs +++ b/Content.Server/Strip/StrippableSystem.cs @@ -20,7 +20,7 @@ namespace Content.Server.Strip { base.Initialize(); - SubscribeLocalEvent(AddStripVerb); + SubscribeLocalEvent>(AddStripVerb); SubscribeLocalEvent(OnDidEquip); SubscribeLocalEvent(OnDidUnequip); SubscribeLocalEvent(OnCompInit); @@ -93,7 +93,7 @@ namespace Content.Server.Strip strippableComponent.UserInterface.SetState(new StrippingBoundUserInterfaceState(inventory, hands, cuffs)); } - private void AddStripVerb(EntityUid uid, StrippableComponent component, GetOtherVerbsEvent args) + private void AddStripVerb(EntityUid uid, StrippableComponent component, GetVerbsEvent args) { if (args.Hands == null || !args.CanAccess || !args.CanInteract || args.Target == args.User) return; diff --git a/Content.Server/Tabletop/TabletopSystem.cs b/Content.Server/Tabletop/TabletopSystem.cs index 3f69d808a1..88a2ff9254 100644 --- a/Content.Server/Tabletop/TabletopSystem.cs +++ b/Content.Server/Tabletop/TabletopSystem.cs @@ -28,7 +28,7 @@ namespace Content.Server.Tabletop SubscribeLocalEvent(OnGameShutdown); SubscribeLocalEvent(OnPlayerDetached); SubscribeLocalEvent(OnGamerShutdown); - SubscribeLocalEvent(AddPlayGameVerb); + SubscribeLocalEvent>(AddPlayGameVerb); InitializeMap(); InitializeDraggable(); @@ -37,7 +37,7 @@ namespace Content.Server.Tabletop /// /// Add a verb that allows the player to start playing a tabletop game. /// - private void AddPlayGameVerb(EntityUid uid, TabletopGameComponent component, GetActivationVerbsEvent args) + private void AddPlayGameVerb(EntityUid uid, TabletopGameComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) return; @@ -45,7 +45,7 @@ namespace Content.Server.Tabletop if (!EntityManager.TryGetComponent(args.User, out var actor)) return; - Verb verb = new(); + ActivationVerb verb = new(); verb.Text = Loc.GetString("tabletop-verb-play-game"); verb.IconTexture = "/Textures/Interface/VerbIcons/die.svg.192dpi.png"; verb.Act = () => OpenSessionFor(actor.PlayerSession, uid); diff --git a/Content.Server/UserInterface/ActivatableUISystem.cs b/Content.Server/UserInterface/ActivatableUISystem.cs index f64dca4648..1eae822e41 100644 --- a/Content.Server/UserInterface/ActivatableUISystem.cs +++ b/Content.Server/UserInterface/ActivatableUISystem.cs @@ -33,10 +33,10 @@ namespace Content.Server.UserInterface SubscribeLocalEvent(OnParentChanged); SubscribeLocalEvent(OnUIClose); - SubscribeLocalEvent(AddOpenUiVerb); + SubscribeLocalEvent>(AddOpenUiVerb); } - private void AddOpenUiVerb(EntityUid uid, ActivatableUIComponent component, GetActivationVerbsEvent args) + private void AddOpenUiVerb(EntityUid uid, ActivatableUIComponent component, GetVerbsEvent args) { if (!args.CanAccess) return; @@ -44,7 +44,7 @@ namespace Content.Server.UserInterface if (!args.CanInteract && !HasComp(args.User)) return; - Verb verb = new(); + ActivationVerb verb = new(); verb.Act = () => InteractUI(args.User, component); verb.Text = Loc.GetString("ui-verb-toggle-open"); // TODO VERBS add "open UI" icon? diff --git a/Content.Server/Verbs/Commands/InvokeVerbCommand.cs b/Content.Server/Verbs/Commands/InvokeVerbCommand.cs index ec30a335de..c450b0532a 100644 --- a/Content.Server/Verbs/Commands/InvokeVerbCommand.cs +++ b/Content.Server/Verbs/Commands/InvokeVerbCommand.cs @@ -1,12 +1,8 @@ -using System; using System.Linq; using Content.Server.Administration; using Content.Shared.Administration; using Content.Shared.Verbs; using Robust.Shared.Console; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; -using Robust.Shared.Localization; namespace Content.Server.Verbs.Commands { @@ -68,28 +64,29 @@ namespace Content.Server.Verbs.Commands } var verbName = args[2].ToLowerInvariant(); - var verbs = verbSystem.GetLocalVerbs(target, playerEntity.Value, VerbType.All, true); + var verbs = verbSystem.GetLocalVerbs(target, playerEntity.Value, Verb.VerbTypes, true); - if ((Enum.TryParse(typeof(VerbType), verbName, ignoreCase: true, out var vtype) && - vtype is VerbType key) && - verbs.TryGetValue(key, out var vset) && - vset.Any()) + + // if the "verb name" is actually a verb-type, try run any verb of that type. + var verbType = Verb.VerbTypes.FirstOrDefault(x => x.Name == verbName); + if (verbType != null) { - verbSystem.ExecuteVerb(vset.First(), playerEntity.Value, target, forced: true); - shell.WriteLine(Loc.GetString("invoke-verb-command-success", ("verb", verbName), ("target", target), ("player", playerEntity))); - return; + var verb = verbs.FirstOrDefault(v => v.GetType() == verbType); + if (verb != null) + { + verbSystem.ExecuteVerb(verb, playerEntity.Value, target, forced: true); + shell.WriteLine(Loc.GetString("invoke-verb-command-success", ("verb", verbName), ("target", target), ("player", playerEntity))); + return; + } } - foreach (var (_, set) in verbs) + foreach (var verb in verbs) { - foreach (var verb in set) + if (verb.Text.ToLowerInvariant() == verbName) { - if (verb.Text.ToLowerInvariant() == verbName) - { - verbSystem.ExecuteVerb(verb, playerEntity.Value, target, forced: true); - shell.WriteLine(Loc.GetString("invoke-verb-command-success", ("verb", verb.Text), ("target", target), ("player", playerEntity))); - return; - } + verbSystem.ExecuteVerb(verb, playerEntity.Value, target, forced: true); + shell.WriteLine(Loc.GetString("invoke-verb-command-success", ("verb", verb.Text), ("target", target), ("player", playerEntity))); + return; } } diff --git a/Content.Server/Verbs/Commands/ListVerbsCommand.cs b/Content.Server/Verbs/Commands/ListVerbsCommand.cs index b4af5bccd7..c8ffdfc116 100644 --- a/Content.Server/Verbs/Commands/ListVerbsCommand.cs +++ b/Content.Server/Verbs/Commands/ListVerbsCommand.cs @@ -1,10 +1,11 @@ -using Content.Server.Administration; +using Content.Server.Administration; using Content.Shared.Administration; using Content.Shared.Verbs; using Robust.Shared.Console; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using System.Linq; namespace Content.Server.Verbs.Commands { @@ -65,14 +66,11 @@ namespace Content.Server.Verbs.Commands return; } - var verbs = verbSystem.GetLocalVerbs(target, playerEntity.Value, VerbType.All, true); + var verbs = verbSystem.GetLocalVerbs(target, playerEntity.Value, Verb.VerbTypes); - foreach (var (type, set) in verbs) + foreach (var verb in verbs) { - foreach (var verb in set) - { - shell.WriteLine(Loc.GetString("list-verbs-verb-listing", ("type", type), ("verb", verb.Text))); - } + shell.WriteLine(Loc.GetString("list-verbs-verb-listing", ("type", verb.GetType().Name), ("verb", verb.Text))); } } } diff --git a/Content.Server/Verbs/VerbSystem.cs b/Content.Server/Verbs/VerbSystem.cs index ea68499577..bdb82fdb76 100644 --- a/Content.Server/Verbs/VerbSystem.cs +++ b/Content.Server/Verbs/VerbSystem.cs @@ -6,10 +6,8 @@ using Content.Shared.Database; using Content.Shared.Hands.Components; using Content.Shared.Verbs; using Robust.Server.Player; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; -using Robust.Shared.Log; using Robust.Shared.Player; +using System.Linq; namespace Content.Server.Verbs { @@ -49,8 +47,19 @@ namespace Content.Server.Verbs var force = args.AdminRequest && eventArgs.SenderSession is IPlayerSession playerSession && _adminMgr.HasAdminFlag(playerSession, AdminFlags.Admin); + List verbTypes = new(); + foreach (var key in args.VerbTypes) + { + var type = Verb.VerbTypes.FirstOrDefault(x => x.Name == key); + + if (type != null) + verbTypes.Add(type); + else + Logger.Error($"Unknown verb type received: {key}"); + } + var response = - new VerbsResponseEvent(args.EntityUid, GetLocalVerbs(args.EntityUid, attached, args.Type, force)); + new VerbsResponseEvent(args.EntityUid, GetLocalVerbs(args.EntityUid, attached, verbTypes, force)); RaiseNetworkEvent(response, player.ConnectedClient); } diff --git a/Content.Server/Weapon/Ranged/GunSystem.AmmoBox.cs b/Content.Server/Weapon/Ranged/GunSystem.AmmoBox.cs index 0ed0d18646..4ad3cdcc51 100644 --- a/Content.Server/Weapon/Ranged/GunSystem.AmmoBox.cs +++ b/Content.Server/Weapon/Ranged/GunSystem.AmmoBox.cs @@ -19,7 +19,7 @@ public sealed partial class GunSystem { // Probably needs combining with magazines in future given the common functionality. - private void OnAmmoBoxAltVerbs(EntityUid uid, AmmoBoxComponent component, GetAlternativeVerbsEvent args) + private void OnAmmoBoxAltVerbs(EntityUid uid, AmmoBoxComponent component, GetVerbsEvent args) { if (args.Hands == null || !args.CanAccess || !args.CanInteract) return; @@ -27,7 +27,7 @@ public sealed partial class GunSystem if (component.AmmoLeft == 0) return; - Verb verb = new() + AlternativeVerb verb = new() { Text = Loc.GetString("dump-vert-get-data-text"), IconTexture = "/Textures/Interface/VerbIcons/eject.svg.192dpi.png", diff --git a/Content.Server/Weapon/Ranged/GunSystem.Bolt.cs b/Content.Server/Weapon/Ranged/GunSystem.Bolt.cs index de87a62234..1d0af36019 100644 --- a/Content.Server/Weapon/Ranged/GunSystem.Bolt.cs +++ b/Content.Server/Weapon/Ranged/GunSystem.Bolt.cs @@ -17,14 +17,14 @@ namespace Content.Server.Weapon.Ranged; public sealed partial class GunSystem { - private void AddToggleBoltVerb(EntityUid uid, BoltActionBarrelComponent component, GetInteractionVerbsEvent args) + private void AddToggleBoltVerb(EntityUid uid, BoltActionBarrelComponent component, GetVerbsEvent args) { if (args.Hands == null || !args.CanAccess || !args.CanInteract) return; - Verb verb = new() + InteractionVerb verb = new() { Text = component.BoltOpen ? Loc.GetString("close-bolt-verb-get-data-text") diff --git a/Content.Server/Weapon/Ranged/GunSystem.Magazine.cs b/Content.Server/Weapon/Ranged/GunSystem.Magazine.cs index 4d43720c57..1871392ecf 100644 --- a/Content.Server/Weapon/Ranged/GunSystem.Magazine.cs +++ b/Content.Server/Weapon/Ranged/GunSystem.Magazine.cs @@ -22,7 +22,7 @@ namespace Content.Server.Weapon.Ranged; public sealed partial class GunSystem { - private void AddEjectMagazineVerb(EntityUid uid, MagazineBarrelComponent component, GetAlternativeVerbsEvent args) + private void AddEjectMagazineVerb(EntityUid uid, MagazineBarrelComponent component, GetVerbsEvent args) { if (args.Hands == null || !args.CanAccess || @@ -34,7 +34,7 @@ public sealed partial class GunSystem if (component.MagNeedsOpenBolt && !component.BoltOpen) return; - Verb verb = new() + AlternativeVerb verb = new() { Text = MetaData(component.MagazineContainer.ContainedEntity!.Value).EntityName, Category = VerbCategory.Eject, @@ -43,7 +43,7 @@ public sealed partial class GunSystem args.Verbs.Add(verb); } - private void AddMagazineInteractionVerbs(EntityUid uid, MagazineBarrelComponent component, GetInteractionVerbsEvent args) + private void AddMagazineInteractionVerbs(EntityUid uid, MagazineBarrelComponent component, GetVerbsEvent args) { if (args.Hands == null || !args.CanAccess || @@ -51,7 +51,7 @@ public sealed partial class GunSystem return; // Toggle bolt verb - Verb toggleBolt = new() + InteractionVerb toggleBolt = new() { Text = component.BoltOpen ? Loc.GetString("close-bolt-verb-get-data-text") @@ -67,7 +67,7 @@ public sealed partial class GunSystem return; // Insert mag verb - Verb insert = new() + InteractionVerb insert = new() { Text = MetaData(@using).EntityName, Category = VerbCategory.Insert, diff --git a/Content.Server/Weapon/Ranged/GunSystem.Revolvers.cs b/Content.Server/Weapon/Ranged/GunSystem.Revolvers.cs index 9bd5f8bbe4..7afe7a13d4 100644 --- a/Content.Server/Weapon/Ranged/GunSystem.Revolvers.cs +++ b/Content.Server/Weapon/Ranged/GunSystem.Revolvers.cs @@ -175,7 +175,7 @@ public sealed partial class GunSystem appearance.SetData(AmmoVisuals.AmmoMax, component.Capacity); } - private void AddSpinVerb(EntityUid uid, RevolverBarrelComponent component, GetAlternativeVerbsEvent args) + private void AddSpinVerb(EntityUid uid, RevolverBarrelComponent component, GetVerbsEvent args) { if (args.Hands == null || !args.CanAccess || !args.CanInteract) return; @@ -183,7 +183,7 @@ public sealed partial class GunSystem if (component.Capacity <= 1 || component.ShotsLeft == 0) return; - Verb verb = new() + AlternativeVerb verb = new() { Text = Loc.GetString("spin-revolver-verb-get-data-text"), IconTexture = "/Textures/Interface/VerbIcons/refresh.svg.192dpi.png", diff --git a/Content.Server/Weapon/Ranged/GunSystem.cs b/Content.Server/Weapon/Ranged/GunSystem.cs index 40e92c8273..df7681ad2d 100644 --- a/Content.Server/Weapon/Ranged/GunSystem.cs +++ b/Content.Server/Weapon/Ranged/GunSystem.cs @@ -70,7 +70,7 @@ public sealed partial class GunSystem : EntitySystem SubscribeLocalEvent(OnAmmoBoxInteractUsing); SubscribeLocalEvent(OnAmmoBoxUse); SubscribeLocalEvent(OnAmmoBoxInteractHand); - SubscribeLocalEvent(OnAmmoBoxAltVerbs); + SubscribeLocalEvent>(OnAmmoBoxAltVerbs); SubscribeLocalEvent(OnRangedMagInit); SubscribeLocalEvent(OnRangedMagMapInit); @@ -96,7 +96,7 @@ public sealed partial class GunSystem : EntitySystem SubscribeLocalEvent(OnBoltInteractUsing); SubscribeLocalEvent(OnBoltGetState); SubscribeLocalEvent(OnBoltExamine); - SubscribeLocalEvent(AddToggleBoltVerb); + SubscribeLocalEvent>(AddToggleBoltVerb); SubscribeLocalEvent(OnMagazineInit); SubscribeLocalEvent(OnMagazineMapInit); @@ -104,8 +104,8 @@ public sealed partial class GunSystem : EntitySystem SubscribeLocalEvent(OnMagazineUse); SubscribeLocalEvent(OnMagazineInteractUsing); SubscribeLocalEvent(OnMagazineGetState); - SubscribeLocalEvent(AddMagazineInteractionVerbs); - SubscribeLocalEvent(AddEjectMagazineVerb); + SubscribeLocalEvent>(AddMagazineInteractionVerbs); + SubscribeLocalEvent>(AddEjectMagazineVerb); SubscribeLocalEvent(OnPumpGetState); SubscribeLocalEvent(OnPumpInit); @@ -118,7 +118,7 @@ public sealed partial class GunSystem : EntitySystem SubscribeLocalEvent(OnRevolverUse); SubscribeLocalEvent(OnRevolverInteractUsing); SubscribeLocalEvent(OnRevolverGetState); - SubscribeLocalEvent(AddSpinVerb); + SubscribeLocalEvent>(AddSpinVerb); SubscribeLocalEvent(OnSpeedLoaderInit); SubscribeLocalEvent(OnSpeedLoaderMapInit); diff --git a/Content.Server/Wieldable/WieldableSystem.cs b/Content.Server/Wieldable/WieldableSystem.cs index 4edfb8a905..3812f18cca 100644 --- a/Content.Server/Wieldable/WieldableSystem.cs +++ b/Content.Server/Wieldable/WieldableSystem.cs @@ -30,12 +30,12 @@ namespace Content.Server.Wieldable SubscribeLocalEvent(OnItemUnwielded); SubscribeLocalEvent(OnItemLeaveHand); SubscribeLocalEvent(OnVirtualItemDeleted); - SubscribeLocalEvent(AddToggleWieldVerb); + SubscribeLocalEvent>(AddToggleWieldVerb); SubscribeLocalEvent(OnMeleeHit); } - private void AddToggleWieldVerb(EntityUid uid, WieldableComponent component, GetInteractionVerbsEvent args) + private void AddToggleWieldVerb(EntityUid uid, WieldableComponent component, GetVerbsEvent args) { if (args.Hands == null || !args.CanAccess || !args.CanInteract) return; @@ -44,7 +44,7 @@ namespace Content.Server.Wieldable // verb. Or just don't add it to the list if the action is not executable. // TODO VERBS ICON + localization - Verb verb = new() + InteractionVerb verb = new() { Text = component.Wielded ? "Unwield" : "Wield", Act = component.Wielded diff --git a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs index 7e0231806d..05ecdc05f0 100644 --- a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs +++ b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs @@ -39,8 +39,8 @@ namespace Content.Shared.Containers.ItemSlots SubscribeLocalEvent(OnInteractHand); SubscribeLocalEvent(OnUseInHand); - SubscribeLocalEvent(AddEjectVerbs); - SubscribeLocalEvent(AddInteractionVerbsVerbs); + SubscribeLocalEvent>(AddEjectVerbs); + SubscribeLocalEvent>(AddInteractionVerbsVerbs); SubscribeLocalEvent(OnBreak); SubscribeLocalEvent(OnBreak); @@ -380,7 +380,7 @@ namespace Content.Shared.Containers.ItemSlots #endregion #region Verbs - private void AddEjectVerbs(EntityUid uid, ItemSlotsComponent itemSlots, GetAlternativeVerbsEvent args) + private void AddEjectVerbs(EntityUid uid, ItemSlotsComponent itemSlots, GetVerbsEvent args) { if (args.Hands == null || !args.CanAccess ||!args.CanInteract || !_actionBlockerSystem.CanPickup(args.User)) @@ -402,7 +402,7 @@ namespace Content.Shared.Containers.ItemSlots ? Loc.GetString(slot.Name) : EntityManager.GetComponent(slot.Item!.Value).EntityName ?? string.Empty; - Verb verb = new(); + AlternativeVerb verb = new(); verb.Act = () => TryEjectToHands(uid, slot, args.User, excludeUserAudio: true); if (slot.EjectVerbText == null) @@ -420,7 +420,7 @@ namespace Content.Shared.Containers.ItemSlots } } - private void AddInteractionVerbsVerbs(EntityUid uid, ItemSlotsComponent itemSlots, GetInteractionVerbsEvent args) + private void AddInteractionVerbsVerbs(EntityUid uid, ItemSlotsComponent itemSlots, GetVerbsEvent args) { if (args.Hands == null || !args.CanAccess || !args.CanInteract) return; @@ -437,7 +437,7 @@ namespace Content.Shared.Containers.ItemSlots ? Loc.GetString(slot.Name) : EntityManager.GetComponent(slot.Item!.Value).EntityName ?? string.Empty; - Verb takeVerb = new(); + InteractionVerb takeVerb = new(); takeVerb.Act = () => TryEjectToHands(uid, slot, args.User, excludeUserAudio: true); takeVerb.IconTexture = "/Textures/Interface/VerbIcons/pickup.svg.192dpi.png"; @@ -463,7 +463,7 @@ namespace Content.Shared.Containers.ItemSlots ? Loc.GetString(slot.Name) : Name(args.Using.Value) ?? string.Empty; - Verb insertVerb = new(); + InteractionVerb insertVerb = new(); insertVerb.Act = () => Insert(uid, slot, args.Using.Value, args.User, excludeUserAudio: true); if (slot.InsertVerbText != null) diff --git a/Content.Shared/Follower/FollowerSystem.cs b/Content.Shared/Follower/FollowerSystem.cs index f5b9fdface..ae57159ca1 100644 --- a/Content.Shared/Follower/FollowerSystem.cs +++ b/Content.Shared/Follower/FollowerSystem.cs @@ -15,12 +15,12 @@ public class FollowerSystem : EntitySystem { base.Initialize(); - SubscribeLocalEvent(OnGetAlternativeVerbs); + SubscribeLocalEvent>(OnGetAlternativeVerbs); SubscribeLocalEvent(OnFollowerMove); SubscribeLocalEvent(OnFollowedTerminating); } - private void OnGetAlternativeVerbs(GetAlternativeVerbsEvent ev) + private void OnGetAlternativeVerbs(GetVerbsEvent ev) { if (!HasComp(ev.User)) return; @@ -28,7 +28,7 @@ public class FollowerSystem : EntitySystem if (ev.User == ev.Target) return; - var verb = new Verb + var verb = new AlternativeVerb { Priority = 10, Act = (() => diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index e219effae8..3c1dfd285c 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -743,7 +743,7 @@ namespace Content.Shared.Interaction public bool AltInteract(EntityUid user, EntityUid target) { // Get list of alt-interact verbs - var verbs = _verbSystem.GetLocalVerbs(target, user, VerbType.Alternative)[VerbType.Alternative]; + var verbs = _verbSystem.GetLocalVerbs(target, user, typeof(AlternativeVerb)); if (!verbs.Any()) return false; diff --git a/Content.Shared/Item/ItemSystem.cs b/Content.Shared/Item/ItemSystem.cs index 54eaa0f2dc..e52d4f0c2b 100644 --- a/Content.Shared/Item/ItemSystem.cs +++ b/Content.Shared/Item/ItemSystem.cs @@ -12,7 +12,7 @@ namespace Content.Shared.Item public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(AddPickupVerb); + SubscribeLocalEvent>(AddPickupVerb); SubscribeLocalEvent(OnEquipped); SubscribeLocalEvent(OnUnequipped); @@ -52,7 +52,7 @@ namespace Content.Shared.Item component.Visible = false; } - private void AddPickupVerb(EntityUid uid, SharedItemComponent component, GetInteractionVerbsEvent args) + private void AddPickupVerb(EntityUid uid, SharedItemComponent component, GetVerbsEvent args) { if (args.Hands == null || args.Using != null || @@ -61,7 +61,7 @@ namespace Content.Shared.Item !args.Hands.CanPickupEntityToActiveHand(args.Target)) return; - Verb verb = new(); + InteractionVerb verb = new(); verb.Act = () => args.Hands.TryPickupEntityToActiveHand(args.Target); verb.IconTexture = "/Textures/Interface/VerbIcons/pickup.svg.192dpi.png"; diff --git a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs index ca98198be9..a36aec2a14 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs @@ -68,14 +68,14 @@ namespace Content.Shared.Pulling SubscribeLocalEvent(PullableHandlePullStarted); SubscribeLocalEvent(PullableHandlePullStopped); - SubscribeLocalEvent(AddPullVerbs); + SubscribeLocalEvent>(AddPullVerbs); CommandBinds.Builder .Bind(ContentKeyFunctions.MovePulledObject, new PointerInputCmdHandler(HandleMovePulledObject)) .Register(); } - private void AddPullVerbs(EntityUid uid, SharedPullableComponent component, GetOtherVerbsEvent args) + private void AddPullVerbs(EntityUid uid, SharedPullableComponent component, GetVerbsEvent args) { if (args.Hands == null || !args.CanAccess || !args.CanInteract) return; diff --git a/Content.Shared/Verbs/SharedVerbSystem.cs b/Content.Shared/Verbs/SharedVerbSystem.cs index 0a69457515..f19b264a63 100644 --- a/Content.Shared/Verbs/SharedVerbSystem.cs +++ b/Content.Shared/Verbs/SharedVerbSystem.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using Content.Shared.ActionBlocker; using Content.Shared.Hands.Components; @@ -5,6 +6,7 @@ using Content.Shared.Interaction; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Utility; namespace Content.Shared.Verbs { @@ -29,7 +31,7 @@ namespace Content.Shared.Verbs // Get the list of verbs. This effectively also checks that the requested verb is in fact a valid verb that // the user can perform. - var verbs = GetLocalVerbs(args.Target, user.Value, args.Type)[args.Type]; + var verbs = GetLocalVerbs(args.Target, user.Value, args.RequestedVerb.GetType()); // Note that GetLocalVerbs might waste time checking & preparing unrelated verbs even though we know // precisely which one we want to run. However, MOST entities will only have 1 or 2 verbs of a given type. @@ -44,9 +46,18 @@ namespace Content.Shared.Verbs /// Raises a number of events in order to get all verbs of the given type(s) defined in local systems. This /// does not request verbs from the server. /// - public virtual Dictionary> GetLocalVerbs(EntityUid target, EntityUid user, VerbType verbTypes, bool force = false) + public SortedSet GetLocalVerbs(EntityUid target, EntityUid user, Type type, bool force = false, bool all = false) { - Dictionary> verbs = new(); + return GetLocalVerbs(target, user, new List() { type }, force, all); + } + + /// + /// Raises a number of events in order to get all verbs of the given type(s) defined in local systems. This + /// does not request verbs from the server. + /// + public SortedSet GetLocalVerbs(EntityUid target, EntityUid user, List types, bool force = false, bool all = false) + { + SortedSet verbs = new(); // accessibility checks bool canAccess = false; @@ -80,32 +91,33 @@ namespace Content.Shared.Verbs } } - if ((verbTypes & VerbType.Interaction) == VerbType.Interaction) + if (types.Contains(typeof(InteractionVerb))) { - GetInteractionVerbsEvent getVerbEvent = new(user, target, @using, hands, canInteract, canAccess); - RaiseLocalEvent(target, getVerbEvent); - verbs.Add(VerbType.Interaction, getVerbEvent.Verbs); + var verbEvent = new GetVerbsEvent(user, target, @using, hands, canInteract, canAccess); + RaiseLocalEvent(target, verbEvent); + verbs.UnionWith(verbEvent.Verbs); } - if ((verbTypes & VerbType.Activation) == VerbType.Activation) + if (types.Contains(typeof(AlternativeVerb))) { - GetActivationVerbsEvent getVerbEvent = new(user, target, @using, hands, canInteract, canAccess); - RaiseLocalEvent(target, getVerbEvent); - verbs.Add(VerbType.Activation, getVerbEvent.Verbs); + var verbEvent = new GetVerbsEvent(user, target, @using, hands, canInteract, canAccess); + RaiseLocalEvent(target, verbEvent); + verbs.UnionWith(verbEvent.Verbs); } - if ((verbTypes & VerbType.Alternative) == VerbType.Alternative) + if (types.Contains(typeof(ActivationVerb))) { - GetAlternativeVerbsEvent getVerbEvent = new(user, target, @using, hands, canInteract, canAccess); - RaiseLocalEvent(target, getVerbEvent); - verbs.Add(VerbType.Alternative, getVerbEvent.Verbs); + var verbEvent = new GetVerbsEvent(user, target, @using, hands, canInteract, canAccess); + RaiseLocalEvent(target, verbEvent); + verbs.UnionWith(verbEvent.Verbs); } - if ((verbTypes & VerbType.Other) == VerbType.Other) + // generic verbs + if (types.Contains(typeof(Verb))) { - GetOtherVerbsEvent getVerbEvent = new(user, target, @using, hands, canInteract, canAccess); - RaiseLocalEvent(target, getVerbEvent); - verbs.Add(VerbType.Other, getVerbEvent.Verbs); + var verbEvent = new GetVerbsEvent(user, target, @using, hands, canInteract, canAccess); + RaiseLocalEvent(target, verbEvent); + verbs.UnionWith(verbEvent.Verbs); } return verbs; diff --git a/Content.Shared/Verbs/Verb.cs b/Content.Shared/Verbs/Verb.cs index 544f4c1cec..a2a7e14a4e 100644 --- a/Content.Shared/Verbs/Verb.cs +++ b/Content.Shared/Verbs/Verb.cs @@ -1,30 +1,33 @@ -using Content.Shared.Administration.Logs; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; using Robust.Shared.Utility; using System; using Content.Shared.Database; +using System.Collections.Generic; namespace Content.Shared.Verbs { - [Flags] - public enum VerbType - { - Interaction = 1, - Activation = 2, - Alternative = 4, - Other = 8, - All = 1+2+4+8 - } - /// /// Verb objects describe actions that a user can take. The actions can be specified via an Action, local /// events, or networked events. Verbs also provide text, icons, and categories for displaying in the /// context-menu. /// [Serializable, NetSerializable] - public sealed class Verb : IComparable + public class Verb : IComparable { + public static string DefaultTextStyleClass = "Verb"; + + /// + /// Determines the priority of this type of verb when displaying in the verb-menu. See . + /// + public virtual int TypePriority => 0; + + /// + /// Style class for drawing in the context menu + /// + public string TextStyleClass = DefaultTextStyleClass; + /// /// This is an action that will be run when the verb is "acted" out. /// @@ -161,7 +164,11 @@ namespace Content.Shared.Verbs if (obj is not Verb otherVerb) return -1; - // Sort first by priority + // Sort first by type-priority + if (TypePriority != otherVerb.TypePriority) + return otherVerb.TypePriority - TypePriority; + + // Then by verb-priority if (Priority != otherVerb.Priority) return otherVerb.Priority - Priority; @@ -180,5 +187,81 @@ namespace Content.Shared.Verbs // Finally, compare icon texture paths. Note that this matters for verbs that don't have any text (e.g., the rotate-verbs) return string.Compare(IconTexture, otherVerb.IconTexture, StringComparison.CurrentCulture); } + + /// + /// Collection of all verb types, along with string keys. + /// + /// + /// Useful when iterating over verb types, though maybe this should be obtained and stored via reflection or + /// something (list of all classes that inherit from Verb). Currently used for networking (apparently Type + /// is not serializable?), and resolving console commands. + /// + public static List VerbTypes = new() + { + { typeof(Verb) }, + { typeof(InteractionVerb) }, + { typeof(AlternativeVerb) }, + { typeof(ActivationVerb) }, + }; + } + + /// + /// Primary interaction verbs. This includes both use-in-hand and interacting with external entities. + /// + /// + /// These verbs those that involve using the hands or the currently held item on some entity. These verbs usually + /// correspond to interactions that can be triggered by left-clicking or using 'Z', and often depend on the + /// currently held item. These verbs are collectively shown first in the context menu. + /// + [Serializable, NetSerializable] + public sealed class InteractionVerb : Verb + { + public new static string DefaultTextStyleClass = "InteractionVerb"; + public override int TypePriority => 4; + + public InteractionVerb() : base() + { + TextStyleClass = DefaultTextStyleClass; + } + } + + /// + /// Verbs for alternative-interactions. + /// + /// + /// When interacting with an entity via alt + left-click/E/Z the highest priority alt-interact verb is executed. + /// These verbs are collectively shown second-to-last in the context menu. + /// + [Serializable, NetSerializable] + public sealed class AlternativeVerb : Verb + { + public override int TypePriority => 2; + public new static string DefaultTextStyleClass = "AlternativeVerb"; + + public AlternativeVerb() : base() + { + TextStyleClass = DefaultTextStyleClass; + } + } + + /// + /// Activation-type verbs. + /// + /// + /// These are verbs that activate an item in the world but are independent of the currently held items. For + /// example, opening a door or a GUI. These verbs should correspond to interactions that can be triggered by + /// using 'E', though many of those can also be triggered by left-mouse or 'Z' if there is no other interaction. + /// These verbs are collectively shown second in the context menu. + /// + [Serializable, NetSerializable] + public sealed class ActivationVerb : Verb + { + public override int TypePriority => 1; + public new static string DefaultTextStyleClass = "ActivationVerb"; + + public ActivationVerb() : base() + { + TextStyleClass = DefaultTextStyleClass; + } } } diff --git a/Content.Shared/Verbs/VerbEvents.cs b/Content.Shared/Verbs/VerbEvents.cs index 346b9d0bd6..a997fb59cb 100644 --- a/Content.Shared/Verbs/VerbEvents.cs +++ b/Content.Shared/Verbs/VerbEvents.cs @@ -1,19 +1,18 @@ -using System; -using System.Collections.Generic; using Content.Shared.ActionBlocker; using Content.Shared.Hands.Components; -using Robust.Shared.Containers; -using Robust.Shared.GameObjects; -using Robust.Shared.Serialization; using Content.Shared.Interaction; +using Robust.Shared.Containers; +using Robust.Shared.Serialization; +using Robust.Shared.Utility; namespace Content.Shared.Verbs { [Serializable, NetSerializable] - public class RequestServerVerbsEvent : EntityEventArgs + public sealed class RequestServerVerbsEvent : EntityEventArgs { public readonly EntityUid EntityUid; - public readonly VerbType Type; + + public readonly List VerbTypes = new(); /// /// If the target item is inside of some storage (e.g., backpack), this is the entity that owns that item @@ -23,121 +22,60 @@ namespace Content.Shared.Verbs public readonly bool AdminRequest; - public RequestServerVerbsEvent(EntityUid entityUid, VerbType type, EntityUid? slotOwner = null, bool adminRequest = false) + public RequestServerVerbsEvent(EntityUid entityUid, List verbTypes, EntityUid? slotOwner = null, bool adminRequest = false) { EntityUid = entityUid; - Type = type; SlotOwner = slotOwner; AdminRequest = adminRequest; + + foreach (var type in verbTypes) + { + DebugTools.Assert(typeof(Verb).IsAssignableFrom(type)); + VerbTypes.Add(type.Name); + } } } [Serializable, NetSerializable] - public class VerbsResponseEvent : EntityEventArgs + public sealed class VerbsResponseEvent : EntityEventArgs { - public readonly Dictionary>? Verbs; + public readonly List? Verbs; public readonly EntityUid Entity; - public VerbsResponseEvent(EntityUid entity, Dictionary>? verbs) + public VerbsResponseEvent(EntityUid entity, SortedSet? verbs) { Entity = entity; if (verbs == null) return; - // Apparently SortedSet is not serlializable. Cast to List. - Verbs = new(); - foreach (var entry in verbs) - { - Verbs.Add(entry.Key, new List(entry.Value)); - } + // Apparently SortedSet is not serializable, so we cast to List. + Verbs = new(verbs); } } [Serializable, NetSerializable] - public class ExecuteVerbEvent : EntityEventArgs + public sealed class ExecuteVerbEvent : EntityEventArgs { public readonly EntityUid Target; public readonly Verb RequestedVerb; - /// - /// The type of verb to try execute. Avoids having to get a list of all verbs on the receiving end. - /// - public readonly VerbType Type; - - public ExecuteVerbEvent(EntityUid target, Verb requestedVerb, VerbType type) + public ExecuteVerbEvent(EntityUid target, Verb requestedVerb) { Target = target; RequestedVerb = requestedVerb; - Type = type; } } - /// - /// Request primary interaction verbs. This includes both use-in-hand and interacting with external entities. - /// - /// - /// These verbs those that involve using the hands or the currently held item on some entity. These verbs usually - /// correspond to interactions that can be triggered by left-clicking or using 'Z', and often depend on the - /// currently held item. These verbs are collectively shown first in the context menu. - /// - public class GetInteractionVerbsEvent : GetVerbsEvent - { - public GetInteractionVerbsEvent(EntityUid user, EntityUid target, EntityUid? @using, SharedHandsComponent? hands, - bool canInteract, bool canAccess) : base(user, target, @using, hands, canInteract, canAccess) { } - - } - - /// - /// Request activation verbs. - /// - /// - /// These are verbs that activate an item in the world but are independent of the currently held items. For - /// example, opening a door or a GUI. These verbs should correspond to interactions that can be triggered by - /// using 'E', though many of those can also be triggered by left-mouse or 'Z' if there is no other interaction. - /// These verbs are collectively shown second in the context menu. - /// - public class GetActivationVerbsEvent : GetVerbsEvent - { - public GetActivationVerbsEvent(EntityUid user, EntityUid target, EntityUid? @using, SharedHandsComponent? hands, - bool canInteract, bool canAccess) : base(user, target, @using, hands, canInteract, canAccess) { } - } - - /// - /// Request alternative-interaction verbs. - /// - /// - /// When interacting with an entity via alt + left-click/E/Z the highest priority alt-interact verb is executed. - /// These verbs are collectively shown second-to-last in the context menu. - /// - public class GetAlternativeVerbsEvent : GetVerbsEvent - { - public GetAlternativeVerbsEvent(EntityUid user, EntityUid target, EntityUid? @using, SharedHandsComponent? hands, - bool canInteract, bool canAccess) : base(user, target, @using, hands, canInteract, canAccess) { } - } - - /// - /// Request Miscellaneous verbs. - /// - /// - /// Includes (nearly) global interactions like "examine", "pull", or "debug". These verbs are collectively shown - /// last in the context menu. - /// - public class GetOtherVerbsEvent : GetVerbsEvent - { - public GetOtherVerbsEvent(EntityUid user, EntityUid target, EntityUid? @using, SharedHandsComponent? hands, - bool canInteract, bool canAccess) : base(user, target, @using, hands, canInteract, canAccess) { } - } - /// /// Directed event that requests verbs from any systems/components on a target entity. /// - public class GetVerbsEvent : EntityEventArgs + public sealed class GetVerbsEvent : EntityEventArgs where TVerb : Verb { /// /// Event output. Set of verbs that can be executed. /// - public readonly SortedSet Verbs = new(); + public readonly SortedSet Verbs = new(); /// /// Can the user physically access the target? @@ -180,7 +118,7 @@ namespace Content.Shared.Verbs /// The entity currently being held by the active hand. /// /// - /// This is only ever not null when is true and the user + /// This is only ever not null when is true and the user /// has hands. /// public readonly EntityUid? Using;