From 4d67fcab6d7e8e2cface81dbf9f789a42cd8e4e6 Mon Sep 17 00:00:00 2001 From: Andrey Kozlovskiy Date: Wed, 16 Oct 2019 12:47:24 +0300 Subject: [PATCH] Add moved positions after possible break. --- match_craft.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/match_craft.lua b/match_craft.lua index 0e4d404..3dc9a9f 100644 --- a/match_craft.lua +++ b/match_craft.lua @@ -325,7 +325,7 @@ Arguments: amount: amount of items per every position --]] function unified_inventory.move_match(inv, src_lists, dst_list, match_table, amount) - local positions = {} + local moved_positions = {} for item, pos_set in pairs(match_table) do local stack_max = ItemStack(item):get_stack_max() @@ -346,8 +346,6 @@ function unified_inventory.move_match(inv, src_lists, dst_list, match_table, amo current:set_count(bounded_amount) for pos in pairs(pos_set) do - positions[pos] = true - local occupied = inv:get_stack(dst_list, pos) inv:set_stack(dst_list, pos, current) @@ -361,12 +359,13 @@ function unified_inventory.move_match(inv, src_lists, dst_list, match_table, amo end removed:take_item(bounded_amount) + moved_positions[pos] = true end unified_inventory.add_item(inv, src_lists, removed) end - unified_inventory.swap_items(inv, dst_list, src_lists, positions) + unified_inventory.swap_items(inv, dst_list, src_lists, moved_positions) end --[[