mirror of
https://github.com/mt-mods/plantlife_modpack.git
synced 2024-11-13 22:00:39 +01:00
Early exit
This commit is contained in:
parent
e34dc49f07
commit
97f7b11f86
|
@ -22,7 +22,6 @@ abstract_ferns.grow_fern = function(pos)
|
|||
|
||||
if minetest.get_node(right_here).name == "air"
|
||||
or minetest.get_node(right_here).name == "default:junglegrass" then
|
||||
|
||||
if fern_size == 1 then
|
||||
minetest.set_node(right_here, {name="ferns:fern_01", param2=fdir})
|
||||
elseif fern_size < 4 then
|
||||
|
|
|
@ -10,64 +10,42 @@
|
|||
assert(abstract_ferns.config.enable_treefern == true)
|
||||
|
||||
abstract_ferns.grow_tree_fern = function(pos)
|
||||
local size = math.random(1,5)
|
||||
local crown = math.random(1,2)
|
||||
|
||||
local pos_01 = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
if minetest.get_node(pos_01).name ~= "air"
|
||||
and minetest.get_node(pos_01).name ~= "ferns:sapling_tree_fern"
|
||||
and minetest.get_node(pos_01).name ~= "default:junglegrass" then
|
||||
return
|
||||
end
|
||||
|
||||
local pos_02 = {x = pos.x, y = pos.y + 2, z = pos.z}
|
||||
local pos_03 = {x = pos.x, y = pos.y + 3, z = pos.z}
|
||||
local pos_04 = {x = pos.x, y = pos.y + 4, z = pos.z}
|
||||
local pos_05 = {x = pos.x, y = pos.y + 5, z = pos.z}
|
||||
|
||||
if minetest.get_node(pos_01).name == "air" -- instead of check_air = true,
|
||||
or minetest.get_node(pos_01).name == "ferns:sapling_tree_fern"
|
||||
or minetest.get_node(pos_01).name == "default:junglegrass" then
|
||||
|
||||
if minetest.get_node(pos_02).name ~= "air"
|
||||
or size == 1 then
|
||||
minetest.set_node(pos_01, {name="ferns:tree_fern_leaves"})
|
||||
|
||||
elseif minetest.get_node(pos_03).name ~= "air"
|
||||
or size == 2 then
|
||||
minetest.set_node(pos_01, {name="ferns:fern_trunk"})
|
||||
if crown == 1 then
|
||||
minetest.set_node(pos_02, {name="ferns:tree_fern_leaves"})
|
||||
else
|
||||
minetest.set_node(pos_02, {name="ferns:tree_fern_leaves_02"})
|
||||
end
|
||||
|
||||
elseif minetest.get_node(pos_04).name ~= "air"
|
||||
or size == 3 then
|
||||
minetest.set_node(pos_01, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_02, {name="ferns:fern_trunk"})
|
||||
if crown == 1 then
|
||||
minetest.set_node(pos_03, {name="ferns:tree_fern_leaves"})
|
||||
else
|
||||
minetest.set_node(pos_03, {name="ferns:tree_fern_leaves_02"})
|
||||
end
|
||||
|
||||
elseif minetest.get_node(pos_05).name ~= "air"
|
||||
or size == 4 then
|
||||
minetest.set_node(pos_01, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_02, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_03, {name="ferns:fern_trunk"})
|
||||
if crown == 1 then
|
||||
minetest.set_node(pos_04, {name="ferns:tree_fern_leaves"})
|
||||
else
|
||||
minetest.set_node(pos_04, {name="ferns:tree_fern_leaves_02"})
|
||||
end
|
||||
|
||||
elseif size == 5 then
|
||||
minetest.set_node(pos_01, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_02, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_03, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_04, {name="ferns:fern_trunk"})
|
||||
if crown == 1 then
|
||||
minetest.set_node(pos_05, {name="ferns:tree_fern_leaves"})
|
||||
else
|
||||
minetest.set_node(pos_05, {name="ferns:tree_fern_leaves_02"})
|
||||
end
|
||||
|
||||
end
|
||||
local size = math.random(1, 5)
|
||||
local crown = ({ "ferns:tree_fern_leaves", "ferns:tree_fern_leaves_02" })[math.random(1, 2)]
|
||||
|
||||
if minetest.get_node(pos_02).name ~= "air" or size == 1 then -- TODO: Is ~= "air" intended behaviour?
|
||||
minetest.set_node(pos_01, {name="ferns:tree_fern_leaves"})
|
||||
elseif minetest.get_node(pos_03).name ~= "air" or size == 2 then
|
||||
minetest.set_node(pos_01, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_02, {name=crown})
|
||||
elseif minetest.get_node(pos_04).name ~= "air" or size == 3 then
|
||||
minetest.set_node(pos_01, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_02, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_03, {name=crown})
|
||||
elseif minetest.get_node(pos_05).name ~= "air" or size == 4 then
|
||||
minetest.set_node(pos_01, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_02, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_03, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_04, {name=crown})
|
||||
elseif size == 5 then
|
||||
minetest.set_node(pos_01, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_02, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_03, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_04, {name="ferns:fern_trunk"})
|
||||
minetest.set_node(pos_05, {name=crown})
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user