mirror of
https://github.com/mt-mods/biome_lib.git
synced 2024-12-25 02:10:18 +01:00
Fixes
This commit is contained in:
parent
b7d69a8487
commit
fa304f9d18
@ -1,3 +1,5 @@
|
||||
local time_scale = ...
|
||||
|
||||
-- The growing ABM
|
||||
|
||||
function biome_lib:grow_plants(opts)
|
||||
|
20
init.lua
20
init.lua
@ -201,7 +201,7 @@ end
|
||||
-- Function to check whether a position matches the given biome definition
|
||||
-- Returns true when the surface can be populated
|
||||
|
||||
local function populate_single_surface(biome, pos, perlin_fertile_area)
|
||||
local function populate_single_surface(biome, pos, perlin_fertile_area, checkair)
|
||||
local p_top = { x = pos.x, y = pos.y + 1, z = pos.z }
|
||||
local noise1 = perlin_fertile_area:get2d({x=pos.x, y=pos.z})
|
||||
local noise2 = biome_lib.perlin_temperature:get2d({x=pos.x, y=pos.z})
|
||||
@ -291,7 +291,7 @@ function biome_lib:populate_surfaces(biome, nodes_or_function_or_model, snodes,
|
||||
|
||||
for i = 1, #snodes do
|
||||
local pos = vector.new(snodes[i])
|
||||
if populate_single_surface(biome, pos, perlin_fertile_area) then
|
||||
if populate_single_surface(biome, pos, perlin_fertile_area, checkair) then
|
||||
in_biome_nodes[#in_biome_nodes + 1] = pos
|
||||
end
|
||||
end
|
||||
@ -468,20 +468,11 @@ function biome_lib:generate_block_no_aircheck()
|
||||
end
|
||||
end
|
||||
|
||||
-- "Record" the chunks being generated by the core mapgen
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
biome_lib.blocklist_aircheck[#biome_lib.blocklist_aircheck + 1] = { minp, maxp }
|
||||
end)
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
biome_lib.blocklist_no_aircheck[#biome_lib.blocklist_no_aircheck + 1] = { minp, maxp }
|
||||
end)
|
||||
|
||||
-- "Play" them back, populating them with new stuff in the process
|
||||
|
||||
local step_duration = tonumber(minetest.settings:get("dedicated_server_step"))
|
||||
minetest.register_globalstep(function(dtime)
|
||||
if dtime >= 0.2 -- don't attempt to populate if lag is already too high
|
||||
if dtime >= step_duration + 0.1 -- don't attempt to populate if lag is already too high
|
||||
or math.random(100) > biome_lib.queue_run_ratio
|
||||
or (#biome_lib.blocklist_aircheck == 0 and #biome_lib.blocklist_no_aircheck == 0) then
|
||||
return
|
||||
@ -664,9 +655,8 @@ function biome_lib:replace_object(pos, replacement, grow_function, walldir, seed
|
||||
end
|
||||
|
||||
|
||||
|
||||
dofile(biome_lib.modpath .. "/search_functions.lua")
|
||||
dofile(biome_lib.modpath .. "/growth.lua")
|
||||
assert(loadfile(biome_lib.modpath .. "/growth.lua"))(time_scale)
|
||||
|
||||
|
||||
|
||||
|
@ -51,3 +51,10 @@ function biome_lib:find_open_side(pos)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- "Record" the chunks being generated by the core mapgen
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
biome_lib.blocklist_aircheck[#biome_lib.blocklist_aircheck + 1] = { minp, maxp }
|
||||
biome_lib.blocklist_no_aircheck[#biome_lib.blocklist_no_aircheck + 1] = { minp, maxp }
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user