From: Plykiya <58439124+Plykiya@users.noreply.github.com> Date: Wed, 2 Oct 2024 05:27:01 +0000 (-0700) Subject: Fix quick-swap stacks of items (#32560) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=2a07e4666a87be5bbe5002621c6245de1d246f94;p=space-station-14.git Fix quick-swap stacks of items (#32560) * remove picking up stack on quick swap * better --- diff --git a/Content.Shared/Interaction/SmartEquipSystem.cs b/Content.Shared/Interaction/SmartEquipSystem.cs index 4feb0445f8..746bc994ee 100644 --- a/Content.Shared/Interaction/SmartEquipSystem.cs +++ b/Content.Shared/Interaction/SmartEquipSystem.cs @@ -5,6 +5,7 @@ using Content.Shared.Hands.EntitySystems; using Content.Shared.Input; using Content.Shared.Inventory; using Content.Shared.Popups; +using Content.Shared.Stacks; using Content.Shared.Storage; using Content.Shared.Storage.EntitySystems; using Content.Shared.Whitelist; @@ -151,8 +152,13 @@ public sealed class SmartEquipSystem : EntitySystem _hands.TryDrop(uid, hands.ActiveHand, handsComp: hands); _storage.Insert(slotItem, handItem.Value, out var stacked, out _); - if (stacked != null) - _hands.TryPickup(uid, stacked.Value, handsComp: hands); + // if the hand item stacked with the things in inventory, but there's no more space left for the rest + // of the stack, place the stack back in hand rather than dropping it on the floor + if (stacked != null && !_storage.CanInsert(slotItem, handItem.Value, out _)) + { + if (TryComp(handItem.Value, out var handStack) && handStack.Count > 0) + _hands.TryPickup(uid, handItem.Value, handsComp: hands); + } return; }