From cf6d38cc0577b06c8a7b08eb38929fa715a4aac5 Mon Sep 17 00:00:00 2001 From: Tyfon <29051038+tyfon7@users.noreply.github.com> Date: Sat, 22 Jun 2024 14:43:52 -0700 Subject: [PATCH] allow partial transfers in multiselect --- Patches/MultiSelectPatches.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Patches/MultiSelectPatches.cs b/Patches/MultiSelectPatches.cs index 6dae2c3..86e581d 100644 --- a/Patches/MultiSelectPatches.cs +++ b/Patches/MultiSelectPatches.cs @@ -483,6 +483,7 @@ namespace UIFixes { if (Settings.GreedyStackMove.Value && !isGridPlacement && selectedItemContext.Item.StackObjectsCount > 1) { + int originalStackCount = selectedItemContext.Item.StackObjectsCount; int stackCount = int.MaxValue; bool failed = false; while (selectedItemContext.Item.StackObjectsCount > 0) @@ -498,6 +499,13 @@ namespace UIFixes { operations.Push(operation); } + else if (stackCount < originalStackCount) + { + // Some succeeded, so stop but not a failure + __result = true; + operation = default; + break; + } else { if (operation.Error is GClass3292 noRoomError) @@ -706,10 +714,6 @@ namespace UIFixes return; } - // Multiselect always disables "Transfer", which is a partial merge - // It leaves things behind and that's not intuitive when multi-selecting - // order &= ~PartialMerge; - if (DisableMerge) { order &= ~InteractionsHandlerClass.EMoveItemOrder.TryMerge; @@ -836,6 +840,7 @@ namespace UIFixes } else { + int originalStackCount = itemContext.Item.StackObjectsCount; int stackCount = int.MaxValue; bool failed = false; while (itemContext.Item.StackObjectsCount > 0) @@ -852,6 +857,13 @@ namespace UIFixes { operations.Push(operation); } + else if (stackCount < originalStackCount) + { + // Some succeeded, stop but not failure + __result = true; + operation = default; + break; + } else { // Need to double-break