]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Allow a specific hand to be passed into TrySpawnVirtualItemInHand (#31124)
authorDrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com>
Mon, 19 Aug 2024 02:42:22 +0000 (19:42 -0700)
committerGitHub <noreply@github.com>
Mon, 19 Aug 2024 02:42:22 +0000 (20:42 -0600)
Content.Shared/Inventory/VirtualItem/SharedVirtualItemSystem.cs

index 8b9c052c8d5b0c04f83aea2dacb94584746b220f..8e62c5163daa3808330cc0a61e1a7fb417020735 100644 (file)
@@ -1,5 +1,6 @@
 using System.Diagnostics.CodeAnalysis;
 using Content.Shared.Hands;
+using Content.Shared.Hands.Components;
 using Content.Shared.Hands.EntitySystems;
 using Content.Shared.Interaction;
 using Content.Shared.Interaction.Events;
@@ -94,10 +95,10 @@ public abstract class SharedVirtualItemSystem : EntitySystem
     }
 
     /// <inheritdoc cref="TrySpawnVirtualItemInHand(Robust.Shared.GameObjects.EntityUid,Robust.Shared.GameObjects.EntityUid,bool)"/>
-    public bool TrySpawnVirtualItemInHand(EntityUid blockingEnt, EntityUid user, [NotNullWhen(true)] out EntityUid? virtualItem, bool dropOthers = false)
+    public bool TrySpawnVirtualItemInHand(EntityUid blockingEnt, EntityUid user, [NotNullWhen(true)] out EntityUid? virtualItem, bool dropOthers = false, Hand? empty = null)
     {
         virtualItem = null;
-        if (!_handsSystem.TryGetEmptyHand(user, out var empty))
+        if (empty == null && !_handsSystem.TryGetEmptyHand(user, out empty))
         {
             if (!dropOthers)
                 return false;