1
0
mirror of https://github.com/mt-mods/plantlife_modpack.git synced 2024-11-16 15:20:38 +01:00

just a minor logic tweak to try to speed the mapgen code up further.

This commit is contained in:
Vanessa Ezekowitz 2013-01-19 13:12:07 -05:00
parent 21e43912ff
commit 0580a2f416

View File

@ -83,8 +83,8 @@ function plantslib:search_for_surfaces(minp, maxp, biome)
for i in ipairs(in_biome_nodes) do for i in ipairs(in_biome_nodes) do
local pos = in_biome_nodes[i] local pos = in_biome_nodes[i]
local p_top = { x = pos.x, y = pos.y + 1, z = pos.z } local p_top = { x = pos.x, y = pos.y + 1, z = pos.z }
if minetest.env:find_node_near(p_top, biome.radius + math.random(-1.5,1.5), biome.avoid) == nil if minetest.env:find_node_near(p_top, biome.radius + math.random(-1.5,1.5), biome.avoid) == nil then
and (biome.ncount == nil or table.getn(minetest.env:find_nodes_in_area({x=pos.x-1, y=pos.y, z=pos.z-1}, {x=pos.x+1, y=pos.y, z=pos.z+1}, biome.neighbors)) > biome.ncount) if (biome.ncount == nil or table.getn(minetest.env:find_nodes_in_area({x=pos.x-1, y=pos.y, z=pos.z-1}, {x=pos.x+1, y=pos.y, z=pos.z+1}, biome.neighbors)) > biome.ncount)
and (biome.near_nodes == nil or table.getn(minetest.env:find_nodes_in_area({x=pos.x-biome.near_nodes_size, y=pos.y-1, z=pos.z-biome.near_nodes_size}, {x=pos.x+biome.near_nodes_size, y=pos.y+1, z=pos.z+biome.near_nodes_size}, biome.near_nodes)) >= biome.near_nodes_count) and (biome.near_nodes == nil or table.getn(minetest.env:find_nodes_in_area({x=pos.x-biome.near_nodes_size, y=pos.y-1, z=pos.z-biome.near_nodes_size}, {x=pos.x+biome.near_nodes_size, y=pos.y+1, z=pos.z+biome.near_nodes_size}, biome.near_nodes)) >= biome.near_nodes_count)
then then
print("Call function: "..biome.exec_funct.."("..dump(pos)..")") print("Call function: "..biome.exec_funct.."("..dump(pos)..")")
@ -93,6 +93,7 @@ function plantslib:search_for_surfaces(minp, maxp, biome)
end end
end end
end end
end
end end
-- The spawning ABM -- The spawning ABM