Fixing intercom encryption key dropping (#34582)

* Added optional param to PickupOrDrop to allow the item to be moved next to the owner of the hand component

* cleanup placement code
This commit is contained in:
Booblesnoot42
2025-02-19 08:46:16 -05:00
committed by GitHub
parent 353e988520
commit 9bde78a25f
2 changed files with 8 additions and 1 deletions

View File

@@ -197,12 +197,14 @@ public abstract partial class SharedHandsSystem : EntitySystem
/// <summary> /// <summary>
/// Puts an item into any hand, preferring the active hand, or puts it on the floor. /// Puts an item into any hand, preferring the active hand, or puts it on the floor.
/// </summary> /// </summary>
/// <param name="dropNear">If true, the item will be dropped near the owner of the hand if possible.</param>
public void PickupOrDrop( public void PickupOrDrop(
EntityUid? uid, EntityUid? uid,
EntityUid entity, EntityUid entity,
bool checkActionBlocker = true, bool checkActionBlocker = true,
bool animateUser = false, bool animateUser = false,
bool animate = true, bool animate = true,
bool dropNear = false,
HandsComponent? handsComp = null, HandsComponent? handsComp = null,
ItemComponent? item = null) ItemComponent? item = null)
{ {
@@ -214,6 +216,11 @@ public abstract partial class SharedHandsSystem : EntitySystem
// TODO make this check upwards for any container, and parent to that. // TODO make this check upwards for any container, and parent to that.
// Currently this just checks the direct parent, so items can still teleport through containers. // Currently this just checks the direct parent, so items can still teleport through containers.
ContainerSystem.AttachParentToContainerOrGrid((entity, Transform(entity))); ContainerSystem.AttachParentToContainerOrGrid((entity, Transform(entity)));
if (dropNear && uid.HasValue)
{
TransformSystem.PlaceNextTo(entity, uid.Value);
}
} }
} }

View File

@@ -55,7 +55,7 @@ public sealed partial class EncryptionKeySystem : EntitySystem
_container.EmptyContainer(component.KeyContainer, reparent: false); _container.EmptyContainer(component.KeyContainer, reparent: false);
foreach (var ent in contained) foreach (var ent in contained)
{ {
_hands.PickupOrDrop(args.User, ent); _hands.PickupOrDrop(args.User, ent, dropNear: true);
} }
if (!_timing.IsFirstTimePredicted) if (!_timing.IsFirstTimePredicted)