mirror of
https://github.com/mt-mods/biome_lib.git
synced 2025-07-07 10:41:38 +02:00
Can specify the number of tries when generating
This commit is contained in:
5
API.txt
5
API.txt
@ -256,6 +256,11 @@ biome = {
|
||||
-- (80x80x80 nodes). Defaults to 5, but be sure you
|
||||
-- set this to some reasonable value depending on your
|
||||
-- object and its size if 5 is insufficient.
|
||||
tries = num, -- the number of attempts that will be made to spawn
|
||||
-- an object, defaults to 2. This means if the first
|
||||
-- attempt fails due to something blocking the object
|
||||
-- for example, another attempt will be made in
|
||||
-- another random location.
|
||||
seed_diff = num, -- Perlin seed-diff value. Defaults to 0, which
|
||||
-- causes the function to inherit the global value of
|
||||
-- 329.
|
||||
|
3
api.lua
3
api.lua
@ -74,6 +74,7 @@ function biome_lib.set_defaults(biome)
|
||||
biome.near_nodes_count = biome.near_nodes_count or 1
|
||||
biome.rarity = biome.rarity or 50
|
||||
biome.max_count = biome.max_count or 125
|
||||
biome.tries = biome.tries or 2
|
||||
if biome.check_air ~= false then biome.check_air = true end
|
||||
|
||||
-- specific to abm spawner
|
||||
@ -286,7 +287,7 @@ function biome_lib.populate_surfaces(b, nodes_or_function_or_model, snodes, chec
|
||||
for i = 1, math.min(math.ceil(biome.max_count/25), num_in_biome_nodes) do
|
||||
local tries = 0
|
||||
local spawned = false
|
||||
while tries < 2 and not spawned do
|
||||
while tries < biome.tries and not spawned do
|
||||
local pos = in_biome_nodes[math.random(1, num_in_biome_nodes)]
|
||||
|
||||
local will_place = true
|
||||
|
Reference in New Issue
Block a user