Prevent cave generation in the air

pull/1/head
Bram van den Heuvel 2024-04-29 18:26:59 +02:00
parent d111364b0f
commit 2809346af8
1 changed files with 8 additions and 5 deletions

View File

@ -625,14 +625,17 @@ function internal.generate_caves(data, minp, maxp)
internal.humidity_noise_params(), bminp, bmaxp internal.humidity_noise_params(), bminp, bmaxp
) )
local air = minetest.get_content_id("air")
-- Place blocks where necessary -- Place blocks where necessary
internal.iter_3d_area(bminp, bmaxp, function (i, pos) internal.iter_3d_area(bminp, bmaxp, function (i, pos)
local function place(name) local function place(name)
if type(name) == "string" then local vi = vmanip:pos_to_index(pos)
vmanip:set_index(
vmanip:pos_to_index(pos), if vmanip:get_index(vi) == air then
minetest.get_content_id(name) elseif type(name) == "string" then
) vmanip:set_index(vi, minetest.get_content_id(name))
elseif type(name) == "nil" then elseif type(name) == "nil" then
else else
error("Inserted invalid type " .. type(name) .. " into voxelmanip array") error("Inserted invalid type " .. type(name) .. " into voxelmanip array")