diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Interaction.cs b/Content.Shared/Buckle/SharedBuckleSystem.Interaction.cs index 8c2d0b8ee1..463e0d5596 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Interaction.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Interaction.cs @@ -13,10 +13,11 @@ public abstract partial class SharedBuckleSystem private void InitializeInteraction() { SubscribeLocalEvent>(AddStrapVerbs); - SubscribeLocalEvent(OnStrapInteractHand); + SubscribeLocalEvent(OnStrapInteractHand, after: [typeof(InteractionPopupSystem)]); SubscribeLocalEvent(OnStrapDragDropTarget); SubscribeLocalEvent(OnCanDropTarget); + SubscribeLocalEvent(OnBuckleInteractHand, after: [typeof(InteractionPopupSystem)]); SubscribeLocalEvent>(AddUnbuckleVerb); } @@ -58,6 +59,9 @@ public abstract partial class SharedBuckleSystem if (args.Handled) return; + if (!component.Enabled) + return; + if (!TryComp(args.User, out BuckleComponent? buckle)) return; @@ -68,7 +72,20 @@ public abstract partial class SharedBuckleSystem else return; - args.Handled = true; // This generate popups on failure. + // TODO BUCKLE add out bool for whether a pop-up was generated or not. + args.Handled = true; + } + + private void OnBuckleInteractHand(Entity ent, ref InteractHandEvent args) + { + if (args.Handled) + return; + + if (ent.Comp.BuckledTo != null) + TryUnbuckle(ent!, args.User, popup: true); + + // TODO BUCKLE add out bool for whether a pop-up was generated or not. + args.Handled = true; } private void AddStrapVerbs(EntityUid uid, StrapComponent component, GetVerbsEvent args)