Allow a specific hand to be passed into TrySpawnVirtualItemInHand (#31124)

This commit is contained in:
DrSmugleaf
2024-08-18 19:42:22 -07:00
committed by GitHub
parent 3dcfe0d850
commit 7e3b9fb2fe

View File

@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Content.Shared.Hands; using Content.Shared.Hands;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems; using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Interaction.Events; 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)"/> /// <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; virtualItem = null;
if (!_handsSystem.TryGetEmptyHand(user, out var empty)) if (empty == null && !_handsSystem.TryGetEmptyHand(user, out empty))
{ {
if (!dropOthers) if (!dropOthers)
return false; return false;