Fix foldables (#19717)

This commit is contained in:
Nemanja
2023-08-31 22:30:40 -04:00
committed by GitHub
parent 4cfc578011
commit f5d961e7be
6 changed files with 82 additions and 63 deletions

View File

@@ -2,6 +2,7 @@
using Content.Shared.Buckle.Components;
using Content.Shared.Destructible;
using Content.Shared.DragDrop;
using Content.Shared.Foldable;
using Content.Shared.Interaction;
using Content.Shared.Storage;
using Content.Shared.Verbs;
@@ -31,6 +32,7 @@ public abstract partial class SharedBuckleSystem
SubscribeLocalEvent<StrapComponent, DragDropTargetEvent>(OnStrapDragDropTarget);
SubscribeLocalEvent<StrapComponent, CanDropTargetEvent>(OnCanDropTarget);
SubscribeLocalEvent<StrapComponent, FoldAttemptEvent>(OnAttemptFold);
SubscribeLocalEvent<StrapComponent, MoveEvent>(OnStrapMoveEvent);
}
@@ -115,7 +117,7 @@ public abstract partial class SharedBuckleSystem
if (args.Handled)
return;
ToggleBuckle(args.User, args.User, uid);
args.Handled = ToggleBuckle(args.User, args.User, uid);
}
private void AddStrapVerbs(EntityUid uid, StrapComponent component, GetVerbsEvent<InteractionVerb> args)
@@ -199,6 +201,14 @@ public abstract partial class SharedBuckleSystem
args.Handled = true;
}
private void OnAttemptFold(EntityUid uid, StrapComponent component, ref FoldAttemptEvent args)
{
if (args.Cancelled)
return;
args.Cancelled = component.BuckledEntities.Count != 0;
}
private void OnStrapDragDropTarget(EntityUid uid, StrapComponent component, ref DragDropTargetEvent args)
{
if (!StrapCanDragDropOn(uid, args.User, uid, args.Dragged, component))