From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Thu, 2 May 2024 23:37:20 +0000 (+1200) Subject: Fix UI interaction priority (#27631) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=3c3c2daf26eb4c215e3de26120e5be593ebb3620;p=space-station-14.git Fix UI interaction priority (#27631) --- diff --git a/Content.Shared/UserInterface/ActivatableUISystem.cs b/Content.Shared/UserInterface/ActivatableUISystem.cs index 5d408012bd..3ac8835dd0 100644 --- a/Content.Shared/UserInterface/ActivatableUISystem.cs +++ b/Content.Shared/UserInterface/ActivatableUISystem.cs @@ -5,6 +5,7 @@ using Content.Shared.Hands; using Content.Shared.Hands.Components; using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; +using Content.Shared.Interaction.Events; using Content.Shared.Popups; using Content.Shared.Verbs; using Robust.Shared.Containers; @@ -27,6 +28,7 @@ public sealed partial class ActivatableUISystem : EntitySystem { base.Initialize(); + SubscribeLocalEvent(OnUseInHand); SubscribeLocalEvent(OnActivate); SubscribeLocalEvent(OnInteractUsing); SubscribeLocalEvent(OnHandDeselected); @@ -99,6 +101,9 @@ public sealed partial class ActivatableUISystem : EntitySystem if (!args.CanAccess) return false; + if (!component.RequiredItems?.IsValid(args.Using ?? default, EntityManager) ?? false) + return false; + if (component.RequireHands) { if (args.Hands == null) @@ -117,6 +122,20 @@ public sealed partial class ActivatableUISystem : EntitySystem return args.CanInteract || component.AllowSpectator && HasComp(args.User); } + private void OnUseInHand(EntityUid uid, ActivatableUIComponent component, UseInHandEvent args) + { + if (args.Handled) + return; + + if (component.VerbOnly) + return; + + if (component.RequiredItems != null) + return; + + args.Handled = InteractUI(args.User, uid, component); + } + private void OnActivate(EntityUid uid, ActivatableUIComponent component, ActivateInWorldEvent args) { if (args.Handled)