forked from mtcontrib/plantlife_modpack
Added random-number-based rarity control
This commit is contained in:
parent
b41cf5570c
commit
5abcd9034e
3
API.txt
3
API.txt
@ -128,6 +128,9 @@ biome = {
|
||||
avoid_radius = num, -- [*] how much distance to leave between
|
||||
the object to be added and the objects
|
||||
to be avoided.
|
||||
rarity = num, -- how rare should this tree be in its biome?
|
||||
Larger values more rare, determined by
|
||||
math.random(1,100) > this
|
||||
seed_diff = num, -- perlin seed-diff value. Defaults to 0,
|
||||
which causes the function to inherit the
|
||||
global value of 329.
|
||||
|
@ -74,6 +74,7 @@ function plantslib:search_for_surfaces(minp, maxp, biome, funct_or_model)
|
||||
and noise2 >= biome.temp_max
|
||||
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)
|
||||
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 math.random(1,100) > biome.rarity
|
||||
then
|
||||
table.insert(in_biome_nodes, pos)
|
||||
num_in_biome_nodes = num_in_biome_nodes + 1
|
||||
|
Loading…
Reference in New Issue
Block a user