using Content.Shared.Explosion;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
-using Content.Shared.IdentityManagement;
using Content.Shared.Input;
using Content.Shared.Inventory.VirtualItem;
using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Movement.Pulling.Systems;
using Content.Shared.Stacks;
using Content.Shared.Throwing;
-using Robust.Shared.Audio;
-using Robust.Shared.Audio.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Input.Binding;
using Robust.Shared.Map;
continue;
}
- QueueDel(hand.HeldEntity.Value);
+ TryDrop(args.PullerUid, hand, handsComp: component);
break;
}
}
return false;
}
- if (pullerComp.NeedsHands && !_handsSystem.TryGetEmptyHand(puller, out _))
+ if (pullerComp.NeedsHands
+ && !_handsSystem.TryGetEmptyHand(puller, out _)
+ && pullerComp.Pulling == null)
{
return false;
}
return TogglePull(puller.Pulling.Value, pullerUid, pullable);
}
- public bool TryStartPull(EntityUid pullerUid, EntityUid pullableUid, EntityUid? user = null,
+ public bool TryStartPull(EntityUid pullerUid, EntityUid pullableUid,
PullerComponent? pullerComp = null, PullableComponent? pullableComp = null)
{
if (!Resolve(pullerUid, ref pullerComp, false) ||
}
// Ensure that the puller is not currently pulling anything.
- var oldPullable = pullerComp.Pulling;
-
- if (oldPullable != null)
- {
- // Well couldn't stop the old one.
- if (!TryStopPull(oldPullable.Value, pullableComp, user))
- return false;
- }
+ if (TryComp<PullableComponent>(pullerComp.Pulling, out var oldPullable)
+ && !TryStopPull(pullerComp.Pulling.Value, oldPullable, pullerUid))
+ return false;
- // Is the pullable currently being pulled by something else?
+ // Stop anyone else pulling the entity we want to pull
if (pullableComp.Puller != null)
{
- // Uhhh
+ // We're already pulling this item
if (pullableComp.Puller == pullerUid)
return false;
- if (!TryStopPull(pullableUid, pullableComp, pullerUid))
+ if (!TryStopPull(pullableUid, pullableComp, pullableComp.Puller))
return false;
}
var pullerUidNull = pullable.Puller;
if (pullerUidNull == null)
- return false;
+ return true;
var msg = new AttemptStopPullingEvent(user);
RaiseLocalEvent(pullableUid, msg, true);