forked from mtcontrib/plantlife_modpack
Early exit from abstract_ferns.grow_giant_tree_fern
(very) small performance increase
This commit is contained in:
parent
27430814a0
commit
99dd2db18a
@ -11,8 +11,14 @@
|
|||||||
-- lot of code, lot to load
|
-- lot of code, lot to load
|
||||||
|
|
||||||
abstract_ferns.grow_giant_tree_fern = function(pos)
|
abstract_ferns.grow_giant_tree_fern = function(pos)
|
||||||
local size = math.random(12,16) -- min of range must be >= 4
|
|
||||||
local pos_01 = {x = pos.x, y = pos.y + 1, z = pos.z}
|
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_giant_tree_fern"
|
||||||
|
and minetest.get_node(pos_01).name ~= "default:junglegrass" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local size = math.random(12,16) -- min of range must be >= 4
|
||||||
|
|
||||||
local leave_a_1 = {x = pos.x + 1, y = pos.y + size - 1, z = pos.z }
|
local leave_a_1 = {x = pos.x + 1, y = pos.y + size - 1, z = pos.z }
|
||||||
local leave_a_2 = {x = pos.x + 2, y = pos.y + size , z = pos.z }
|
local leave_a_2 = {x = pos.x + 2, y = pos.y + size , z = pos.z }
|
||||||
@ -34,10 +40,6 @@ abstract_ferns.grow_giant_tree_fern = function(pos)
|
|||||||
local leave_d_3 = {x = pos.x , y = pos.y + size - 1, z = pos.z - 3}
|
local leave_d_3 = {x = pos.x , y = pos.y + size - 1, z = pos.z - 3}
|
||||||
local leave_d_4 = {x = pos.x , y = pos.y + size - 2, z = pos.z - 4}
|
local leave_d_4 = {x = pos.x , y = pos.y + size - 2, z = pos.z - 4}
|
||||||
|
|
||||||
if minetest.get_node(pos_01).name == "air" -- instead of check_air = true,
|
|
||||||
or minetest.get_node(pos_01).name == "ferns:sapling_giant_tree_fern"
|
|
||||||
or minetest.get_node(pos_01).name == "default:junglegrass" then
|
|
||||||
|
|
||||||
for i = 1, size-3 do
|
for i = 1, size-3 do
|
||||||
minetest.set_node({x = pos.x, y = pos.y + i, z = pos.z}, {name="ferns:fern_trunk_big"})
|
minetest.set_node({x = pos.x, y = pos.y + i, z = pos.z}, {name="ferns:fern_trunk_big"})
|
||||||
end
|
end
|
||||||
@ -118,8 +120,6 @@ abstract_ferns.grow_giant_tree_fern = function(pos)
|
|||||||
and minetest.get_node(leave_d_3).name == "ferns:fern_trunk_big" then
|
and minetest.get_node(leave_d_3).name == "ferns:fern_trunk_big" then
|
||||||
minetest.set_node(leave_d_4, {name="air"})
|
minetest.set_node(leave_d_4, {name="air"})
|
||||||
end]]
|
end]]
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user