diff options
author | Calinou <Calinou@users.noreply.github.com> | 2015-12-26 15:12:54 +0100 |
---|---|---|
committer | Calinou <Calinou@users.noreply.github.com> | 2015-12-26 15:12:54 +0100 |
commit | ea667f90a4ca50dfa29020b29949fd31005039e5 (patch) | |
tree | b6fdde0c93cf8cb2530de3b97c68a4ca71890b71 /circular_saw.lua | |
parent | d3ba90d012de2a6e0f2cff86083ace8ce1766cc4 (diff) | |
parent | 6878f64e7b0da9461f4f065b36c4d8db0ba08ab6 (diff) | |
download | moreblocks-ea667f90a4ca50dfa29020b29949fd31005039e5.tar.gz moreblocks-ea667f90a4ca50dfa29020b29949fd31005039e5.tar.bz2 moreblocks-ea667f90a4ca50dfa29020b29949fd31005039e5.zip |
Merge pull request #26 from cmdskp/patch-1
Resolves swapping different blocks between inventories
Diffstat (limited to 'circular_saw.lua')
-rw-r--r-- | circular_saw.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/circular_saw.lua b/circular_saw.lua index c06927f..dd945b8 100644 --- a/circular_saw.lua +++ b/circular_saw.lua @@ -289,6 +289,22 @@ end function circular_saw.on_metadata_inventory_take( pos, listname, index, stack, player) + + -- Prevent (inbuilt) swapping between inventories with different blocks + -- corrupting player inventory or Saw with 'unknown' items. + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local input_stack = inv:get_stack(listname, index) + if not input_stack:is_empty() and input_stack:get_name()~=stack:get_name() then + local player_inv = player:get_inventory() + if player_inv:room_for_item("main", input_stack) then + player_inv:add_item("main", input_stack) + end + + circular_saw:reset(pos) + return + end + -- If it is one of the offered stairs: find out how many -- microblocks have to be substracted: if listname == "output" then |