Fix some buckle interactions (#29293)
This commit is contained in:
@@ -13,10 +13,11 @@ public abstract partial class SharedBuckleSystem
|
|||||||
private void InitializeInteraction()
|
private void InitializeInteraction()
|
||||||
{
|
{
|
||||||
SubscribeLocalEvent<StrapComponent, GetVerbsEvent<InteractionVerb>>(AddStrapVerbs);
|
SubscribeLocalEvent<StrapComponent, GetVerbsEvent<InteractionVerb>>(AddStrapVerbs);
|
||||||
SubscribeLocalEvent<StrapComponent, InteractHandEvent>(OnStrapInteractHand);
|
SubscribeLocalEvent<StrapComponent, InteractHandEvent>(OnStrapInteractHand, after: [typeof(InteractionPopupSystem)]);
|
||||||
SubscribeLocalEvent<StrapComponent, DragDropTargetEvent>(OnStrapDragDropTarget);
|
SubscribeLocalEvent<StrapComponent, DragDropTargetEvent>(OnStrapDragDropTarget);
|
||||||
SubscribeLocalEvent<StrapComponent, CanDropTargetEvent>(OnCanDropTarget);
|
SubscribeLocalEvent<StrapComponent, CanDropTargetEvent>(OnCanDropTarget);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<BuckleComponent, InteractHandEvent>(OnBuckleInteractHand, after: [typeof(InteractionPopupSystem)]);
|
||||||
SubscribeLocalEvent<BuckleComponent, GetVerbsEvent<InteractionVerb>>(AddUnbuckleVerb);
|
SubscribeLocalEvent<BuckleComponent, GetVerbsEvent<InteractionVerb>>(AddUnbuckleVerb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,6 +59,9 @@ public abstract partial class SharedBuckleSystem
|
|||||||
if (args.Handled)
|
if (args.Handled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!component.Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!TryComp(args.User, out BuckleComponent? buckle))
|
if (!TryComp(args.User, out BuckleComponent? buckle))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -68,7 +72,20 @@ public abstract partial class SharedBuckleSystem
|
|||||||
else
|
else
|
||||||
return;
|
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<BuckleComponent> 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<InteractionVerb> args)
|
private void AddStrapVerbs(EntityUid uid, StrapComponent component, GetVerbsEvent<InteractionVerb> args)
|
||||||
|
|||||||
Reference in New Issue
Block a user