mcl_attached: Check if dir is nil

This commit is contained in:
Wuzzy 2020-02-23 20:37:42 +01:00
parent a375548992
commit 98e87fd5db
1 changed files with 10 additions and 8 deletions

View File

@ -7,6 +7,7 @@ minetest.check_single_for_falling = function(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if minetest.get_item_group(node.name, "attached_node_facedir") ~= 0 then if minetest.get_item_group(node.name, "attached_node_facedir") ~= 0 then
local dir = minetest.facedir_to_dir(node.param2) local dir = minetest.facedir_to_dir(node.param2)
if dir then
local cpos = vector.add(pos, dir) local cpos = vector.add(pos, dir)
local cnode = minetest.get_node(cpos) local cnode = minetest.get_node(cpos)
if minetest.get_item_group(cnode.name, "solid") == 0 then if minetest.get_item_group(cnode.name, "solid") == 0 then
@ -18,6 +19,7 @@ minetest.check_single_for_falling = function(pos)
ret = true ret = true
end end
end end
end
return ret_o or ret return ret_o or ret
end end