Squashed commit of the following:

commit 0a61781b99
Author: FaceDeer <derksenmobile@gmail.com>
Date:   Mon Aug 1 14:50:07 2022 -0600

    add an additional check to ensure old timers don't cause inappropriate growth

commit 1d7b6010c3
Author: FaceDeer <derksenmobile@gmail.com>
Date:   Mon Aug 1 13:21:29 2022 -0600

    stop timers when seeds are picked up

commit c8fa25ccd7
Author: FaceDeer <derksenmobile@gmail.com>
Date:   Mon Aug 1 13:05:24 2022 -0600

    fix replacements for dwarven syrup taffy recipe

commit 4de45bb6d7
Author: FaceDeer <derksenmobile@gmail.com>
Date:   Mon Aug 1 11:09:48 2022 -0600

    account for some additional mod dependencies

commit 83ea06bbaa
Author: FaceDeer <derksenmobile@gmail.com>
Date:   Mon Aug 1 11:09:14 2022 -0600

    update cooking recipes to be more specific.

commit 302da3ec51
Author: FaceDeer <derksenmobile@gmail.com>
Date:   Fri Jul 29 17:12:59 2022 -0600

    add location logging for debugging purposes

commit 11667e184e
Author: FaceDeer <derksenmobile@gmail.com>
Date:   Sun Jul 24 16:54:21 2022 -0600

    add checks for submods being present

    the df_trees and df_farming checks are likely redundant, but if primordial layers are disabled someone might not have df_primordial_items installed.

commit 5906308d87
Author: FaceDeer <derksenmobile@gmail.com>
Date:   Sun Jul 24 16:49:23 2022 -0600

    add config settings for biome restrictions, vastly reduce copy and paste in code

commit e52820c282
Author: FaceDeer <derksenmobile@gmail.com>
Date:   Sat Jul 23 20:45:26 2022 -0600

    add initial stab at growing conditions - biome restrictions for trees

commit 7b99556df9
Author: FaceDeer <derksenmobile@gmail.com>
Date:   Sat Jul 23 12:08:41 2022 -0600

    adding biome API. Not yet tested.

commit bf82b3b3fe
Author: FaceDeer <derksenmobile@gmail.com>
Date:   Fri Jul 22 21:22:37 2022 -0600

    added stubs for growth permission for farming plants

commit 46765df3ef
Author: FaceDeer <derksenmobile@gmail.com>
Date:   Fri Jul 22 18:36:45 2022 -0600

    initial work for restricted plant growth. split out growth conditions for trees, and reworked torchspine to not use ABMs while I was at it.
This commit is contained in:
FaceDeer
2022-08-01 14:55:46 -06:00
parent f23d4115bd
commit dbc5dd38a3
58 changed files with 725 additions and 344 deletions

View File

