Allow pulling entities with full hands. (#5758)

This commit is contained in:
Leon Friedrich
2021-12-13 18:46:09 +13:00
committed by GitHub
parent 41a9bb1efa
commit 40dfc1f5ce

View File

@@ -65,6 +65,9 @@ namespace Content.Server.Hands.Systems
private static void HandlePullAttempt(EntityUid uid, HandsComponent component, PullAttemptMessage args)
{
if (args.Puller.Owner != uid)
return;
// Cancel pull if all hands full.
if (component.Hands.All(hand => !hand.IsEmpty))
args.Cancelled = true;
@@ -72,6 +75,9 @@ namespace Content.Server.Hands.Systems
private void HandlePullStarted(EntityUid uid, HandsComponent component, PullStartedMessage args)
{
if (args.Puller.Owner != uid)
return;
if (!_virtualItemSystem.TrySpawnVirtualItemInHand(args.Pulled.Owner, uid))
{
DebugTools.Assert("Unable to find available hand when starting pulling??");
@@ -80,6 +86,9 @@ namespace Content.Server.Hands.Systems
private void HandlePullStopped(EntityUid uid, HandsComponent component, PullStoppedMessage args)
{
if (args.Puller.Owner != uid)
return;
// Try find hand that is doing this pull.
// and clear it.
foreach (var hand in component.Hands)