Continue if item can't be moved to the current position.

This commit is contained in:
Andrey Kozlovskiy 2019-10-17 07:59:06 +03:00
parent 4d67fcab6d
commit 95642bc811
1 changed files with 10 additions and 7 deletions

View File

@ -349,16 +349,19 @@ function unified_inventory.move_match(inv, src_lists, dst_list, match_table, amo
local occupied = inv:get_stack(dst_list, pos) local occupied = inv:get_stack(dst_list, pos)
inv:set_stack(dst_list, pos, current) inv:set_stack(dst_list, pos, current)
if not occupied:is_empty() then repeat
local leftover = unified_inventory.add_item(inv, src_lists, occupied) if not occupied:is_empty() then
local leftover = unified_inventory.add_item(inv, src_lists, occupied)
if not leftover:is_empty() then if not leftover:is_empty() then
inv:set_stack(dst_list, pos, leftover) inv:set_stack(dst_list, pos, leftover)
break break
end
end end
end
removed:take_item(bounded_amount) removed:take_item(bounded_amount)
until true
moved_positions[pos] = true moved_positions[pos] = true
end end