Fix buildings spawining in each other
This commit is contained in:
parent
a00be6ce43
commit
3ad8dd1337
@ -49,7 +49,7 @@ local function generate_bpos(vx, vz, vs, vh, pr)
|
|||||||
bsizez = buildings[btype].sizez
|
bsizez = buildings[btype].sizez
|
||||||
if dist_center2(bx-vx, bsizex, bz-vz, bsizez)>vs*vs then goto out end
|
if dist_center2(bx-vx, bsizex, bz-vz, bsizez)>vs*vs then goto out end
|
||||||
for _, a in ipairs(l) do
|
for _, a in ipairs(l) do
|
||||||
if math.abs(bx-a.x)<=(bsizex+a.bsizex)/2 and math.abs(bz-a.z)<=(bsizez+a.bsizez)/2 then goto out end
|
if math.abs(bx-a.x)<=(bsizex+a.bsizex)/2+2 and math.abs(bz-a.z)<=(bsizez+a.bsizez)/2+2 then goto out end
|
||||||
end
|
end
|
||||||
l[#l+1] = {x=bx, y=vh, z=bz, btype=btype, bsizex=bsizex, bsizez=bsizez}
|
l[#l+1] = {x=bx, y=vh, z=bz, btype=btype, bsizex=bsizex, bsizez=bsizez}
|
||||||
::out::
|
::out::
|
||||||
|
Loading…
x
Reference in New Issue
Block a user