From: Token Date: Mon, 12 Aug 2024 14:18:26 +0000 (+0500) Subject: Fix DoDrop to DropNextTo in container cases (#30911) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=d4c0155d668d847639407a6c5829f5fe6f22c076;p=space-station-14.git Fix DoDrop to DropNextTo in container cases (#30911) * Fix DoDrop to DropNextTo in container cases DoDrop is too heavy to calculation. In any other case we should use alternatives, for example DropNextTo helper method * codestyle change --- diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs index 0579e99725..bdc17be91a 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs @@ -126,13 +126,21 @@ public abstract partial class SharedHandsSystem var userXform = Transform(uid); var isInContainer = ContainerSystem.IsEntityOrParentInContainer(uid, xform: userXform); + // if the user is in a container, drop the item inside the container + if (isInContainer) { + TransformSystem.DropNextTo((entity, itemXform), (uid, userXform)); + return true; + } + + // drop the item with heavy calculations from their hands and place it at the calculated interaction range position + // The DoDrop is handle if there's no drop target DoDrop(uid, hand, doDropInteraction: doDropInteraction, handsComp); - // drop the item inside the container if the user is in a container - if (targetDropLocation == null || isInContainer) + // if there's no drop location stop here + if (targetDropLocation == null) return true; - - // otherwise, remove the item from their hands and place it at the calculated interaction range position + + // otherwise, also move dropped item and rotate it properly according to grid/map var (itemPos, itemRot) = TransformSystem.GetWorldPositionRotation(entity); var origin = new MapCoordinates(itemPos, itemXform.MapID); var target = TransformSystem.ToMapCoordinates(targetDropLocation.Value);