Check whether node is known before reading definition in __builtin:item:on_step()

This commit is contained in:
Perttu Ahola 2012-07-21 16:36:14 +03:00 committed by Nils Dagsson Moskopp
parent 64a2c71b95
commit 05b928da0a
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 2 additions and 1 deletions

View File

@ -72,7 +72,8 @@ minetest.register_entity("__builtin:item", {
local p = self.object:getpos() local p = self.object:getpos()
p.y = p.y - 0.3 p.y = p.y - 0.3
local nn = minetest.env:get_node(p).name local nn = minetest.env:get_node(p).name
if minetest.registered_nodes[nn].walkable then -- If node is not registered or node is walkably solid
if not minetest.registered_nodes[nn] or minetest.registered_nodes[nn].walkable then
if self.physical_state then if self.physical_state then
self.object:setvelocity({x=0,y=0,z=0}) self.object:setvelocity({x=0,y=0,z=0})
self.object:setacceleration({x=0, y=0, z=0}) self.object:setacceleration({x=0, y=0, z=0})