Invert cave shape

Fixed an issue where the caves would sometimes generate walls directly down a roof, complicating the cave biome design
pull/1/head
Bram van den Heuvel 2024-04-21 00:50:22 +02:00
parent a500388803
commit 5e54dedde5
1 changed files with 11 additions and 11 deletions

View File

@ -369,17 +369,17 @@ local function get_flat_cave_node_types(minp, maxp)
local bools = get_flat_cave_bools(minp, maxp)
return Flat3dArray:from_func(minp, maxp, function (i, pos)
if not bools:get_pos(pos) then
return node_type.stone
if bools:get_pos(pos) then
return node_type.content
-- Floor takes precedence
elseif pos.y == minp.y then -- Could be floor
elseif pos.y == maxp.y then -- Could be floor
return node_type.unknown
elseif not bools:get_pos({ x = pos.x, y = pos.y - 1, z = pos.z }) then
elseif bools:get_pos({ x = pos.x, y = pos.y + 1, z = pos.z }) then
return node_type.floor
-- Then roof takes precedence
elseif pos.y == maxp.y then -- Could be roof
elseif pos.y == minp.y then -- Could be roof
return node_type.unknown
elseif not bools:get_pos({ x = pos.x, y = pos.y + 1, z = pos.z }) then
elseif bools:get_pos({ x = pos.x, y = pos.y - 1, z = pos.z }) then
return node_type.roof
else
-- Check for walls
@ -393,29 +393,29 @@ local function get_flat_cave_node_types(minp, maxp)
if left.x < minp.x then
on_edge = true
elseif not bools:get_pos(left) then
elseif bools:get_pos(left) then
return node_type.wall
end
if right.x > maxp.x then
on_edge = true
elseif not bools:get_pos(right) then
elseif bools:get_pos(right) then
return node_type.wall
end
if front.z < minp.z then
on_edge = true
elseif not bools:get_pos(front) then
elseif bools:get_pos(front) then
return node_type.wall
end
if back.z > maxp.z then
on_edge = true
elseif not bools:get_pos(back) then
elseif bools:get_pos(back) then
return node_type.wall
end
if on_edge then
return node_type.unknown
else
return node_type.content
return node_type.stone
end
end
end)