/// <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)
{
// 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);
+ }
}
}
_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)