mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-07-16 07:20:27 +02:00
Chasms (#19)
* initial chasms mod * tweak default chasm settings * prevent chasms from breaching oil and magma seas, make veinstone actually do something * overgenerate caverns to eliminate floating stalactites * make veinstone punchable instead of right-clickable * ensure dfcaverns get carved before chasms this has an unfortunate tradeoff. Chasms will no longer have floating giant columns in them, but will also no longer have smaller stalactites and stalagmites. Also will carve chasms through lake water. Not sure if this is ideal. * add rare big webs to the chasms, to give them a unique feature * reverse the dependencies for df_caverns and chasms, let chasms go first. * fix web generator * add webs to level 3 tunnels, fix sunless sea chasms * fix up tunnel webs * make webs snappy * make webs slightly more prevalent * add chasms to the guide * final touch-ups before merging * allow anchoring against unloaded blocks
This commit is contained in:
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -17,6 +17,9 @@ local c_glow_ore = df_caverns.node_id.glow_ore
|
||||
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 c_webs_egg = df_caverns.node_id.big_webs_egg
|
||||
|
||||
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)
|
||||
@ -355,6 +358,7 @@ local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
|
||||
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
|
||||
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
|
||||
local flooded_caverns = nvals_cave[vi] < 0 -- this indicates if we're in the "flooded" set of caves or not.
|
||||
local ystride = area.ystride
|
||||
|
||||
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
|
||||
if flooded_caverns or biome_name == "blackcap" then
|
||||
@ -363,9 +367,15 @@ local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
|
||||
else
|
||||
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
|
||||
end
|
||||
if c_webs_egg and (biome_name == "barren" or biome_name == "blackcap") and nvals_cracks[index2d] > 0.5 and math.random() < 0.1 then
|
||||
local index = vi-ystride
|
||||
if data[index] == c_air then
|
||||
data[index] = c_webs_egg
|
||||
minetest.get_node_timer(area:position(index)):start(1)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- air pockets
|
||||
local ystride = area.ystride
|
||||
local cracks = nvals_cracks[index2d]
|
||||
if cracks > 0.5 and data[vi-ystride] == c_water then
|
||||
data[vi-ystride] = c_air
|
||||
@ -459,7 +469,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 +486,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 +501,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)
|
||||
|
@ -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
|
@ -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")
|
||||
|
BIN
df_caverns/screenshots/chasm.jpg
Normal file
BIN
df_caverns/screenshots/chasm.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
@ -18,12 +18,30 @@ local c_spongestone = df_caverns.node_id.spongestone
|
||||
local c_rock_rot = df_caverns.node_id.rock_rot
|
||||
local c_water = df_caverns.node_id.water
|
||||
local c_wet_flowstone = df_caverns.node_id.wet_flowstone
|
||||
local c_webs = df_caverns.node_id.big_webs
|
||||
local c_webs_egg = df_caverns.node_id.big_webs_egg
|
||||
|
||||
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[c_webs] = true
|
||||
dont_build_speleothems_on[c_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 +136,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 +146,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 +155,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 +176,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)
|
||||
|
@ -9,6 +9,8 @@ local c_dry_flowstone = df_caverns.node_id.dry_flowstone
|
||||
local c_lava = df_caverns.node_id.lava
|
||||
local c_obsidian = df_caverns.node_id.obsidian
|
||||
|
||||
local chasms_path = minetest.get_modpath("chasms")
|
||||
|
||||
local c_coral_table = {}
|
||||
for node_name, node_def in pairs(minetest.registered_nodes) do
|
||||
if minetest.get_item_group(node_name, "dfcaverns_cave_coral") > 0 then
|
||||
@ -383,6 +385,17 @@ local decorate_sunless_sea = function(minp, maxp, seed, vm, node_arrays, area, d
|
||||
data_param2[vi] = math.random(1,4)-1
|
||||
minetest.get_node_timer(area:position(vi)):start(math.random(10, 60))
|
||||
end
|
||||
|
||||
if chasms_path then
|
||||
local pos = area:position(vi)
|
||||
if chasms.is_in_chasm(pos) then
|
||||
if pos.y <= sea_level then
|
||||
data[vi] = c_water
|
||||
else
|
||||
data[vi] = c_air
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user