diff options
author | Calinou <Calinou@users.noreply.github.com> | 2016-02-14 12:23:53 +0100 |
---|---|---|
committer | Calinou <Calinou@users.noreply.github.com> | 2016-02-14 12:23:53 +0100 |
commit | 1eafd4473d9e504756fa2fcceaade6cab62943a4 (patch) | |
tree | 4ece76adfc35800c3a2e75c7b9e63ab38e6cbb2f | |
parent | 4cf2237cc1184b22a666f007f2e0baa354176f85 (diff) | |
parent | 2c63648f42ed374ac222f4e1060785ddf23e2cb0 (diff) | |
download | moreblocks-1eafd4473d9e504756fa2fcceaade6cab62943a4.tar.gz moreblocks-1eafd4473d9e504756fa2fcceaade6cab62943a4.tar.bz2 moreblocks-1eafd4473d9e504756fa2fcceaade6cab62943a4.zip |
Merge pull request #31 from minetest-mods/sofar-patch-4
Prevent input stack_max from overflowing
-rw-r--r-- | circular_saw.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/circular_saw.lua b/circular_saw.lua index dd945b8..09fbd90 100644 --- a/circular_saw.lua +++ b/circular_saw.lua @@ -283,7 +283,11 @@ function circular_saw.on_metadata_inventory_put( elseif listname == "recycle" then -- Lets look which shape this represents: local cost = circular_saw:get_cost(inv, stackname) - circular_saw:update_inventory(pos, cost * count) + 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) + end end end |