reverse the dependencies for df_caverns and chasms, let chasms go first.

This commit is contained in:
FaceDeer
2021-03-27 15:25:54 -06:00
parent c6f26e5bec
commit e17cb0823d
10 changed files with 218 additions and 39 deletions

View File

@ -10,6 +10,8 @@ local c_spindlestem_white = df_caverns.node_id.spindlestem_white
local tower_cap_shrublist
local fungiwood_shrublist
local chasms_path = minetest.get_modpath("chasms")
if minetest.get_modpath("df_farming") then
tower_cap_shrublist = {
df_farming.spawn_plump_helmet_vm,
@ -273,6 +275,18 @@ local decorate_level_1 = function(minp, maxp, seed, vm, node_arrays, area, data)
if dry and data[vi] == c_wet_flowstone then
data[vi] = c_dry_flowstone
end
if chasms_path then
local pos = area:position(vi)
if chasms.is_in_chasm_without_taper(pos) then
local flooded_caverns = nvals_cave[vi] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if flooded_caverns and pos.y < subsea_level then
data[vi] = c_water
else
data[vi] = c_air
end
end
end
end
vm:set_param2_data(data_param2)

View File

@ -14,6 +14,9 @@ local c_dry_flowstone = df_caverns.node_id.dry_flowstone
local c_veinstone = df_caverns.node_id.veinstone
local c_pearls = df_caverns.node_id.pearls
local chasms_path = minetest.get_modpath("chasms")
local wall_vein_perlin_params = {
offset = 0,
scale = 1,
@ -354,6 +357,19 @@ local decorate_level_2 = function(minp, maxp, seed, vm, node_arrays, area, data)
if dry and data[vi] == c_wet_flowstone then
data[vi] = c_dry_flowstone
end
if chasms_path then
local pos = area:position(vi)
if chasms.is_in_chasm_without_taper(pos) then
local flooded_caverns = nvals_cave[vi] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if flooded_caverns and pos.y < subsea_level then
data[vi] = c_water
else
data[vi] = c_air
end
end
end
end
vm:set_param2_data(data_param2)

View File

@ -18,6 +18,8 @@ local c_salty_cobble = df_caverns.node_id.salty_cobble
local c_salt_crystal = df_caverns.node_id.salt_crystal
local c_sprite = df_caverns.node_id.sprite
local chasms_path = minetest.get_modpath("chasms")
local subsea_level = math.floor(df_caverns.config.level3_min - (df_caverns.config.level3_min - df_caverns.config.level2_min) * 0.33)
local flooding_threshold = math.min(df_caverns.config.tunnel_flooding_threshold, df_caverns.config.cavern_threshold)
@ -459,7 +461,7 @@ local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
end
----------------------------------------------
-- Column material override for dry biome
-- Column material override for dry and icy biomes
for _, vi in ipairs(node_arrays.column_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
@ -476,7 +478,7 @@ local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
-- with the full blown generated array rigamarole.
hoar_moss_generator = hoar_moss_generator or minetest.get_perlin(hoar_moss_perlin_params)
local pos = area:position(vi)
if hoar_moss_generator.get_3d and hoar_moss_generator:get_3d({x=pos.z, y=pos.y, z=pos.x}) > 0.5 then -- TODO: version 0.4.16 gets no hoar moss
if hoar_moss_generator:get_3d({x=pos.z, y=pos.y, z=pos.x}) > 0.5 then
data[vi] = c_hoar_moss
else
data[vi] = c_ice
@ -491,6 +493,19 @@ local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
elseif biome_name == "barren" and not flooded_caverns and data[vi] == c_wet_flowstone then
data[vi] = c_dry_flowstone
end
if chasms_path then
local pos = area:position(vi)
if chasms.is_in_chasm_without_taper(pos) then
if flooded_caverns and pos.y < subsea_level then
data[vi] = c_water -- this puts a crack in the ice of icy biomes, but why not? A crack in the ice is interesting.
else
data[vi] = c_air
end
end
end
end
vm:set_param2_data(data_param2)

View File

@ -1,4 +1,4 @@
name = df_caverns
description = Adds vast underground caverns in the style of Dwarf Fortress, complete with underground flora in diverse biomes. Also adds stalactite/stalagmite decorations in the smaller tunnels.
depends = default, subterrane, df_trees, df_mapitems
optional_depends = df_farming, ice_sprites, oil, df_underworld_items, magma_conduits, bones_loot, named_waypoints, name_generator, fireflies
optional_depends = df_farming, ice_sprites, oil, df_underworld_items, magma_conduits, bones_loot, named_waypoints, name_generator, fireflies, chasms, big_webs

View File

@ -14,6 +14,11 @@ if minetest.get_modpath("df_farming") then
df_caverns.node_id.dead_fungus = minetest.get_content_id("df_farming:dead_fungus")
end
if minetest.get_modpath("big_webs") then
df_caverns.node_id.big_webs = minetest.get_content_id("big_webs:webbing")
df_caverns.node_id.big_webs_egg = minetest.get_content_id("big_webs:web_egg")
end
df_caverns.node_id.air = minetest.get_content_id("air")
df_caverns.node_id.cobble = minetest.get_content_id("default:cobble")

View File

@ -21,9 +21,25 @@ local c_wet_flowstone = df_caverns.node_id.wet_flowstone
df_caverns.data_param2 = {}
-- prevent mapgen from using these nodes as a base for stalactites or stalagmites
local dont_build_speleothems_on = {}
for _, content_id in pairs(df_mapitems.wet_stalagmite_ids) do
dont_build_speleothems_on[content_id] = true
end
for _, content_id in pairs(df_mapitems.dry_stalagmite_ids) do
dont_build_speleothems_on[content_id] = true
end
if minetest.get_modpath("big_webs") then
dont_build_speleothems_on[df_caverns.node_id.big_webs] = true
dont_build_speleothems_on[df_caverns.node_id.big_webs_egg] = true
end
--------------------------------------------------
df_caverns.stalagmites = function(abs_cracks, vert_rand, vi, area, data, data_param2, wet, reverse_sign)
if dont_build_speleothems_on[data[vi]] then
return
end
local flowstone
local stalagmite_ids
if wet then
@ -118,13 +134,6 @@ df_caverns.glow_worm_cavern_ceiling = function(abs_cracks, vert_rand, vi, area,
end
end
local content_in_list=function(content, list)
for i, v in ipairs(list) do
if content == v then return true end
end
return false
end
df_caverns.tunnel_floor = function(minp, maxp, area, vi, nvals_cracks, data, data_param2, wet, dirt_node)
if maxp.y > -30 then
wet = false
@ -135,7 +144,7 @@ df_caverns.tunnel_floor = function(minp, maxp, area, vi, nvals_cracks, data, dat
local abs_cracks = math.abs(cracks)
if wet then
if abs_cracks < 0.05 and data[vi+ystride] == c_air and not content_in_list(data[vi], df_mapitems.wet_stalagmite_ids) then -- make sure data[vi] is not already flowstone. Stalagmites from lower levels are acting as base for further stalagmites
if abs_cracks < 0.05 and data[vi+ystride] == c_air and not dont_build_speleothems_on[data[vi]] then -- make sure data[vi] is not already flowstone. Stalagmites from lower levels are acting as base for further stalagmites
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height = math.floor(abs_cracks * 100)
subterrane.stalagmite(vi+ystride, area, data, data_param2, param2, height, df_mapitems.wet_stalagmite_ids)
@ -144,7 +153,7 @@ df_caverns.tunnel_floor = function(minp, maxp, area, vi, nvals_cracks, data, dat
data[vi] = dirt_node
end
else
if abs_cracks < 0.025 and data[vi+ystride] == c_air and not content_in_list(data[vi], df_mapitems.dry_stalagmite_ids) then -- make sure data[vi] is not already flowstone. Stalagmites from lower levels are acting as base for further stalagmites
if abs_cracks < 0.025 and data[vi+ystride] == c_air and not dont_build_speleothems_on[data[vi]] then -- make sure data[vi] is not already flowstone. Stalagmites from lower levels are acting as base for further stalagmites
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height = math.floor(abs_cracks * 100)
subterrane.stalagmite(vi+ystride, area, data, data_param2, param2, height, df_mapitems.dry_stalagmite_ids)
@ -165,14 +174,14 @@ df_caverns.tunnel_ceiling = function(minp, maxp, area, vi, nvals_cracks, data, d
local abs_cracks = math.abs(cracks)
if wet then
if abs_cracks < 0.05 and data[vi-ystride] == c_air and not content_in_list(data[vi], df_mapitems.wet_stalagmite_ids) then -- make sure data[vi] is not already flowstone. Stalagmites from lower levels are acting as base for further stalagmites
if abs_cracks < 0.05 and data[vi-ystride] == c_air and not dont_build_speleothems_on[data[vi]] then -- make sure data[vi] is not already flowstone. Stalagmites from lower levels are acting as base for further stalagmites
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height = math.floor(abs_cracks * 100)
subterrane.stalactite(vi-ystride, area, data, data_param2, param2, height, df_mapitems.wet_stalagmite_ids)
data[vi] = c_wet_flowstone
end
else
if abs_cracks < 0.025 and data[vi-ystride] == c_air and not content_in_list(data[vi], df_mapitems.dry_stalagmite_ids) then -- make sure data[vi] is not already flowstone. Stalagmites from lower levels are acting as base for further stalagmites
if abs_cracks < 0.025 and data[vi-ystride] == c_air and not dont_build_speleothems_on[data[vi]] then -- make sure data[vi] is not already flowstone. Stalagmites from lower levels are acting as base for further stalagmites
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height = math.floor(abs_cracks * 100)
subterrane.stalactite(vi-ystride, area, data, data_param2, param2, height, df_mapitems.dry_stalagmite_ids)