1
0
Fork 0

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,15 +7,17 @@ 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)
local cpos = vector.add(pos, dir) if dir then
local cnode = minetest.get_node(cpos) local cpos = vector.add(pos, dir)
if minetest.get_item_group(cnode.name, "solid") == 0 then local cnode = minetest.get_node(cpos)
minetest.remove_node(pos) if minetest.get_item_group(cnode.name, "solid") == 0 then
local drops = minetest.get_node_drops(node.name, "") minetest.remove_node(pos)
for dr=1, #drops do local drops = minetest.get_node_drops(node.name, "")
minetest.add_item(pos, drops[dr]) for dr=1, #drops do
minetest.add_item(pos, drops[dr])
end
ret = true
end end
ret = true
end end
end end