From 4fcbb99072155ce99454d05eae6c43bd87f275ba Mon Sep 17 00:00:00 2001 From: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Date: Sun, 18 Aug 2024 15:24:28 -0700 Subject: [PATCH] Fix collidable held entities blocking themselves while being dropped (#31119) --- .../Hands/EntitySystems/SharedHandsSystem.Drop.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs index bdc17be91a..76575df2fd 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs @@ -3,7 +3,6 @@ using Content.Shared.Hands.Components; using Content.Shared.Interaction; using Content.Shared.Inventory.VirtualItem; using Content.Shared.Tag; -using Content.Shared.Interaction.Events; using Robust.Shared.Containers; using Robust.Shared.Map; @@ -144,7 +143,7 @@ public abstract partial class SharedHandsSystem var (itemPos, itemRot) = TransformSystem.GetWorldPositionRotation(entity); var origin = new MapCoordinates(itemPos, itemXform.MapID); var target = TransformSystem.ToMapCoordinates(targetDropLocation.Value); - TransformSystem.SetWorldPositionRotation(entity, GetFinalDropCoordinates(uid, origin, target), itemRot); + TransformSystem.SetWorldPositionRotation(entity, GetFinalDropCoordinates(uid, origin, target, entity), itemRot); return true; } @@ -173,7 +172,7 @@ public abstract partial class SharedHandsSystem /// /// Calculates the final location a dropped item will end up at, accounting for max drop range and collision along the targeted drop path, Does a check to see if a user should bypass those checks as well. /// - private Vector2 GetFinalDropCoordinates(EntityUid user, MapCoordinates origin, MapCoordinates target) + private Vector2 GetFinalDropCoordinates(EntityUid user, MapCoordinates origin, MapCoordinates target, EntityUid held) { var dropVector = target.Position - origin.Position; var requestedDropDistance = dropVector.Length(); @@ -187,7 +186,7 @@ public abstract partial class SharedHandsSystem target = new MapCoordinates(origin.Position + dropVector, target.MapId); } - dropLength = _interactionSystem.UnobstructedDistance(origin, target, predicate: e => e == user); + dropLength = _interactionSystem.UnobstructedDistance(origin, target, predicate: e => e == user || e == held); } if (dropLength < requestedDropDistance)