diff --git a/Content.Client/UserInterface/Systems/Actions/ActionUIController.cs b/Content.Client/UserInterface/Systems/Actions/ActionUIController.cs index c79f0f80f9..5d9706452c 100644 --- a/Content.Client/UserInterface/Systems/Actions/ActionUIController.cs +++ b/Content.Client/UserInterface/Systems/Actions/ActionUIController.cs @@ -15,6 +15,7 @@ using Content.Shared.Actions; using Content.Shared.Input; using Robust.Client.GameObjects; using Robust.Client.Graphics; +using Robust.Client.Input; using Robust.Client.Player; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controllers; @@ -42,6 +43,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged position && position >= 0) + _actions.RemoveAt(position); } } else if (button.TryReplaceWith(actionId.Value, _actionsSystem) && @@ -539,23 +546,22 @@ public sealed class ActionUIController : UIController, IOnStateChanged - { - Depress(args, true); - OnPressed(args); - }; - OnKeyBindUp += args => - { - Depress(args, false); - OnUnpressed(args); - }; + OnKeyBindDown += OnPressed; + OnKeyBindUp += OnUnpressed; TooltipSupplier = SupplyTooltip; } @@ -175,11 +167,23 @@ public sealed class ActionButton : Control, IEntityControl private void OnPressed(GUIBoundKeyEventArgs args) { + if (args.Function != EngineKeyFunctions.UIClick && args.Function != EngineKeyFunctions.UIRightClick) + return; + + if (args.Function == EngineKeyFunctions.UIRightClick) + Depress(args, true); + ActionPressed?.Invoke(args, this); } private void OnUnpressed(GUIBoundKeyEventArgs args) { + if (args.Function != EngineKeyFunctions.UIClick && args.Function != EngineKeyFunctions.UIRightClick) + return; + + if (args.Function == EngineKeyFunctions.UIRightClick) + Depress(args, false); + ActionUnpressed?.Invoke(args, this); } @@ -378,12 +382,6 @@ public sealed class ActionButton : Control, IEntityControl if (_action is not {Enabled: true}) return; - if (_depressed && !depress) - { - // fire the action - OnUnpressed(args); - } - _depressed = depress; DrawModeChanged(); }