forked from VoxeLibre/VoxeLibre
Limit Azalea tree generation by distance too
The other way would sometimes have multiple azaleas fairly close
This commit is contained in:
parent
202b80bae9
commit
c8f66b1748
|
@ -629,3 +629,43 @@ minetest.register_globalstep(function(dtime)
|
|||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local azaleas = {}
|
||||
local az_limit = 500
|
||||
|
||||
local deco_id_makelake = minetest.get_decoration_id("mcl_biomes:lake_structblock")
|
||||
local deco_id_makeazalea = minetest.get_decoration_id("mcl_biomes:azalea_structblock")
|
||||
minetest.set_gen_notify({decoration=true}, { deco_id_makelake })
|
||||
minetest.set_gen_notify({decoration=true}, { deco_id_makeazalea })
|
||||
|
||||
mcl_mapgen_core.register_generator("mcl_lush_caves", nil, function(minp, maxp, blockseed)
|
||||
local gennotify = minetest.get_mapgen_object("gennotify")
|
||||
local pr = PseudoRandom(blockseed + 15)
|
||||
|
||||
local az = false
|
||||
for _, pos in pairs(gennotify["decoration#"..deco_id_makeazalea] or {}) do
|
||||
local realpos = vector.offset(pos,0,-1,0)
|
||||
local node = minetest.get_node(realpos)
|
||||
if node and node.name == "mcl_lush_caves:azalea_structblock" then
|
||||
minetest.remove_node(realpos)
|
||||
for _,a in pairs(azaleas) do
|
||||
if vector.distance(realpos,a) < az_limit then
|
||||
az = true
|
||||
end
|
||||
end
|
||||
if not az and mcl_lush_caves.makeazaela(realpos) then
|
||||
table.insert(azaleas,realpos)
|
||||
az = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _, pos in pairs(gennotify["decoration#"..deco_id_makelake] or {}) do
|
||||
local realpos = vector.offset(pos,0,1,0)
|
||||
local node = minetest.get_node(realpos)
|
||||
if node and node.name == "mcl_lush_caves:lake_structblock" then
|
||||
minetest.remove_node(realpos)
|
||||
mcl_lush_caves.makelake(realpos, pr)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
name = mcl_lush_caves
|
||||
author = cora
|
||||
depends = mcl_sounds, mesecons
|
||||
depends = mcl_sounds, mesecons, mcl_mapgen_core
|
||||
|
|
|
@ -4851,13 +4851,6 @@ local function register_dimension_decorations()
|
|||
|
||||
deco_id_chorus_plant = minetest.get_decoration_id("mcl_biomes:chorus_plant")
|
||||
minetest.set_gen_notify({decoration=true}, { deco_id_chorus_plant })
|
||||
|
||||
deco_id_makelake = minetest.get_decoration_id("mcl_biomes:lake_structblock")
|
||||
minetest.set_gen_notify({decoration=true}, { deco_id_makelake })
|
||||
|
||||
deco_id_makeazalea = minetest.get_decoration_id("mcl_biomes:azalea_structblock")
|
||||
minetest.set_gen_notify({decoration=true}, { deco_id_makeazalea })
|
||||
|
||||
-- TODO: End cities
|
||||
|
||||
end
|
||||
|
@ -4927,30 +4920,4 @@ if mg_name ~= "singlenode" then
|
|||
end
|
||||
end)
|
||||
end
|
||||
|
||||
mcl_mapgen_core.register_generator("mcl_lush_caves", nil, function(minp, maxp, blockseed)
|
||||
local gennotify = minetest.get_mapgen_object("gennotify")
|
||||
local pr = PseudoRandom(blockseed + 15)
|
||||
|
||||
local az = false
|
||||
for _, pos in ipairs(gennotify["decoration#"..deco_id_makeazalea] or {}) do
|
||||
local realpos = vector.offset(pos,0,-1,0)
|
||||
local node = minetest.get_node(realpos)
|
||||
if node and node.name == "mcl_lush_caves:azalea_structblock" then
|
||||
minetest.remove_node(realpos)
|
||||
if not az and mcl_lush_caves.makeazaela(realpos) then
|
||||
az = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _, pos in ipairs(gennotify["decoration#"..deco_id_makelake] or {}) do
|
||||
local realpos = vector.offset(pos,0,1,0)
|
||||
local node = minetest.get_node(realpos)
|
||||
if node and node.name == "mcl_lush_caves:lake_structblock" then
|
||||
minetest.remove_node(realpos)
|
||||
mcl_lush_caves.makelake(realpos, pr)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue