diff --git a/API.txt b/API.txt index 217104f..c033926 100644 --- a/API.txt +++ b/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. diff --git a/plants_lib/init.lua b/plants_lib/init.lua index f43fc31..1e8a54f 100644 --- a/plants_lib/init.lua +++ b/plants_lib/init.lua @@ -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