From 9bde78a25f8d26e631283eeeb5143fb1b9a61e5a Mon Sep 17 00:00:00 2001
From: Booblesnoot42 <108703193+Booblesnoot42@users.noreply.github.com>
Date: Wed, 19 Feb 2025 08:46:16 -0500
Subject: [PATCH] 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
---
.../Hands/EntitySystems/SharedHandsSystem.Pickup.cs | 7 +++++++
Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs
index 7bc0a8025f..101d206acd 100644
--- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs
+++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs
@@ -197,12 +197,14 @@ public abstract partial class SharedHandsSystem : EntitySystem
///
/// Puts an item into any hand, preferring the active hand, or puts it on the floor.
///
+ /// If true, the item will be dropped near the owner of the hand if possible.
public void PickupOrDrop(
EntityUid? uid,
EntityUid entity,
bool checkActionBlocker = true,
bool animateUser = false,
bool animate = true,
+ bool dropNear = false,
HandsComponent? handsComp = 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.
// Currently this just checks the direct parent, so items can still teleport through containers.
ContainerSystem.AttachParentToContainerOrGrid((entity, Transform(entity)));
+
+ if (dropNear && uid.HasValue)
+ {
+ TransformSystem.PlaceNextTo(entity, uid.Value);
+ }
}
}
diff --git a/Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs b/Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs
index 94d839a420..9ddcb423b4 100644
--- a/Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs
+++ b/Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs
@@ -55,7 +55,7 @@ public sealed partial class EncryptionKeySystem : EntitySystem
_container.EmptyContainer(component.KeyContainer, reparent: false);
foreach (var ent in contained)
{
- _hands.PickupOrDrop(args.User, ent);
+ _hands.PickupOrDrop(args.User, ent, dropNear: true);
}
if (!_timing.IsFirstTimePredicted)