@ -52,3 +52,6 @@ setting("int", "underworld_glowing_pit_mapblocks", 8, "Average pit spacing measu
setting("bool", "enable_primordial", true, "Enable primordial cavern")
setting("int", "primordial_max", -3393, "Upper limit to primordial caverns")
setting("int", "primordial_min", -4032, "Lower limit to primordial caverns")
setting("bool", "restrict_trees_to_biomes", false, "Restrict underground tree growth to their home biomes")
setting("bool", "restrict_farmables_to_biomes", false, "Restrict underground farmable plant growth to their home biomes")

View File

@ -0,0 +1,48 @@
local add_biome_restrictions = function(root_table, function_name, biome_set)
local old_function = root_table[function_name]
root_table[function_name] = function(pos)
local biome = df_caverns.get_biome(pos)
return old_function(pos) and biome_set[biome]
end
end
if df_caverns.config.restrict_trees_to_biomes then
if minetest.get_modpath("df_trees") then
add_biome_restrictions(df_trees, "black_cap_growth_permitted", {blackcap = true})
add_biome_restrictions(df_trees, "blood_thorn_growth_permitted", {bloodthorn = true})
add_biome_restrictions(df_trees, "fungiwood_growth_permitted", {fungiwood = true, fungispore = true})
add_biome_restrictions(df_trees, "goblin_cap_growth_permitted", {goblincap = true, towergoblin = true})
add_biome_restrictions(df_trees, "nether_cap_growth_permitted", {nethercap = true})
add_biome_restrictions(df_trees, "spore_tree_growth_permitted", {sporetree = true, fungispore = true})
add_biome_restrictions(df_trees, "tower_cap_growth_permitted", {towercap = true, towergoblin = true})
add_biome_restrictions(df_trees, "tunnel_tube_growth_permitted", {tunneltube = true})
-- Deliberately not biome-restricted
--add_biome_restrictions(df_trees, "torchspine_growth_permitted", {})
--add_biome_restrictions(df_trees, "spindlestem_growth_permitted", {})
end
if minetest.get_modpath("df_primordial_items") then
add_biome_restrictions(df_primordial_items, "primordial_mushroom_growth_permitted", {["primordial fungus"] = true})
add_biome_restrictions(df_primordial_items, "giant_mycelium_growth_permitted", {["primordial fungus"] = true})
add_biome_restrictions(df_primordial_items, "giant_fern_growth_permitted", {["primordial jungle"] = true})
add_biome_restrictions(df_primordial_items, "jungle_mushroom_growth_permitted", {["primordial jungle"] = true})
add_biome_restrictions(df_primordial_items, "jungletree_growth_permitted", {["primordial jungle"] = true})
end
end
if df_caverns.config.restrict_farmables_to_biomes and minetest.get_modpath("df_farming") then
add_biome_restrictions(df_farming.growth_permitted, "df_farming:cave_wheat_seed",
{fungiwood = true, tunneltube = true, sporetree = true, fungispore = true})
add_biome_restrictions(df_farming.growth_permitted, "df_farming:dimple_cup_seed",
{towergoblin = true})
add_biome_restrictions(df_farming.growth_permitted, "df_farming:pig_tail_seed",
{sporetree = true, fungispore = true})
add_biome_restrictions(df_farming.growth_permitted, "df_farming:quarry_bush_seed",
{bloodthorn = true})
add_biome_restrictions(df_farming.growth_permitted, "df_farming:sweet_pod_seed",
{tunneltube = true, fungispore = true})
add_biome_restrictions(df_farming.growth_permitted, "df_farming:plump_helmet_spawn",
{fungiwood = true, towercap = true, goblincap = true, towergoblin = true})
end

View File

@ -19,3 +19,4 @@ dofile(modpath.."/lava_sea.lua")
dofile(modpath.."/underworld.lua")
dofile(modpath.."/primordial.lua")
dofile(modpath.."/dungeon_loot.lua")
dofile(modpath.."/growth_restrictions.lua")

View File

@ -9,6 +9,10 @@ local c_mese_crystal = df_caverns.node_id.mese_crystal
local c_mese_crystal_block = df_caverns.node_id.mese_crystal_block
local c_obsidian = df_caverns.node_id.obsidian
local log_location
if mapgen_helper.log_location_enabled then
log_location = mapgen_helper.log_first_location
end
-------------------------------------------------------------------------------------------
local perlin_cave = {
@ -84,6 +88,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
data[vi] = c_air
else
data[vi] = c_lava
if log_location then log_location("magma_sea", area:position(vi)) end
end
elseif y > floor_height - 5 and y < ceiling_height and y <= lava_height + 2 and not mapgen_helper.buildable_to(data[vi]) then
data[vi] = c_obsidian -- thick obsidian floor
@ -112,13 +117,16 @@ minetest.register_on_generated(function(minp, maxp, seed)
-- decorate ceiling
if math.random() < 0.25 then
data[vi] = c_meseore
if log_location then log_location("magma_sea_meseore", area:position(vi)) end
elseif mese_intensity > 0.75 and math.random() < 0.1 then
data[vi] = c_meseore
local bi = vi-area.ystride
data[bi] = c_mese_crystal
data_param2[bi] = math.random(1,4) + 19
if log_location then log_location("magma_sea_mesecrystal", area:position(vi)) end
elseif mese_intensity > 0.85 and math.random() < 0.025 then
subterrane.big_stalactite(vi-area.ystride, area, data, 6, 13, c_meseore, c_meseore, c_mese_crystal_block)
if log_location then log_location("magma_sea_mesebig", area:position(vi)) end
end
end
end

View File

@ -28,6 +28,11 @@ if minetest.get_modpath("df_farming") then
}
end
local log_location
if mapgen_helper.log_location_enabled then
log_location = mapgen_helper.log_first_location
end
local subsea_level = df_caverns.config.level1_min - (df_caverns.config.level1_min - df_caverns.config.ymax) * 0.33
local flooding_threshold = math.min(df_caverns.config.tunnel_flooding_threshold, df_caverns.config.cavern_threshold)
@ -41,6 +46,13 @@ local get_biome = function(heat, humidity)
end
end
table.insert(df_caverns.get_biome_at_pos_list, function(pos, heat, humidity)
if pos.y < df_caverns.config.level1_min or pos.y > df_caverns.config.ymax then
return nil
end
return get_biome(heat, humidity)
end)
local tower_cap_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.1 then
@ -118,15 +130,20 @@ local decorate_level_1 = function(minp, maxp, seed, vm, node_arrays, area, data)
if minp.y < subsea_level and area:get_y(vi) < subsea_level and flooded_caverns then
-- underwater floor
df_caverns.flooded_cavern_floor(abs_cracks, vert_rand, vi, area, data)
if log_location then log_location("level1_flooded_"..biome_name, area:position(vi)) end
elseif biome_name == "towercap" then
tower_cap_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("level1_towercap", area:position(vi)) end
elseif biome_name == "fungiwood" then
fungiwood_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("level1_fungiwood", area:position(vi)) end
elseif biome_name == "barren" then
if flooded_caverns then
df_caverns.wet_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("level1_barren_wet", area:position(vi)) end
else
df_caverns.dry_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("level1_barren_dry", area:position(vi)) end
end
end
end
@ -215,6 +232,12 @@ local decorate_level_1 = function(minp, maxp, seed, vm, node_arrays, area, data)
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 log_location then
local flood_name = ""
if flooded_caverns then flood_name = "_flooded" end
log_location("level1_warren_"..biome_name..flood_name, area:position(vi))
end
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
if flooded_caverns or biome_name ~= "barren" then
-- we're in flooded areas or are not barren

View File

@ -16,6 +16,10 @@ local c_pearls = df_caverns.node_id.pearls
local chasms_path = minetest.get_modpath("chasms")
local log_location
if mapgen_helper.log_location_enabled then
log_location = mapgen_helper.log_first_location
end
local wall_vein_perlin_params = {
offset = 0,
@ -43,6 +47,13 @@ local get_biome = function(heat, humidity)
end
end
table.insert(df_caverns.get_biome_at_pos_list, function(pos, heat, humidity)
if pos.y < df_caverns.config.level2_min or pos.y >= df_caverns.config.level1_min then
return nil
end
return get_biome(heat, humidity)
end)
local goblin_cap_shrublist
local tunnel_tube_shrublist
local spore_tree_shrublist
@ -161,6 +172,7 @@ local decorate_level_2 = function(minp, maxp, seed, vm, node_arrays, area, data)
if data[vi] == c_air and math.abs(vein_noise[vein_area:transform(area, vi)]) < 0.02 then
data[vi] = c_veinstone
end
if log_location then log_location("level2_veinstone", area:position(vi)) end
end
end
if data[vi] == c_air and y <= subsea_level then
@ -182,18 +194,24 @@ local decorate_level_2 = function(minp, maxp, seed, vm, node_arrays, area, data)
if minp.y < subsea_level and area:get_y(vi) < subsea_level and flooded_caverns then
-- underwater floor
df_caverns.flooded_cavern_floor(abs_cracks, vert_rand, vi, area, data)
if log_location then log_location("level2_flooded_"..biome_name, area:position(vi)) end
elseif biome_name == "barren" then
if flooded_caverns then
df_caverns.wet_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("level2_barren_wet", area:position(vi)) end
else
df_caverns.dry_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("level2_barren_dry", area:position(vi)) end
end
elseif biome_name == "goblincap" then
goblin_cap_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
goblin_cap_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("level2_goblincap", area:position(vi)) end
elseif biome_name == "sporetree" then
spore_tree_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("level2_sporetree", area:position(vi)) end
elseif biome_name == "tunneltube" then
tunnel_tube_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("level2_tunneltube", area:position(vi)) end
end
end
@ -296,6 +314,12 @@ local decorate_level_2 = function(minp, maxp, seed, vm, node_arrays, area, data)
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.
if log_location then
local flood_name = ""
if flooded_caverns then flood_name = "_flooded" end
log_location("level2_warren_"..biome_name..flood_name, area:position(vi))
end
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
if flooded_caverns or biome_name ~= "barren" then
-- we're in flooded areas or are not barren

View File

@ -21,6 +21,11 @@ local c_webs_egg = df_caverns.node_id.big_webs_egg
local chasms_path = minetest.get_modpath("chasms")
local log_location
if mapgen_helper.log_location_enabled then
log_location = mapgen_helper.log_first_location
end
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)
@ -36,6 +41,20 @@ local get_biome = function(heat, humidity)
end
end
table.insert(df_caverns.get_biome_at_pos_list, function(pos, heat, humidity)
if pos.y < df_caverns.config.level3_min or pos.y >= df_caverns.config.level2_min then
return nil
end
local biome = get_biome(heat, humidity)
if biome == "bloodnether" then
if subterrane.get_cavern_value("cavern layer 3", pos) < 0 then
return "nethercap"
end
return "bloodthorn"
end
return biome
end)
local black_cap_shrublist
local nether_cap_shrublist
local blood_thorn_shrublist
@ -214,10 +233,12 @@ local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
-- oil slick
if y == subsea_level and data[vi] == c_water and math.abs(cave) + nvals_cracks[index2d]*0.025 < cavern_def.cave_threshold + 0.1 then
data[vi] = c_oil
if log_location then log_location("level3_blackcap_oil", vector.new(x,y,z)) end
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
if log_location then log_location("level3_nethercap_floating_ice", vector.new(x,y,z)) end
end
end
end
@ -236,7 +257,7 @@ local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
local flooded_caverns = nvals_cave[vi] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level then
-- underwater floor
-- underwater floor. Not using df_caverns.flooded_cavern_floor to make level 3 water darker
local ystride = area.ystride
if abs_cracks > 0.25 and data[vi-ystride] ~= c_water then
data[vi] = c_gravel
@ -247,10 +268,12 @@ local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
subterrane.big_stalagmite(vi+ystride, area, data, 6, 15, c_wet_flowstone, c_wet_flowstone, c_wet_flowstone)
end
end
if log_location then log_location("level3_flooded_"..biome_name, area:position(vi)) end
elseif biome_name == "barren" then
if flooded_caverns then
-- wet zone floor
df_caverns.dry_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("level3_barren_dry", area:position(vi)) end
else
-- dry zone floor, add crystals
if abs_cracks < 0.075 then
@ -258,14 +281,18 @@ local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
elseif abs_cracks > 0.3 and math.random() < 0.005 then
df_mapitems.place_big_crystal_cluster(area, data, data_param2, vi+area.ystride, math.random(0,2), false)
end
if log_location then log_location("level3_barren_wet", area:position(vi)) end
end
elseif biome_name == "blackcap" then
black_cap_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
black_cap_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("level3_blackcap", area:position(vi)) end
elseif biome_name == "bloodnether" then
if flooded_caverns then
nether_cap_cavern_floor(cracks, abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("level3_nethercap", area:position(vi)) end
else
blood_thorn_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("level3_bloodthorn", area:position(vi)) end
end
end
end
@ -396,6 +423,12 @@ local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
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.
if log_location then
local flood_name = ""
if flooded_caverns then flood_name = "_flooded" end
log_location("level3_warren_"..biome_name..flood_name, area:position(vi))
end
if flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level then
-- underwater ceiling, do nothing
elseif biome_name == "bloodnether" and flooded_caverns then

View File

@ -8,6 +8,11 @@ local c_gas_wisp = df_caverns.node_id.gas_wisp
local c_lava = df_caverns.node_id.lava
local c_obsidian = df_caverns.node_id.obsidian
local log_location
if mapgen_helper.log_location_enabled then
log_location = mapgen_helper.log_first_location
end
-------------------------------------------------------------------------------------------
local perlin_cave = {
@ -86,6 +91,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
else
data[vi] = c_oil
if log_location then log_location("oil_sea", area:position(vi)) end
end
end

View File

@ -4,6 +4,11 @@ end
local c_air = df_caverns.node_id.air
local log_location
if mapgen_helper.log_location_enabled then
log_location = mapgen_helper.log_first_location
end
local perlin_cave_primordial = {
offset = 0,
scale = 1,
@ -24,6 +29,16 @@ local perlin_wave_primordial = {
local giant_mycelium_timer_spread = tonumber(minetest.settings:get("dcaverns_giant_mycelium_timer_spread")) or 10
table.insert(df_caverns.get_biome_at_pos_list, function(pos, heat, humidity)
if pos.y < df_caverns.config.primordial_min or pos.y > df_caverns.config.primordial_max then
return nil
end
if subterrane.get_cavern_value("primordial", pos) < 0 then
return "primordial jungle"
end
return "primordial fungus"
end)
-----------------------------------------------------------------------------------------
-- Fungal biome
@ -150,6 +165,16 @@ local jungle_cavern_floor = function(abs_cracks, humidity, vi, area, data, data_
local ystride = area.ystride
local humidityfactor = humidity/100
if log_location then
local pos = area:position(vi)
log_location("primordial_jungle", pos)
if humidityfactor < 0.25 then
log_location("primordial_jungle_low_humidity", pos)
elseif humidityfactor > 0.75 then
log_location("primordial_jungle_high_humidity", pos)
end
end
data[vi] = c_jungle_dirt
local rand = math.random()
@ -268,6 +293,7 @@ local decorate_primordial = function(minp, maxp, seed, vm, node_arrays, area, da
jungle_cavern_floor(abs_cracks, humidity, vi, area, data, data_param2)
else
mushroom_cavern_floor(abs_cracks, humidity, vi, area, data, data_param2)
if log_location then log_location("primordial_mushrooms", area:position(vi)) end
end
end
@ -327,8 +353,10 @@ local decorate_primordial = function(minp, maxp, seed, vm, node_arrays, area, da
if jungle then
jungle_warren_floor(abs_cracks, vi, area, data, data_param2)
if log_location then log_location("primordial_jungle_warren", area:position(vi)) end
else
mushroom_warren_floor(abs_cracks, vi, area, data, data_param2)
if log_location then log_location("primordial_mushroom_warren", area:position(vi)) end
end
end
@ -411,7 +439,7 @@ minetest.register_ore({
random_factor = 0,
})
-- Rather than make plants farmable, have them randomly respawn in jungle soil. You can only get them down there.
-- Rather than make plants farmable, have them randomly respawn in jungle soil. You can only get them down there by foraging, not farming.
minetest.register_abm({
label = "Primordial plant growth",
nodenames = {"df_primordial_items:dirt_with_jungle_grass"},

View File

@ -74,3 +74,8 @@ dfcaverns_primordial_min (Lower limit of primordial caverns) int -4032
# during mapgen of Primordial cavern layer mushroom caverns
# then increasing this number may help.
dcaverns_giant_mycelium_timer_spread (Giant Mycelium mapgen timer spread) int 10
[Plant growth restrictions]
dfcaverns_restrict_trees_to_biomes (Restrict underground tree growth to their home biomes) bool false
dfcaverns_restrict_farmables_to_biomes (Restrict underground farmable plant growth to their home biomes) bool false

View File

@ -21,7 +21,32 @@ 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 = {}
df_caverns.data_param2 = {} -- shared among all mapgens to reduce memory clutter
df_caverns.get_biome_at_pos_list = {} -- a list of methods of the form function(pos, heat, humidity) to allow modpack-wide queries about what should grow where
df_caverns.get_biome = function(pos)
local heat = minetest.get_heat(pos)
local humidity = minetest.get_humidity(pos)
for _, val in pairs(df_caverns.get_biome_at_pos_list) do
local biome = val(pos, heat, humidity)
if biome ~= nil then
return biome
end
end
end
-- for testing
--local debug_timer = 0
--minetest.register_globalstep(function(dtime)
-- debug_timer = debug_timer + dtime
-- if debug_timer > 5 then
-- local singleplayer = minetest.get_player_by_name("singleplayer")
-- if singleplayer then
-- minetest.debug(df_caverns.get_biome(singleplayer:get_pos()))
-- end
-- debug_timer = debug_timer - 5
-- end
--end)
-- prevent mapgen from using these nodes as a base for stalactites or stalagmites
local dont_build_speleothems_on = {}

View File

@ -11,6 +11,11 @@ local c_obsidian = df_caverns.node_id.obsidian
local chasms_path = minetest.get_modpath("chasms")
local log_location
if mapgen_helper.log_location_enabled then
log_location = mapgen_helper.log_first_location
end
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
@ -18,11 +23,11 @@ for node_name, node_def in pairs(minetest.registered_nodes) do
end
end
local mushroom_shrublist
local towergoblin_shrublist
local fungispore_shrublist
if minetest.get_modpath("df_farming") then
mushroom_shrublist = {
towergoblin_shrublist = {
df_farming.spawn_plump_helmet_vm,
df_farming.spawn_plump_helmet_vm,
df_farming.spawn_dimple_cup_vm,
@ -94,7 +99,22 @@ local hot_zone_boundary = 70
local middle_zone_boundary = 50
local cool_zone_boundary = 30
local mushroom_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
table.insert(df_caverns.get_biome_at_pos_list, function(pos, heat, humidity)
if pos.y < df_caverns.config.sunless_sea_min or pos.y >= df_caverns.config.level3_min then
return nil
end
if heat > hot_zone_boundary then
return "barren" -- hot zone
elseif heat > middle_zone_boundary then
return "fungispore"
elseif heat > cool_zone_boundary then
return "towergoblin"
else
return "barren" -- cool zone
end
end)
local towergoblin_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.1 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, true)
@ -105,7 +125,7 @@ local mushroom_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, da
data[vi] = c_dirt_moss
end
if math.random() < 0.1 then
df_caverns.place_shrub(vi+ystride, area, data, data_param2, mushroom_shrublist)
df_caverns.place_shrub(vi+ystride, area, data, data_param2, towergoblin_shrublist)
elseif abs_cracks > 0.25 then
if math.random() < 0.01 then
df_trees.spawn_tower_cap_vm(vi+ystride, area, data)
@ -216,6 +236,7 @@ local decorate_sunless_sea = function(minp, maxp, seed, vm, node_arrays, area, d
end
elseif y > floor_height and y < ceiling_height and data[vi] ~= c_wet_flowstone then
data[vi] = c_air
if log_location then log_location("sunless_sea_river", vector.new(x,y,z)) end
elseif y == ceiling_height and not mapgen_helper.buildable_to(data[vi]) then
df_caverns.glow_worm_cavern_ceiling(math.abs(cracks),
mapgen_helper.xz_consistent_randomi(area, vi), vi, area, data, data_param2)
@ -266,12 +287,16 @@ local decorate_sunless_sea = function(minp, maxp, seed, vm, node_arrays, area, d
if y >= sea_level then
if heat > hot_zone_boundary then
hot_zone_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("sunless_sea_hot", area:position(vi)) end
elseif heat > middle_zone_boundary then
fungispore_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("sunless_sea_fungispore", area:position(vi)) end
elseif heat > cool_zone_boundary then
mushroom_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
towergoblin_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("sunless_sea_towergoblin", area:position(vi)) end
else
cool_zone_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
if log_location then log_location("sunless_sea_cool", area:position(vi)) end
end
elseif y >= sea_level - 30 then
if math.random() < 0.005 then
@ -285,6 +310,7 @@ local decorate_sunless_sea = function(minp, maxp, seed, vm, node_arrays, area, d
local iterations = math.random(1, 6)
df_mapitems.spawn_coral_pile(area, data, vi, iterations)
df_mapitems.spawn_castle_coral(area, data, vi+area.ystride, iterations)
if log_location then log_location("sunless_sea_castle_coral", area:position(vi)) end
end
end
end
@ -368,6 +394,7 @@ local decorate_sunless_sea = function(minp, maxp, seed, vm, node_arrays, area, d
for _, vi in ipairs(node_arrays.warren_floor_nodes) do
if area:get_y(vi) >= sea_level and not mapgen_helper.buildable_to(data[vi]) then
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
if log_location then log_location("sunless_sea_warren", area:position(vi)) end
end
end

View File

@ -11,6 +11,11 @@ local name_generator_path = minetest.get_modpath("name_generator")
local hunters_enabled = minetest.get_modpath("hunter_statue") and df_underworld_items.config.underworld_hunter_statues
local log_location
if mapgen_helper.log_location_enabled then
log_location = mapgen_helper.log_first_location
end
local name_pit = function() end
local name_ruin = function() end
@ -387,6 +392,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
if distance < pit.radius -2.5 then
if y < median + floor_displace + wave - pit.depth or y < underside_height + plasma_depth_min then
data[vi] = c_pit_plasma
if log_location then log_location("underworld_pit", vector.new(x,y,z)) end
else
data[vi] = c_air
end
@ -471,7 +477,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
if not next(named_waypoints.get_waypoints_in_area("underworld_ruins", vector.subtract(building.pos, 250), vector.add(building.pos, 250))) then
named_waypoints.add_waypoint("underworld_ruins", {x=building.pos.x, y=floor_height+1, z=building.pos.z}, {name=name_ruin()})
end
end
end
if log_location then log_location("underworld_building", building.pos) end
elseif building.building_type == "small slab" then
mapgen_helper.place_schematic_on_data(data, data_param2, area, building.pos, small_slab_schematic, building.rotation)
else
@ -499,6 +506,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
puzzle_seal = {x=minp.x+3, y=floor_height+1, z=minp.z+3}
minetest.log("info", "Puzzle seal generated at " .. minetest.pos_to_string(puzzle_seal))
if log_location then log_location("underworld_puzzle_seal", puzzle_seal) end
end
end