Mapgen improvement (Thanks to HybridDog)

This commit is contained in:
Unknown 2017-03-02 06:58:30 +01:00
parent 19bb32d0fe
commit 754e7a16da
1 changed files with 13 additions and 15 deletions

View File

@ -74,31 +74,29 @@ local function generate_stratus(data, area, name, c_wherein, ca_ceilin, minp, ma
if x then if x then
-- search for the node to replace -- search for the node to replace
--print(" Searching nodes to replace from "..dump(y0-1).." to "..dump(y_min)) --print(" Searching nodes to replace from "..dump(y0-1).." to "..dump(y_min))
local vi = area:index(x0, y0-1, z0)
for y1 = y0-1,y_min,-1 do for y1 = y0-1,y_min,-1 do
if data[area:index(x0, y1, z0)] == c_wherein then if data[vi] == c_wherein then
y0 = y1-deep y0 = math.max(y1-deep, y_min)
if y0 < y_min then
y0 = y_min
end
break break
end end
vi = vi - area.ystride
end end
local rx=pr:next(radius/2,radius)+1 local rx=pr:next(radius/2,radius)+1
local rz=pr:next(radius/2,radius)+1 local rz=pr:next(radius/2,radius)+1
local ry=pr:next(radius_y/2,radius_y)+1 local ry=pr:next(radius_y/2,radius_y)+1
--print(" area of generation ("..dump(rx)..","..dump(rz)..","..dump(ry)..")") --print(" area of generation ("..dump(rx)..","..dump(rz)..","..dump(ry)..")")
vi = area:index(x0, y0, z0)
for x1=0,rx do for x1=0,rx do
rz = rz + 3 - pr:next(1,6) local vi = vi + x1
if rz < 1 then rz = math.max(rz + 3 - pr:next(1,6), 1)
rz = 1
end
for z1=pr:next(1,3),rz do for z1=pr:next(1,3),rz do
local ry0 = ry + pr:next(1,3) local vi = vi + z1 * area.zstride
for y1 = pr:next(1,3),ry0 do for y1 = pr:next(1,3), ry + pr:next(1,3) do
local p2 = area:index(x0+x1, y0+y1, z0+z1) local vi = vi + y1 * area.ystride
if data[p2] == c_wherein then if data[vi] == c_wherein then
data[p2] = c_node data[vi] = c_node
i = i +1 i = i + 1
end end
end end
end end