diff --git a/Content.Client/Interaction/DragDropSystem.cs b/Content.Client/Interaction/DragDropSystem.cs index aab6a62776..a34cd0f5b1 100644 --- a/Content.Client/Interaction/DragDropSystem.cs +++ b/Content.Client/Interaction/DragDropSystem.cs @@ -518,6 +518,9 @@ public sealed class DragDropSystem : SharedDragDropSystem if (dropEv2.Handled) return dropEv2.CanDrop; + if (dropEv.Handled && dropEv.CanDrop) + return true; + return null; } diff --git a/Content.Shared/Foldable/DeployFoldableSystem.cs b/Content.Shared/Foldable/DeployFoldableSystem.cs index fa2e3f8789..16315cde69 100644 --- a/Content.Shared/Foldable/DeployFoldableSystem.cs +++ b/Content.Shared/Foldable/DeployFoldableSystem.cs @@ -1,3 +1,4 @@ +using Content.Shared.DragDrop; using Content.Shared.Hands.Components; using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; @@ -14,6 +15,38 @@ public sealed class DeployFoldableSystem : EntitySystem base.Initialize(); SubscribeLocalEvent(OnAfterInteract); + SubscribeLocalEvent(OnCanDrag); + SubscribeLocalEvent(OnDragDropDragged); + SubscribeLocalEvent(OnCanDropDragged); + } + + private void OnCanDropDragged(Entity ent, ref CanDropDraggedEvent args) + { + if (args.User != args.Target) + return; + + args.Handled = true; + args.CanDrop = true; + } + + private void OnDragDropDragged(Entity ent, ref DragDropDraggedEvent args) + { + if (!TryComp(ent, out var foldable) + || !_foldable.TrySetFolded(ent, foldable, true)) + return; + + _hands.PickupOrDrop(args.User, ent.Owner); + + args.Handled = true; + } + + private void OnCanDrag(Entity ent, ref CanDragEvent args) + { + if (!TryComp(ent, out var foldable) + || foldable.IsFolded) + return; + + args.Handled = true; } private void OnAfterInteract(Entity ent, ref AfterInteractEvent args) diff --git a/Content.Shared/Strip/SharedStrippableSystem.cs b/Content.Shared/Strip/SharedStrippableSystem.cs index 38e2f9fd7a..e42f6e3aa7 100644 --- a/Content.Shared/Strip/SharedStrippableSystem.cs +++ b/Content.Shared/Strip/SharedStrippableSystem.cs @@ -61,11 +61,12 @@ public abstract class SharedStrippableSystem : EntitySystem private void OnCanDropOn(EntityUid uid, StrippingComponent component, ref CanDropTargetEvent args) { - args.Handled = true; - args.CanDrop |= uid == args.User && - HasComp(args.Dragged) && - HasComp(args.User) && - HasComp(args.User); + var val = uid == args.User && + HasComp(args.Dragged) && + HasComp(args.User) && + HasComp(args.User); + args.Handled |= val; + args.CanDrop |= val; } private void OnCanDrop(EntityUid uid, StrippableComponent component, ref CanDropDraggedEvent args)