Fix item entity's collision with nodeboxes
authorjordan4ibanez <jordan4ibanez@gmail.com>
Sat, 15 Dec 2012 20:32:17 +0000 (15:32 -0500)
committerjordan4ibanez <jordan4ibanez@gmail.com>
Sat, 15 Dec 2012 20:32:17 +0000 (15:32 -0500)
builtin/item_entity.lua

index 2b12764f18dd455fdcd19653fa6feda8bf4a1873..46415e53854fa08199ab1ac5bfb8ced3dd57b548 100644 (file)
@@ -84,8 +84,9 @@ minetest.register_entity("__builtin:item", {
                local p = self.object:getpos()
                p.y = p.y - 0.3
                local nn = minetest.env:get_node(p).name
-               -- If node is not registered or node is walkably solid
-               if not minetest.registered_nodes[nn] or minetest.registered_nodes[nn].walkable then
+               -- If node is not registered or node is walkably solid and resting on nodebox
+               local v = self.object:getvelocity()
+               if not minetest.registered_nodes[nn] or minetest.registered_nodes[nn].walkable and v.y == 0 then
                        if self.physical_state then
                                self.object:setvelocity({x=0,y=0,z=0})
                                self.object:setacceleration({x=0, y=0, z=0})