more fixes for overgen support

This commit is contained in:
FaceDeer 2019-11-11 13:12:46 -07:00
parent b29f549d76
commit 816f0bf7eb
6 changed files with 32 additions and 26 deletions

View File

@ -96,8 +96,9 @@ local decorate_level_1 = function(minp, maxp, seed, vm, node_arrays, area, data)
-- Partly fill flooded caverns and warrens
if minp.y <= subsea_level then
for vi in area:iterp(minp, maxp) do
if data[vi] == c_air and area:get_y(vi) <= subsea_level and nvals_cave[vi] < -flooding_threshold then
for vi, x, y, z in area:iterp_yxz(area.MinEdge, area.MaxEdge) do
-- convert all air below sea level into water
if y <= subsea_level and data[vi] == c_air and nvals_cave[vi] < -flooding_threshold then
data[vi] = c_water
end
end

View File

@ -138,7 +138,7 @@ local decorate_level_2 = function(minp, maxp, seed, vm, node_arrays, area, data)
local vein_area
-- Partly fill flooded caverns and warrens
for vi in area:iterp(minp, maxp) do
for vi, x, y, z in area:iterp_yxz(area.MinEdge, area.MaxEdge) do
local cave_val = nvals_cave[vi]
if cave_val < -flooding_threshold then
@ -156,7 +156,7 @@ local decorate_level_2 = function(minp, maxp, seed, vm, node_arrays, area, data)
data[vi] = c_veinstone
end
end
if data[vi] == c_air and area:get_y(vi) <= subsea_level then
if data[vi] == c_air and y <= subsea_level then
data[vi] = c_water -- otherwise, fill air with water when below sea level
end
end

View File

@ -207,25 +207,25 @@ local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
-- Partly fill flooded caverns and warrens
if minp.y <= subsea_level then
for vi in area:iterp(minp, maxp) do
local y = area:get_y(vi)
for vi, x, y, z in area:iterp_yxz(area.MinEdge, area.MaxEdge) do
if y <= subsea_level and nvals_cave[vi] < -flooding_threshold then
if data[vi] == c_air and y <= subsea_level then
data[vi] = c_water
end
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
if biome_name == "blackcap" then
-- oil slick
local cave = math.abs(nvals_cave[vi])
if y == subsea_level and data[vi] == c_water and cave + nvals_cracks[index2d]*0.025 < cavern_def.cave_threshold + 0.1 then
data[vi] = c_oil
if (mapgen_helper.is_pos_within_box({x=x, y=y, z=z}, minp, maxp)) then
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
if biome_name == "blackcap" then
-- oil slick
local cave = math.abs(nvals_cave[vi])
if y == subsea_level and data[vi] == c_water and cave + nvals_cracks[index2d]*0.025 < cavern_def.cave_threshold + 0.1 then
data[vi] = c_oil
end
elseif biome_name == "bloodnether" and y <= subsea_level and y > subsea_level - ice_thickness and data[vi] == c_water then
-- floating ice
data[vi] = c_ice
end
elseif biome_name == "bloodnether" and y <= subsea_level and y > subsea_level - ice_thickness and data[vi] == c_water then
-- floating ice
data[vi] = c_ice
end
end
end

View File

@ -221,7 +221,6 @@ local dfcaverns_mods = {
"df_underworld_items:",
"ice_sprites:",
"mine_gas:",
"default:water",
}
df_caverns.is_ground_content = function(c_node)
if dfcaverns_nodes then

View File

@ -223,15 +223,20 @@ local decorate_sunless_sea = function(minp, maxp, seed, vm, node_arrays, area, d
data[vi] = c_obsidian
end
end
-- convert all air below sea level into water
if y <= sea_level and data[vi] == c_air then
data[vi] = c_water
end
else
skip_next = false
end
end
if minp.y <= sea_level then
for vi, x, y, z in area:iterp_yxz(area.MinEdge, area.MaxEdge) do
-- convert all air below sea level into water
if y <= sea_level and data[vi] == c_air then
data[vi] = c_water
end
end
end
---------------------------------------------------------
-- Cavern floors

View File

@ -118,8 +118,9 @@ minetest.register_node("df_primordial_items:jungle_mushroom_sapling", {
})
local c_stem = minetest.get_content_id("df_primordial_items:jungle_mushroom_trunk")
local c_cap_1 = minetest.get_content_id("df_primordial_items:jungle_mushroom_cap_1")
local c_cap_2 = minetest.get_content_id("df_primordial_items:jungle_mushroom_cap_2")
local c_cap_1 = minetest.get_content_id("df_primordial_items:jungle_mushroom_cap_1")
local c_cap_2 = minetest.get_content_id("df_primordial_items:jungle_mushroom_cap_2")
local c_air = minetest.get_content_id("air")
df_primordial_items.spawn_jungle_mushroom = function(pos)
local x, y, z = pos.x, pos.y, pos.z
@ -142,7 +143,7 @@ df_primordial_items.spawn_jungle_mushroom = function(pos)
local area = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data()
subterrane.giant_mushroom(area:indexp(pos), area, data, c_stem, c_cap, nil, stem_height, cap_radius)
subterrane.giant_mushroom(area:indexp(pos), area, data, c_stem, c_cap, c_air, stem_height, cap_radius)
vm:set_data(data)
vm:write_to_map()
@ -158,5 +159,5 @@ df_primordial_items.spawn_jungle_mushroom_vm = function(vi, area, data)
else
c_cap = c_cap_2
end
subterrane.giant_mushroom(vi, area, data, c_stem, c_cap, nil, stem_height, cap_radius)
subterrane.giant_mushroom(vi, area, data, c_stem, c_cap, c_air, stem_height, cap_radius)
end