Fix possible stacking of books in bookshelf
authorPilzAdam <pilzadam@minetest.net>
Sat, 6 Dec 2014 10:43:07 +0000 (11:43 +0100)
committerPilzAdam <pilzadam@minetest.net>
Sat, 6 Dec 2014 10:43:07 +0000 (11:43 +0100)
Original author: @MT-Modder

mods/default/nodes.lua

index 84f5f947f2e37fd615c9d2d9070cfd15b59cd57e..3fe0fe801ca603a9d235cb54b317c63f375989a5 100644 (file)
@@ -407,8 +407,9 @@ minetest.register_node("default:bookshelf", {
        allow_metadata_inventory_put = function(pos, listname, index, stack, player)
                local meta = minetest.get_meta(pos)
                local inv = meta:get_inventory()
+               local to_stack = inv:get_stack(listname, index)
                if listname == "books" then
-                       if stack:get_name() == "default:book" then
+                       if stack:get_name() == "default:book" and to_stack:is_empty() then
                                return 1
                        else
                                return 0