mirror of
https://github.com/minetest-mods/moreblocks.git
synced 2024-12-27 03:00:22 +01:00
Prevent input stack_max from overflowing
Adds a check to see if recycle stack wouldn't overflow the input stack. If so, then the items are just put in the recycle slot and they can be taken out again.
This commit is contained in:
parent
4cf2237cc1
commit
2c63648f42
@ -283,8 +283,12 @@ function circular_saw.on_metadata_inventory_put(
|
|||||||
elseif listname == "recycle" then
|
elseif listname == "recycle" then
|
||||||
-- Lets look which shape this represents:
|
-- Lets look which shape this represents:
|
||||||
local cost = circular_saw:get_cost(inv, stackname)
|
local cost = circular_saw:get_cost(inv, stackname)
|
||||||
|
local input_stack = inv:get_stack("input", 1)
|
||||||
|
-- check if this would not exceed input itemstack max_stacks
|
||||||
|
if input_stack:get_count() + ((cost * count) / 8) <= input_stack:get_stack_max() then
|
||||||
circular_saw:update_inventory(pos, cost * count)
|
circular_saw:update_inventory(pos, cost * count)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function circular_saw.on_metadata_inventory_take(
|
function circular_saw.on_metadata_inventory_take(
|
||||||
|
Loading…
Reference in New Issue
Block a user