Generate the village after the trees so that a tree cannot be in a building.
This commit is contained in:
parent
de26416a22
commit
28cad7c42c
@ -6,14 +6,13 @@ buildings = {
|
||||
{sizex= 4, sizez= 4, yoff=-5, ysize=11, scm="well", no_rotate=true, pervillage=1},
|
||||
{sizex= 7, sizez= 7, yoff= 0, ysize=11, scm="fountain", weight=1/4, pervillage=3},
|
||||
{sizex= 5, sizez= 5, yoff= 0, ysize= 6, scm="small_house", orients={3}},
|
||||
--{sizex=13, sizez= 6, yoff= 1, ysize= 7, scm=house_w_garden, orients={2}},
|
||||
{sizex=6, sizez= 12, yoff= 0, ysize= 7, scm="house_with_garden", orients={1}},
|
||||
{sizex= 6, sizez=12, yoff= 0, ysize= 7, scm="house_with_garden", orients={1}},
|
||||
{sizex=16, sizez=17, yoff= 0, ysize=12, scm="church", orients={3}, pervillage=1},
|
||||
{sizex= 5, sizez= 5, yoff= 0, ysize=16, scm="tower", orients={0}, weight=1/7},
|
||||
{sizex= 8, sizez= 9, yoff= 0, ysize= 6, scm="forge", orients={0}, pervillage=2},
|
||||
{sizex=11, sizez=12, yoff= 0, ysize= 6, scm="library", orients={1}, pervillage=2},
|
||||
{sizex=15, sizez= 7, yoff= 0, ysize=12, scm="inn", orients={1}},
|
||||
{sizex=22, sizez=17, yoff= 0, ysize= 7, scm="pub", orients={3}},
|
||||
{sizex=15, sizez= 7, yoff= 0, ysize=12, scm="inn", orients={1}, pervillage=4},
|
||||
{sizex=22, sizez=17, yoff= 0, ysize= 7, scm="pub", orients={3}, pervillage=2},
|
||||
}
|
||||
|
||||
local gravel = minetest.get_content_id("default:gravel")
|
||||
|
14
villages.lua
14
villages.lua
@ -361,7 +361,7 @@ local function generate_building(pos, minp, maxp, data, a, pr, extranodes)
|
||||
end
|
||||
end
|
||||
|
||||
local MIN_DIST = 2
|
||||
local MIN_DIST = 1
|
||||
|
||||
local function pos_far_buildings(x, z, l)
|
||||
for _,a in ipairs(l) do
|
||||
@ -374,12 +374,8 @@ end
|
||||
|
||||
function generate_village(vx, vz, vs, vh, minp, maxp, data, a, vnoise, to_grow)
|
||||
local seed = get_bseed({x=vx, z=vz})
|
||||
local pr = PseudoRandom(seed)
|
||||
local bpos = generate_bpos(vx, vz, vs, vh, pr, vnoise)
|
||||
local extranodes = {}
|
||||
for _, pos in ipairs(bpos) do
|
||||
generate_building(pos, minp, maxp, data, a, pr, extranodes)
|
||||
end
|
||||
local pr_village = PseudoRandom(seed)
|
||||
local bpos = generate_bpos(vx, vz, vs, vh, pr_village, vnoise)
|
||||
local pr = PseudoRandom(seed)
|
||||
for _, g in ipairs(to_grow) do
|
||||
if pos_far_buildings(g.x, g.z, bpos) then
|
||||
@ -406,5 +402,9 @@ function generate_village(vx, vz, vs, vh, minp, maxp, data, a, vnoise, to_grow)
|
||||
end
|
||||
end
|
||||
end
|
||||
local extranodes = {}
|
||||
for _, pos in ipairs(bpos) do
|
||||
generate_building(pos, minp, maxp, data, a, pr_village, extranodes)
|
||||
end
|
||||
return extranodes
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user