]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fixing intercom encryption key dropping (#34582)
authorBooblesnoot42 <108703193+Booblesnoot42@users.noreply.github.com>
Wed, 19 Feb 2025 13:46:16 +0000 (08:46 -0500)
committerGitHub <noreply@github.com>
Wed, 19 Feb 2025 13:46:16 +0000 (14:46 +0100)
* Added optional param to PickupOrDrop to allow the item to be moved next to the owner of the hand component

* cleanup placement code

Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs
Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs

index 7bc0a8025fe16f8b3ec1c6d18004c2cbb9eed325..101d206acd8a6494fdbfaa811dddd2c55243aacd 100644 (file)
@@ -197,12 +197,14 @@ public abstract partial class SharedHandsSystem : EntitySystem
     /// <summary>
     ///     Puts an item into any hand, preferring the active hand, or puts it on the floor.
     /// </summary>
+    /// <param name="dropNear">If true, the item will be dropped near the owner of the hand if possible.</param>
     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);
+            }
         }
     }
 
index 94d839a4208240d4b82c6e8d935c496fad6db7bf..9ddcb423b421e0e14967c0c150b2d50a16f93a16 100644 (file)
@@ -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)