Clean up several functions.
This commit is contained in:
parent
e6f482c9d5
commit
42916c4666
5 changed files with 159 additions and 103 deletions
|
@ -11,7 +11,6 @@ fun_caves.cavegen = function(minp, maxp, data, area, node, heightmap, underzone)
|
|||
local csize = vector.add(vector.subtract(maxp, minp), 1)
|
||||
local map_max = {x = csize.x, y = csize.y + 2, z = csize.z}
|
||||
local map_min = {x = minp.x, y = minp.y - 1, z = minp.z}
|
||||
--local noise_area = VoxelArea:new({MinEdge=map_min, MaxEdge={x=maxp.x,y=maxp.y+1,z=maxp.z}})
|
||||
|
||||
local cave_1 = minetest.get_perlin_map(fun_caves.cave_noise_1, map_max):get3dMap_flat(map_min)
|
||||
local cave_2 = minetest.get_perlin_map(fun_caves.cave_noise_2, map_max):get3dMap_flat(map_min)
|
||||
|
@ -21,10 +20,11 @@ fun_caves.cavegen = function(minp, maxp, data, area, node, heightmap, underzone)
|
|||
|
||||
local index = 0
|
||||
local index3d = 0
|
||||
local cave_width = fun_caves.cave_width
|
||||
local styx_sea_level = fun_caves.underzones['Styx'].sealevel
|
||||
for z = minp.z, maxp.z do
|
||||
for x = minp.x, maxp.x do
|
||||
index = index + 1
|
||||
--index3d = noise_area:index(x, minp.y-1, z)
|
||||
index3d = (z - minp.z) * (csize.y + 2) * csize.x + (x - minp.x) + 1
|
||||
local ivm = area:index(x, minp.y-1, z)
|
||||
|
||||
|
@ -66,8 +66,8 @@ fun_caves.cavegen = function(minp, maxp, data, area, node, heightmap, underzone)
|
|||
write = true
|
||||
elseif underzone and (y < underzone.ceiling + 10 - (underzone.vary and cave_3[index] or 0) and y > underzone.floor - 10 + (underzone.vary and cave_3[index] or 0)) then
|
||||
-- nop
|
||||
elseif ((y <= maxp.y and y >= minp.y) or (data[ivm] == node['default:stone'])) and y < height - cave_3[index] and cave_1[index3d] * cave_2[index3d] > fun_caves.cave_width then
|
||||
if y <= fun_caves.underzones['Styx'].sealevel then
|
||||
elseif ((y <= maxp.y and y >= minp.y) or (data[ivm] == node['default:stone'])) and y < height - cave_3[index] and cave_1[index3d] * cave_2[index3d] > cave_width then
|
||||
if y <= styx_sea_level then
|
||||
data[ivm] = node["default:water_source"]
|
||||
else
|
||||
data[ivm] = node["air"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue