forked from mtcontrib/plantlife_modpack
Try to fix crash
This commit is contained in:
parent
8e2148ffc3
commit
c62610f544
@ -48,11 +48,15 @@ abstract_trunks.place_twig = function(pos)
|
||||
end
|
||||
-- big twigs
|
||||
if Big_Twigs == true then
|
||||
local n1, n2
|
||||
local r1, r2
|
||||
-- big twig 1
|
||||
if twig_size == 17 then
|
||||
if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1}).name].buildable_to
|
||||
or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name].buildable_to) then
|
||||
|
||||
n1 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1})
|
||||
n2 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z})
|
||||
r1 = n1 and minetest.registered_nodes[n1.name]
|
||||
r2 = n2 and minetest.registered_nodes[n2.name]
|
||||
if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_5"})
|
||||
end
|
||||
@ -64,9 +68,11 @@ abstract_trunks.place_twig = function(pos)
|
||||
end
|
||||
end
|
||||
elseif twig_size == 18 then
|
||||
if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to
|
||||
or minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name].buildable_to) then
|
||||
|
||||
n1 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1})
|
||||
n2 = minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})
|
||||
r1 = n1 and minetest.registered_nodes[n1.name]
|
||||
r2 = n2 and minetest.registered_nodes[n2.name]
|
||||
if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_5", param2=1})
|
||||
end
|
||||
@ -78,9 +84,11 @@ abstract_trunks.place_twig = function(pos)
|
||||
end
|
||||
end
|
||||
elseif twig_size == 19 then
|
||||
if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to
|
||||
or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name].buildable_to) then
|
||||
|
||||
n1 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1})
|
||||
n2 = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})
|
||||
r1 = n1 and minetest.registered_nodes[n1.name]
|
||||
r2 = n2 and minetest.registered_nodes[n2.name]
|
||||
if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_5", param2=2})
|
||||
end
|
||||
@ -92,9 +100,11 @@ abstract_trunks.place_twig = function(pos)
|
||||
end
|
||||
end
|
||||
elseif twig_size == 20 then
|
||||
if not (minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1}).name].buildable_to
|
||||
or minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name].buildable_to) then
|
||||
|
||||
n1 = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1})
|
||||
n2 = minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})
|
||||
r1 = n1 and minetest.registered_nodes[n1.name]
|
||||
r2 = n2 and minetest.registered_nodes[n2.name]
|
||||
if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_5", param2=3})
|
||||
end
|
||||
@ -107,9 +117,11 @@ abstract_trunks.place_twig = function(pos)
|
||||
end
|
||||
-- big twig 2
|
||||
elseif twig_size == 21 then
|
||||
if not (minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name].buildable_to
|
||||
or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1}).name].buildable_to) then
|
||||
|
||||
n1 = minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})
|
||||
n2 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1})
|
||||
r1 = n1 and minetest.registered_nodes[n1.name]
|
||||
r2 = n2 and minetest.registered_nodes[n2.name]
|
||||
if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_9"})
|
||||
end
|
||||
@ -121,9 +133,11 @@ abstract_trunks.place_twig = function(pos)
|
||||
end
|
||||
end
|
||||
elseif twig_size == 22 then
|
||||
if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name].buildable_to
|
||||
or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to) then
|
||||
|
||||
n1 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z})
|
||||
n2 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1})
|
||||
r1 = n1 and minetest.registered_nodes[n1.name]
|
||||
r2 = n2 and minetest.registered_nodes[n2.name]
|
||||
if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_9", param2=1})
|
||||
end
|
||||
@ -135,9 +149,11 @@ abstract_trunks.place_twig = function(pos)
|
||||
end
|
||||
end
|
||||
elseif twig_size == 23 then
|
||||
if not (minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name].buildable_to
|
||||
or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z-1}).name].buildable_to) then
|
||||
|
||||
n1 = minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})
|
||||
n2 = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z-1})
|
||||
r1 = n1 and minetest.registered_nodes[n1.name]
|
||||
r2 = n2 and minetest.registered_nodes[n2.name]
|
||||
if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_9", param2=2})
|
||||
end
|
||||
@ -149,9 +165,11 @@ abstract_trunks.place_twig = function(pos)
|
||||
end
|
||||
end
|
||||
elseif twig_size == 24 then
|
||||
if not (minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name].buildable_to
|
||||
or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1}).name].buildable_to) then
|
||||
|
||||
n1 = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})
|
||||
n2 = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1})
|
||||
r1 = n1 and minetest.registered_nodes[n1.name]
|
||||
r2 = n2 and minetest.registered_nodes[n2.name]
|
||||
if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_9", param2=3})
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user