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

@ -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