Round the total amount to full stack size

This commit is contained in:
Andrey Kozlovskiy 2019-10-17 14:30:26 +03:00
parent 95642bc811
commit 9dd7fe470f
1 changed files with 5 additions and 1 deletions

View File

@ -336,9 +336,13 @@ function unified_inventory.move_match(inv, src_lists, dst_list, match_table, amo
pos_count = pos_count + 1
end
local total_amount = bounded_amount * pos_count
-- round up to the full stack
total_amount = math.ceil(total_amount / stack_max) * stack_max
local total = ItemStack{
name = item,
count = bounded_amount * pos_count
count = total_amount
}
local removed = unified_inventory.remove_item(inv, src_lists, total)