Only carve through ground nodes

main
Bram van den Heuvel 2024-09-10 18:02:53 +02:00
parent 99e9753772
commit 147b8a59c2
2 changed files with 30 additions and 27 deletions

View File

@ -486,27 +486,34 @@ function internal.mapgen(minp, maxp, blockseed, vm, va)
-- they're in. -- they're in.
local sva = VoxelArea(minp, maxp) local sva = VoxelArea(minp, maxp)
local data = vm:get_data() local data = vm:get_data()
local ground = { [ minetest.CONTENT_AIR ] = false }
internal.write_classified_node( internal.write_classified_node(
data, va, used_biomes, classified_nodes.ceilings, sva, "node_roof" data, va, used_biomes, classified_nodes.ceilings, sva, "node_roof",
ground
) )
internal.write_classified_node( internal.write_classified_node(
data, va, used_biomes, classified_nodes.contents, sva, "node_air" data, va, used_biomes, classified_nodes.contents, sva, "node_air",
ground
) )
internal.write_classified_node( internal.write_classified_node(
data, va, used_biomes, classified_nodes.floors, sva, "node_floor" data, va, used_biomes, classified_nodes.floors, sva, "node_floor",
ground
) )
internal.write_classified_node( internal.write_classified_node(
data, va, used_biomes, classified_nodes.walls, sva, "node_wall" data, va, used_biomes, classified_nodes.walls, sva, "node_wall",
ground
) )
-- Place floor decorations -- Place floor decorations
-- In case the dust has not been defined, place air nodes first -- In case the dust has not been defined, place air nodes first
internal.write_classified_node( internal.write_classified_node(
data, va, used_biomes, classified_nodes.floor_decos, sva, "node_air" data, va, used_biomes, classified_nodes.floor_decos, sva, "node_air",
ground
) )
internal.write_classified_node( internal.write_classified_node(
data, va, used_biomes, classified_nodes.floor_decos, sva, "node_dust" data, va, used_biomes, classified_nodes.floor_decos, sva, "node_dust",
ground
) )
local claimed_floor = internal.write_simple_floor_decorations( local claimed_floor = internal.write_simple_floor_decorations(
data, va, used_biomes, classified_nodes.floor_decos, sva data, va, used_biomes, classified_nodes.floor_decos, sva
@ -514,7 +521,8 @@ function internal.mapgen(minp, maxp, blockseed, vm, va)
-- Place ceiling decorations -- Place ceiling decorations
internal.write_classified_node( internal.write_classified_node(
data, va, used_biomes, classified_nodes.ceiling_decos, sva, "node_air" data, va, used_biomes, classified_nodes.ceiling_decos, sva, "node_air",
ground
) )
local claimed_ceiling = internal.write_simple_ceiling_decorations( local claimed_ceiling = internal.write_simple_ceiling_decorations(
data, va, used_biomes, classified_nodes.ceiling_decos, sva data, va, used_biomes, classified_nodes.ceiling_decos, sva
@ -533,21 +541,6 @@ function internal.mapgen(minp, maxp, blockseed, vm, va)
vm:write_to_map() vm:write_to_map()
end end
-- Place items
function internal.place_node_on_data(data, i, name)
if name == nil then
return
end
local node_id = minetest.get_content_id(name)
if node_id == nil then
return
end
data[i] = node_id
end
-- Register a new biome -- Register a new biome
function internal.register_biome(biome) function internal.register_biome(biome)
biome = internal.clean_biome_def(biome) biome = internal.clean_biome_def(biome)
@ -606,7 +599,7 @@ function internal.verticality_noise_params()
} }
end end
function internal.write_classified_node(vm_data, va, used_biomes, classified_nodes, small_va, biome_key) function internal.write_classified_node(vm_data, va, used_biomes, classified_nodes, small_va, biome_key, ground_content_nodes)
local default_biome = internal.default_biome() local default_biome = internal.default_biome()
local biome_to_id = {} local biome_to_id = {}
@ -635,7 +628,17 @@ function internal.write_classified_node(vm_data, va, used_biomes, classified_nod
local content_id = biome_to_id[biome] local content_id = biome_to_id[biome]
if content_id ~= "" then if content_id ~= "" then
vm_data[va:index(pos.x, pos.y, pos.z)] = content_id local vi = va:index(pos.x, pos.y, pos.z)
local vm_node = vm_data[vi]
if ground_content_nodes[vm_node] == nil then
local name = minetest.get_name_from_content_id(content_id)
ground_content_nodes[vm_node] = minetest.registered_nodes[name].is_ground_content or true
end
if ground_content_nodes[vm_node] then
vm_data[vi] = content_id
end
end end
end end
end end

View File

@ -68,9 +68,9 @@ ns_caves.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = "ceiling", place_on = "ceiling",
fill_ratio = 0.025, fill_ratio = 0.025,
decoration = "mcl_bamboo:bamboo_block", decoration = "mcl_colorblocks:concrete_green",
height = 3, height = 3,
height_max = 16, height_max = 7,
}) })
ns_caves.register_decoration({ ns_caves.register_decoration({
@ -79,6 +79,6 @@ ns_caves.register_decoration({
fill_ratio = 0.025, fill_ratio = 0.025,
decoration = "mcl_bamboo:bamboo_block", decoration = "mcl_bamboo:bamboo_block",
height = 3, height = 3,
height_max = 16, height_max = 7,
}) })