mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2024-11-05 01:50:43 +01:00
Merge branch 'master' into mineclone_compatibility
This commit is contained in:
commit
e5ceed23b8
|
@ -78,6 +78,11 @@ end
|
|||
local c_air = minetest.get_content_id("air")
|
||||
local c_web
|
||||
|
||||
local log_location
|
||||
if mapgen_helper.log_location_enabled then
|
||||
log_location = mapgen_helper.log_first_location
|
||||
end
|
||||
|
||||
local big_webs_path = minetest.get_modpath("big_webs")
|
||||
if big_webs_path then
|
||||
c_web = minetest.get_content_id("big_webs:webbing")
|
||||
|
@ -145,13 +150,16 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
webs = webs or calculate_web_array(minp, maxp) -- only calculate webs when we know we're in a chasm
|
||||
if webs[y + z*z_displace] and math.random() < 0.85 then -- random holes in the web
|
||||
data[i] = c_web
|
||||
minetest.get_node_timer({x=x,y=y,z=z}):start(1) -- this timer will check for unsupported webs
|
||||
local web_pos = vector.new(x,y,z)
|
||||
minetest.get_node_timer(web_pos):start(1) -- this timer will check for unsupported webs
|
||||
if log_location then log_location("chasm_web", web_pos) end
|
||||
else
|
||||
data[i] = c_air
|
||||
end
|
||||
else
|
||||
data[i] = c_air
|
||||
end
|
||||
if log_location then log_location("chasm", vector.new(x,y,z)) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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")
|
48
df_caverns/growth_restrictions.lua
Normal file
48
df_caverns/growth_restrictions.lua
Normal 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
|
|
@ -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")
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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"},
|
||||
|
|
|
@ -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
|
|
@ -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 = {}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_farming.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local wheat_grow_time = df_farming.config.plant_growth_time * df_farming.config.cave_wheat_delay_multiplier / 8
|
||||
|
||||
|
|
|
@ -1,75 +1,5 @@
|
|||
local S = df_farming.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local register_cooking_recipes = function(def)
|
||||
local prefix = def.prefix
|
||||
local item = def.item
|
||||
local replacements = def.replacements
|
||||
minetest.register_craftitem("df_farming:"..item.."_simple_meal", {
|
||||
description = def.simple.name,
|
||||
_doc_items_longdesc = df_farming.doc.simple_meal_desc,
|
||||
_doc_items_usagehelp = df_farming.doc.simple_meal_usage,
|
||||
inventory_image = def.simple.image,
|
||||
sound = def.simple.sound,
|
||||
on_use = minetest.item_eat(4),
|
||||
groups = {food = 4},
|
||||
_hunger_ng = {satiates = 4},
|
||||
})
|
||||
minetest.register_craftitem("df_farming:"..item.."_medium_meal", {
|
||||
description = def.medium.name,
|
||||
_doc_items_longdesc = df_farming.doc.medium_meal_desc,
|
||||
_doc_items_usagehelp = df_farming.doc.medium_meal_usage,
|
||||
inventory_image = def.medium.image,
|
||||
sound = def.medium.sound,
|
||||
on_use = minetest.item_eat(6),
|
||||
groups = {food = 6},
|
||||
_hunger_ng = {satiates = 6},
|
||||
})
|
||||
minetest.register_craftitem("df_farming:"..item.."_complex_meal", {
|
||||
description = def.complex.name,
|
||||
_doc_items_longdesc = df_farming.doc.complex_meal_desc,
|
||||
_doc_items_usagehelp = df_farming.doc.complex_meal_usage,
|
||||
inventory_image = def.complex.image,
|
||||
sound = def.complex.sound,
|
||||
on_use = minetest.item_eat(8),
|
||||
groups = {food = 8},
|
||||
_hunger_ng = {satiates = 8},
|
||||
})
|
||||
|
||||
minetest.register_alias("dfcaverns:"..item.."_biscuit", "df_farming:"..item.."_simple_meal")
|
||||
minetest.register_alias("dfcaverns:"..item.."_stew", "df_farming:"..item.."_medium_meal")
|
||||
minetest.register_alias("dfcaverns:"..item.."_roast", "df_farming:"..item.."_complex_meal")
|
||||
minetest.register_alias("df_farming:"..item.."_biscuit", "df_farming:"..item.."_simple_meal")
|
||||
minetest.register_alias("df_farming:"..item.."_stew", "df_farming:"..item.."_medium_meal")
|
||||
minetest.register_alias("df_farming:"..item.."_roast", "df_farming:"..item.."_complex_meal")
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "df_farming:"..item.."_simple_meal",
|
||||
recipe = {"group:dfcaverns_cookable", prefix..":"..item},
|
||||
replacements = replacements
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "df_farming:"..item.."_medium_meal",
|
||||
recipe = {"group:dfcaverns_cookable", "group:dfcaverns_cookable", prefix..":"..item},
|
||||
replacements = replacements
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "df_farming:"..item.."_complex_meal",
|
||||
recipe = {"group:dfcaverns_cookable", "group:dfcaverns_cookable", "group:dfcaverns_cookable", prefix..":"..item},
|
||||
replacements = replacements
|
||||
})
|
||||
end
|
||||
|
||||
--{
|
||||
-- prefix =,
|
||||
-- item =,
|
||||
-- replacements =,
|
||||
-- simple = {name = , image = , sound = },
|
||||
-- medium = {name = , image = , sound = },
|
||||
-- complex = {name = , image = , sound = },
|
||||
--}
|
||||
|
||||
local chomp = {eat = {name = "df_farming_chomp_crunch", gain = 1.0}}
|
||||
local crisp = {eat = {name = "df_farming_crisp_chew", gain = 1.0}}
|
||||
|
@ -77,61 +7,116 @@ local gummy = {eat = {name = "df_farming_gummy_chew", gain = 1.0}}
|
|||
local mushy = {eat = {name = "df_farming_mushy_chew", gain = 1.0}}
|
||||
local soft = {eat = {name = "df_farming_soft_chew", gain = 1.0}}
|
||||
|
||||
register_cooking_recipes({prefix="df_farming", item="cave_flour",
|
||||
simple = {name=S("Cave Wheat Flour Biscuit"), image="dfcaverns_prepared_food08x16.png", sound = crisp},
|
||||
medium = {name=S("Cave Wheat Flour Bun"), image="dfcaverns_prepared_food11x16.png", sound = mushy},
|
||||
complex = {name=S("Cave Wheat Flour Pancake"), image="dfcaverns_prepared_food07x16.png", sound = mushy},
|
||||
})
|
||||
register_cooking_recipes({prefix="df_farming", item="cave_wheat_seed",
|
||||
simple = {name=S("Cave Wheat Seed Loaf"), image="dfcaverns_prepared_food17x16.png", sound = crisp},
|
||||
medium = {name=S("Cave Wheat Seed Puffs"), image="dfcaverns_prepared_food33x16.png", sound = soft},
|
||||
complex = {name=S("Cave Wheat Seed Risotto"), image="dfcaverns_prepared_food14x16.png", sound = gummy},
|
||||
})
|
||||
register_cooking_recipes({prefix="df_farming", item="sweet_pod_seed",
|
||||
simple = {name=S("Sweet Pod Spore Dumplings"), image="dfcaverns_prepared_food09x16.png", sound = mushy},
|
||||
medium = {name=S("Sweet Pod Spore Single Crust Pie"), image="dfcaverns_prepared_food05x16.png", sound = mushy},
|
||||
complex = {name=S("Sweet Pod Spore Brule"), image="dfcaverns_prepared_food22x16.png", sound = soft},
|
||||
})
|
||||
register_cooking_recipes({prefix="df_farming", item="sugar",
|
||||
simple = {name=S("Sweet Pod Sugar Cookie"), image="dfcaverns_prepared_food02x16.png", sound = crisp},
|
||||
medium = {name=S("Sweet Pod Sugar Gingerbread"), image="dfcaverns_prepared_food21x16.png", sound = chomp},
|
||||
complex = {name=S("Sweet Pod Sugar Roll"), image="dfcaverns_prepared_food25x16.png", sound = crisp},
|
||||
})
|
||||
register_cooking_recipes({prefix="group", item="plump_helmet",
|
||||
simple = {name=S("Plump Helmet Mince"), image="dfcaverns_prepared_food15x16.png", sound = mushy},
|
||||
medium = {name=S("Plump Helmet Stalk Sausage"), image="dfcaverns_prepared_food18x16.png", sound = gummy},
|
||||
complex = {name=S("Plump Helmet Roast"), image="dfcaverns_prepared_food04x16.png", sound = mushy},
|
||||
})
|
||||
register_cooking_recipes({prefix="df_farming", item="plump_helmet_spawn",
|
||||
simple = {name=S("Plump Helmet Spawn Soup"), image="dfcaverns_prepared_food10x16.png", sound = gummy},
|
||||
medium = {name=S("Plump Helmet Spawn Jambalaya"), image="dfcaverns_prepared_food01x16.png", sound = soft},
|
||||
complex = {name=S("Plump Helmet Sprout Stew"), image="dfcaverns_prepared_food26x16.png", sound = gummy},
|
||||
})
|
||||
register_cooking_recipes({prefix="df_farming", item="quarry_bush_leaves",
|
||||
simple = {name=S("Quarry Bush Leaf Spicy Bun"), image="dfcaverns_prepared_food23x16.png", sound = soft},
|
||||
medium = {name=S("Quarry Bush Leaf Croissant"), image="dfcaverns_prepared_food29x16.png", sound = soft},
|
||||
complex = {name=S("Stuffed Quarry Bush Leaf"), image="dfcaverns_prepared_food27x16.png", sound = chomp},
|
||||
})
|
||||
register_cooking_recipes({prefix="df_farming", item="quarry_bush_seed",
|
||||
simple = {name=S("Rock Nut Bread"), image="dfcaverns_prepared_food16x16.png", sound = soft},
|
||||
medium = {name=S("Rock Nut Cookie"), image="dfcaverns_prepared_food07x16.png", sound = chomp},
|
||||
complex = {name=S("Rock Nut Cake"), image="dfcaverns_prepared_food03x16.png", sound = soft},
|
||||
})
|
||||
register_cooking_recipes({prefix="df_farming", item="dimple_cup_seed",
|
||||
simple = {name=S("Dimple Cup Spore Flatbread"), image="dfcaverns_prepared_food12x16.png", sound = crisp},
|
||||
medium = {name=S("Dimple Cup Spore Scone"), image="dfcaverns_prepared_food32x16.png", sound = chomp},
|
||||
complex = {name=S("Dimple Cup Spore Roll"), image="dfcaverns_prepared_food31x16.png", sound = soft},
|
||||
})
|
||||
register_cooking_recipes({prefix="df_farming", item="pig_tail_seed",
|
||||
simple = {name=S("Pig Tail Spore Sandwich"), image="dfcaverns_prepared_food20x16.png", sound = soft},
|
||||
medium = {name=S("Pig Tail Spore Tofu"), image="dfcaverns_prepared_food30x16.png", sound = gummy},
|
||||
complex = {name=S("Pig Tail Spore Casserole"), image="dfcaverns_prepared_food34x16.png", sound = mushy},
|
||||
})
|
||||
register_cooking_recipes({prefix="df_farming", item="dwarven_syrup_bucket", replacements={{"df_farming:dwarven_syrup_bucket", "bucket:bucket_empty"}},
|
||||
simple = {name=S("Dwarven Syrup Taffy"), image="dfcaverns_prepared_food19x16.png", sound = gummy},
|
||||
medium = {name=S("Dwarven Syrup Jellies"), image="dfcaverns_prepared_food06x16.png", sound = gummy},
|
||||
complex = {name=S("Dwarven Syrup Delight"), image="dfcaverns_prepared_food24x16.png", sound = mushy},
|
||||
})
|
||||
local recipes = {
|
||||
{recipe = {"df_farming:cave_flour", "df_farming:cave_wheat_seed"}, name=S("Cave Wheat Flour Biscuit"), image="dfcaverns_prepared_food08x16.png", sound = crisp},
|
||||
{recipe = {"df_farming:cave_flour", "df_farming:cave_wheat_seed", "group:sugar"}, name=S("Cave Wheat Flour Bun"), image="dfcaverns_prepared_food11x16.png", sound = mushy},
|
||||
{recipe = {"df_farming:cave_flour", "group:food_flour", "df_farming:cave_wheat_seed", "df_farming:plump_helmet_spawn"}, name=S("Cave Wheat Flour Pancake"), image="dfcaverns_prepared_food07x16.png", sound = mushy},
|
||||
{recipe = {"df_farming:cave_wheat_seed", "group:plump_helmet"}, name=S("Cave Wheat Seed Loaf"), image="dfcaverns_prepared_food17x16.png", sound = crisp},
|
||||
{recipe = {"df_farming:cave_wheat_seed", "df_farming:cave_wheat_seed", "group:sugar"}, name=S("Cave Wheat Seed Puffs"), image="dfcaverns_prepared_food33x16.png", sound = soft},
|
||||
{recipe = {"df_farming:cave_wheat_seed", "df_farming:cave_wheat_seed", "df_farming:pig_tail_seed", "df_farming:plump_helmet_spawn"}, name=S("Cave Wheat Seed Risotto"), image="dfcaverns_prepared_food14x16.png", sound = gummy},
|
||||
{recipe = {"df_farming:sweet_pod_seed", "group:food_flour"}, name=S("Sweet Pod Spore Dumplings"), image="dfcaverns_prepared_food09x16.png", sound = mushy},
|
||||
{recipe = {"df_farming:sweet_pod_seed", "group:food_flour", "group:sugar"}, name=S("Sweet Pod Spore Single Crust Pie"), image="dfcaverns_prepared_food05x16.png", sound = mushy},
|
||||
{recipe = {"df_farming:sweet_pod_seed", "group:sugar", "group:food_flour", "df_farming:dwarven_syrup_bucket"}, replacements={{"df_farming:dwarven_syrup_bucket", "bucket:bucket_empty"}}, name=S("Sweet Pod Spore Brule"), image="dfcaverns_prepared_food22x16.png", sound = soft},
|
||||
{recipe = {"df_farming:sugar", "group:food_flour"}, name=S("Sweet Pod Sugar Cookie"), image="dfcaverns_prepared_food02x16.png", sound = crisp},
|
||||
{recipe = {"df_farming:sugar", "group:food_flour", "df_farming:quarry_bush_leaves"}, name=S("Sweet Pod Sugar Gingerbread"), image="dfcaverns_prepared_food21x16.png", sound = chomp},
|
||||
{recipe = {"df_farming:sugar", "group:sugar", "group:food_flour", "group:food_flour"}, name=S("Sweet Pod Sugar Roll"), image="dfcaverns_prepared_food25x16.png", sound = crisp},
|
||||
{recipe = {"group:plump_helmet", "group:plump_helmet"}, name=S("Plump Helmet Mince"), image="dfcaverns_prepared_food15x16.png", sound = mushy},
|
||||
{recipe = {"group:plump_helmet", "group:plump_helmet", "df_farming:quarry_bush_leaves"}, name=S("Plump Helmet Stalk Sausage"), image="dfcaverns_prepared_food18x16.png", sound = gummy},
|
||||
{recipe = {"group:plump_helmet", "group:food_flour", "df_farming:plump_helmet_spawn", "df_farming:quarry_bush_leaves"}, name=S("Plump Helmet Roast"), image="dfcaverns_prepared_food04x16.png", sound = mushy},
|
||||
{recipe = {"df_farming:plump_helmet_spawn", "group:plump_helmet"}, name=S("Plump Helmet Spawn Soup"), image="dfcaverns_prepared_food10x16.png", sound = gummy},
|
||||
{recipe = {"df_farming:plump_helmet_spawn", "df_farming:quarry_bush_seed", "group:plump_helmet"}, name=S("Plump Helmet Spawn Jambalaya"), image="dfcaverns_prepared_food01x16.png", sound = soft},
|
||||
{recipe = {"df_farming:plump_helmet_spawn", "df_farming:plump_helmet_spawn", "group:plump_helmet", "group:plump_helmet"}, name=S("Plump Helmet Sprout Stew"), image="dfcaverns_prepared_food26x16.png", sound = gummy},
|
||||
{recipe = {"df_farming:quarry_bush_leaves", "df_farming:cave_bread"}, name=S("Quarry Bush Leaf Spicy Bun"), image="dfcaverns_prepared_food23x16.png", sound = soft},
|
||||
{recipe = {"df_farming:quarry_bush_leaves", "group:food_flour", "group:plump_helmet"}, name=S("Quarry Bush Leaf Croissant"), image="dfcaverns_prepared_food29x16.png", sound = soft},
|
||||
{recipe = {"df_farming:quarry_bush_leaves", "group:plump_helmet", "group:plump_helmet", "group:plump_helmet"}, name=S("Stuffed Quarry Bush Leaf"), image="dfcaverns_prepared_food27x16.png", sound = chomp},
|
||||
{recipe = {"df_farming:quarry_bush_seed", "df_farming:cave_bread"}, name=S("Rock Nut Bread"), image="dfcaverns_prepared_food16x16.png", sound = soft},
|
||||
{recipe = {"df_farming:quarry_bush_seed", "group:food_flour", "group:sugar"}, name=S("Rock Nut Cookie"), image="dfcaverns_prepared_food07x16.png", sound = chomp},
|
||||
{recipe = {"df_farming:quarry_bush_seed", "group:sugar", "df_farming:sweet_pod_seed", "group:food_flour"}, name=S("Rock Nut Cake"), image="dfcaverns_prepared_food03x16.png", sound = soft},
|
||||
{recipe = {"df_farming:dimple_cup_seed", "group:food_flour"}, name=S("Dimple Cup Spore Flatbread"), image="dfcaverns_prepared_food12x16.png", sound = crisp},
|
||||
{recipe = {"df_farming:dimple_cup_seed", "group:food_flour", "group:sugar"}, name=S("Dimple Cup Spore Scone"), image="dfcaverns_prepared_food32x16.png", sound = chomp},
|
||||
{recipe = {"df_farming:dimple_cup_seed", "df_farming:sweet_pod_seed", "df_farming:quarry_bush_seed", "group:food_flour"}, name=S("Dimple Cup Spore Roll"), image="dfcaverns_prepared_food31x16.png", sound = soft},
|
||||
{recipe = {"df_farming:pig_tail_seed", "df_farming:cave_bread"}, name=S("Pig Tail Spore Sandwich"), image="dfcaverns_prepared_food20x16.png", sound = soft},
|
||||
{recipe = {"df_farming:pig_tail_seed", "df_farming:pig_tail_seed", "df_farming:dwarven_syrup_bucket"}, name=S("Pig Tail Spore Tofu"), replacements={{"df_farming:dwarven_syrup_bucket", "bucket:bucket_empty"}}, image="dfcaverns_prepared_food30x16.png", sound = gummy},
|
||||
{recipe = {"df_farming:pig_tail_seed", "df_farming:sweet_pod_seed", "group:food_flour", "group:food_flour"}, name=S("Pig Tail Spore Casserole"), image="dfcaverns_prepared_food34x16.png", sound = mushy},
|
||||
{recipe = {"df_farming:dwarven_syrup_bucket", "df_farming:dwarven_syrup_bucket"}, replacements={{"df_farming:dwarven_syrup_bucket", "bucket:bucket_empty"}, {"df_farming:dwarven_syrup_bucket", "bucket:bucket_empty"}}, name=S("Dwarven Syrup Taffy"), image="dfcaverns_prepared_food19x16.png", sound = gummy},
|
||||
{recipe = {"df_farming:dwarven_syrup_bucket", "group:sugar", "group:plump_helmet"}, replacements={{"df_farming:dwarven_syrup_bucket", "bucket:bucket_empty"}}, name=S("Dwarven Syrup Jellies"), image="dfcaverns_prepared_food06x16.png", sound = gummy},
|
||||
{recipe = {"df_farming:dwarven_syrup_bucket", "group:food_flour", "group:sugar", "df_farming:quarry_bush_seed"}, replacements={{"df_farming:dwarven_syrup_bucket", "bucket:bucket_empty"}}, name=S("Dwarven Syrup Delight"), image="dfcaverns_prepared_food24x16.png", sound = mushy},
|
||||
}
|
||||
|
||||
local complexity = {[2]={name="simple", value=4}, [3]={name="medium", value=6}, [4]={name="complex", value=8}}
|
||||
local alias_items = {}
|
||||
|
||||
-- validate the recipes.
|
||||
for index1 = 1, table.getn(recipes)-1 do
|
||||
for index2 = index1+1, table.getn(recipes) do
|
||||
local recipe1 = recipes[index1].recipe
|
||||
local recipe2 = recipes[index2].recipe
|
||||
local recipe1count = {}
|
||||
local recipe2count = {}
|
||||
for _, item in pairs(recipe1) do
|
||||
recipe1count[item] = (recipe1count[item] or 0) + 1
|
||||
end
|
||||
for _, item in pairs(recipe2) do
|
||||
recipe2count[item] = (recipe2count[item] or 0) + 1
|
||||
end
|
||||
local identical = true
|
||||
for key, val in pairs(recipe1count) do
|
||||
if recipe2count[key] ~= val then
|
||||
identical = false
|
||||
break
|
||||
end
|
||||
end
|
||||
for key, val in pairs(recipe2count) do
|
||||
if recipe1count[key] ~= val then
|
||||
identical = false
|
||||
break
|
||||
end
|
||||
end
|
||||
assert(not identical, "recipes " .. recipes[index1].name .. " and " .. recipes[index2].name .. " have identical ingredients!")
|
||||
end
|
||||
end
|
||||
local ingredient_count = {}
|
||||
--for _, recipe_entry in pairs(recipes) do
|
||||
-- for _, item in pairs(recipe_entry.recipe) do
|
||||
-- ingredient_count[item] = (ingredient_count[item] or 0) + 1
|
||||
-- end
|
||||
--end
|
||||
--minetest.debug(dump(ingredient_count))
|
||||
|
||||
for _, def in pairs(recipes) do
|
||||
local recipe_type = complexity[table.getn(def.recipe)]
|
||||
local _, item_name = string.match(def.recipe[1], "(.*):(.*)")
|
||||
local output = "df_farming:"..item_name.."_"..recipe_type.name.."_meal"
|
||||
alias_items[item_name] = true
|
||||
|
||||
minetest.register_craftitem(output, {
|
||||
description = def.name,
|
||||
_doc_items_longdesc = df_farming.doc[recipe_type.name.."_meal_desc"],
|
||||
_doc_items_usagehelp = df_farming.doc[recipe_type.name.."_meal_usage"],
|
||||
inventory_image = def.image,
|
||||
sound = def.sound,
|
||||
on_use = minetest.item_eat(recipe_type.value),
|
||||
groups = {food = recipe_type.value},
|
||||
_hunger_ng = {satiates = recipe_type.value},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = output,
|
||||
recipe = def.recipe,
|
||||
replacements = def.replacements
|
||||
})
|
||||
end
|
||||
|
||||
for item, _ in pairs(alias_items) do
|
||||
minetest.register_alias("dfcaverns:"..item.."_biscuit", "df_farming:"..item.."_simple_meal")
|
||||
minetest.register_alias("dfcaverns:"..item.."_stew", "df_farming:"..item.."_medium_meal")
|
||||
minetest.register_alias("dfcaverns:"..item.."_roast", "df_farming:"..item.."_complex_meal")
|
||||
minetest.register_alias("df_farming:"..item.."_biscuit", "df_farming:"..item.."_simple_meal")
|
||||
minetest.register_alias("df_farming:"..item.."_stew", "df_farming:"..item.."_medium_meal")
|
||||
minetest.register_alias("df_farming:"..item.."_roast", "df_farming:"..item.."_complex_meal")
|
||||
end
|
||||
|
||||
|
||||
-- dfcaverns_prepared_food28 is currently unused
|
||||
-- dfcaverns_prepared_food13 is used for dwarven bread
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_farming.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local dimple_grow_time = df_farming.config.plant_growth_time * df_farming.config.dimple_cup_delay_multiplier / 4
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ if not minetest.get_modpath("doc") then
|
|||
return
|
||||
end
|
||||
|
||||
local S = df_farming.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
df_farming.doc.simple_meal_desc = S("A meal made from the admixture of two ingredients, it keeps well but are not a rich source of nutrients.")
|
||||
df_farming.doc.simple_meal_usage = nil
|
||||
|
|
27
df_farming/growth_conditions.lua
Normal file
27
df_farming/growth_conditions.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
df_farming.growth_permitted = {}
|
||||
-- The defaults here are very boring on account of how the farming code already
|
||||
-- checks soil conditions. Other mods can insert biome checks and whatnot here.
|
||||
|
||||
df_farming.growth_permitted["df_farming:cave_wheat_seed"] = function(pos)
|
||||
return true
|
||||
end
|
||||
|
||||
df_farming.growth_permitted["df_farming:dimple_cup_seed"] = function(pos)
|
||||
return true
|
||||
end
|
||||
|
||||
df_farming.growth_permitted["df_farming:pig_tail_seed"] = function(pos)
|
||||
return true
|
||||
end
|
||||
|
||||
df_farming.growth_permitted["df_farming:quarry_bush_seed"] = function(pos)
|
||||
return true
|
||||
end
|
||||
|
||||
df_farming.growth_permitted["df_farming:sweet_pod_seed"] = function(pos)
|
||||
return true
|
||||
end
|
||||
|
||||
df_farming.growth_permitted["df_farming:plump_helmet_spawn"] = function(pos)
|
||||
return true
|
||||
end
|
|
@ -1,7 +1,6 @@
|
|||
df_farming = {}
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
df_farming.S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
--load companion lua files
|
||||
|
@ -18,3 +17,4 @@ dofile(modpath.."/plump_helmet.lua")
|
|||
dofile(modpath.."/quarry_bush.lua")
|
||||
dofile(modpath.."/sweet_pod.lua")
|
||||
dofile(modpath.."/cooking.lua")
|
||||
dofile(modpath.."/growth_conditions.lua")
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_farming.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local pig_tail_grow_time = df_farming.config.plant_growth_time * df_farming.config.pig_tail_delay_multiplier / 8
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_farming.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- Plants
|
||||
|
@ -35,7 +35,6 @@ df_farming.spawn_dead_fungus_vm = function(vi, area, data, param2_data)
|
|||
param2_data[vi] = 0
|
||||
end
|
||||
|
||||
-- not DF canon
|
||||
minetest.register_node("df_farming:cavern_fungi", {
|
||||
description = S("Cavern Fungi"),
|
||||
_doc_items_longdesc = df_farming.doc.cavern_fungi_desc,
|
||||
|
@ -132,7 +131,12 @@ local place_seed = function(itemstack, placer, pointed_thing, plantname)
|
|||
|
||||
-- add the node and remove 1 item from the itemstack
|
||||
minetest.add_node(pt.above, {name = plantname, param2 = 1})
|
||||
df_farming.plant_timer(pt.above, plantname)
|
||||
local growth_permitted_function = df_farming.growth_permitted[plantname]
|
||||
if not growth_permitted_function or growth_permitted_function(pt.above) then
|
||||
df_farming.plant_timer(pt.above, plantname)
|
||||
else
|
||||
minetest.get_node_timer(pt.above):stop() -- make sure no old timers are running on this node
|
||||
end
|
||||
if not minetest.settings:get_bool("creative_mode", false) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
@ -169,6 +173,10 @@ df_farming.register_seed = function(name, description, image, stage_one, grow_ti
|
|||
on_timer = function(pos, elapsed)
|
||||
df_farming.grow_underground_plant(pos, "df_farming:"..name, elapsed)
|
||||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end,
|
||||
}
|
||||
|
||||
minetest.register_node("df_farming:"..name, def)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_farming.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local displace_x = 0.125
|
||||
local displace_z = 0.125
|
||||
|
@ -47,7 +47,12 @@ local plump_helmet_on_place = function(itemstack, placer, pointed_thing, plantn
|
|||
|
||||
-- add the node and remove 1 item from the itemstack
|
||||
minetest.add_node(pt.above, {name = plantname, param2 = math.random(0,3)})
|
||||
df_farming.plant_timer(pt.above, plantname)
|
||||
|
||||
local growth_permitted_function = df_farming.growth_permitted["df_farming:plump_helmet_spawn"] -- use the same permitted function for all plump helmets
|
||||
if not growth_permitted_function or growth_permitted_function(pt.above) then
|
||||
df_farming.plant_timer(pt.above, plantname)
|
||||
end
|
||||
|
||||
if not minetest.settings:get_bool("creative_mode", false) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
@ -85,6 +90,10 @@ minetest.register_node("df_farming:plump_helmet_spawn", {
|
|||
on_timer = function(pos, elapsed)
|
||||
df_farming.grow_underground_plant(pos, "df_farming:plump_helmet_spawn", elapsed)
|
||||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("df_farming:plump_helmet_1", {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_farming.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local quarry_grow_time = df_farming.config.plant_growth_time * df_farming.config.quarry_bush_delay_multiplier / 5
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_farming.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local sweet_pod_grow_time = df_farming.config.plant_growth_time * df_farming.config.sweet_pod_delay_multiplier / 6
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ minetest.register_node("df_mapitems:cobble_with_floor_fungus", {
|
|||
drop = cobble_node,
|
||||
is_ground_content = false,
|
||||
paramtype = "light",
|
||||
groups = {cracky = 3, stone = 2, slippery = 1, light_sensitive_fungus = 8},
|
||||
groups = {cracky = 3, stone = 2, slippery = 1, light_sensitive_fungus = 8, df_caverns_floor_fungus = 1},
|
||||
_dfcaverns_dead_node = df_mapitems.node_name.cobble,
|
||||
sounds = df_mapitems.sounds.floor_fungus,
|
||||
})
|
||||
|
@ -196,30 +196,32 @@ minetest.register_node("df_mapitems:cobble_with_floor_fungus_fine", {
|
|||
drop = cobble_node,
|
||||
is_ground_content = false,
|
||||
paramtype = "light",
|
||||
groups = {cracky = 3, stone = 2, slippery = 1, light_sensitive_fungus = 8},
|
||||
groups = {cracky = 3, stone = 2, slippery = 1, light_sensitive_fungus = 8, df_caverns_floor_fungus = 1},
|
||||
_dfcaverns_dead_node = df_mapitems.node_name.cobble,
|
||||
df_mapitems.sounds.floor_fungus,
|
||||
on_timer = function(pos, elapsed)
|
||||
minetest.swap_node(pos, {name="df_mapitems:cobble_with_floor_fungus"})
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm{
|
||||
label = "df_mapitems:floor_fungus_spread",
|
||||
nodenames = {cobble_node},
|
||||
neighbors = {"df_mapitems:cobble_with_floor_fungus"},
|
||||
neighbors = {"group:df_caverns_floor_fungus"},
|
||||
interval = 60,
|
||||
chance = 10,
|
||||
catch_up = true,
|
||||
action = function(pos)
|
||||
minetest.swap_node(pos, {name="df_mapitems:cobble_with_floor_fungus_fine"})
|
||||
end,
|
||||
}
|
||||
minetest.register_abm{
|
||||
label = "df_mapitems:floor_fungus_thickening",
|
||||
nodenames = {"df_mapitems:cobble_with_floor_fungus_fine"},
|
||||
interval = 59,
|
||||
chance = 10,
|
||||
catch_up = true,
|
||||
action = function(pos)
|
||||
minetest.swap_node(pos, {name="df_mapitems:cobble_with_floor_fungus"})
|
||||
local above_def = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name]
|
||||
if above_def and (above_def.buildable_to == true or above_def.walkable == false) then
|
||||
minetest.swap_node(pos, {name="df_mapitems:cobble_with_floor_fungus_fine"})
|
||||
if math.random() > 0.5 then
|
||||
minetest.get_node_timer(pos):start(math.random(100, 1000))
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_primordial_items.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
---------------------------------------------------------------------------------------
|
||||
-- Glownode and stalk
|
||||
|
|
|
@ -2,7 +2,7 @@ if not minetest.get_modpath("doc") then
|
|||
return
|
||||
end
|
||||
|
||||
local S = df_primordial_items.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
df_primordial_items.doc.big_mushroom_desc = S("Compared to the behemoths found elsewhere in the deep places of the world, the giant mushrooms of the primordial jungles are on the smaller side - often overwhelmed by the green plants that grow in the mysterious light below. Still, they can become substantial resources.")
|
||||
df_primordial_items.doc.big_mushroom_usage = S("The soft flesh of these large mushrooms is much less woody than other giant mushrooms, making it ill-suited to structural use. This makes it rather more nutritious, however.")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_primordial_items.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
minetest.register_craftitem("df_primordial_items:primordial_fruit", {
|
||||
description = S("Primordial Fruit"),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_primordial_items.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Plants
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_primordial_items.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
------------------------------------------------------------------------------------
|
||||
-- Nodes
|
||||
|
@ -307,12 +307,11 @@ minetest.register_node("df_primordial_items:fern_sapling", {
|
|||
use_texture_alpha = "clip",
|
||||
sunlight_propagates = true,
|
||||
on_construct = function(pos)
|
||||
if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") == 0 then
|
||||
return
|
||||
if df_primordial_items.giant_fern_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.tree_max_growth_delay))
|
||||
end
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.tree_max_growth_delay))
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- This file defines a type of root-like growth that spreads over the surface of the ground in a random web-like pattern
|
||||
|
||||
local S = df_primordial_items.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
-- hub_thickness -- the bit in the middle that's seen at the ends and corners of long hypha runs
|
||||
-- connector_thickness
|
||||
|
@ -320,7 +320,9 @@ minetest.register_node("df_primordial_items:giant_hypha_apical_meristem", {
|
|||
_dfcaverns_dead_node = "df_primordial_items:giant_hypha_root",
|
||||
sounds = df_trees.node_sound_tree_soft_fungus_defaults(),
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(math.random(min_growth_delay, max_growth_delay))
|
||||
if df_primordial_items.giant_mycelium_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(math.random(min_growth_delay, max_growth_delay))
|
||||
end
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
|
|
@ -2,7 +2,6 @@ df_primordial_items = {}
|
|||
df_primordial_items.doc = {}
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
df_primordial_items.S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
dofile(modpath.."/dependencies.lua")
|
||||
|
@ -15,4 +14,5 @@ dofile(modpath.."/fungal_nodes.lua")
|
|||
dofile(modpath.."/ceiling_fungus.lua")
|
||||
dofile(modpath.."/primordial_mushroom.lua")
|
||||
dofile(modpath.."/giant_mycelium.lua")
|
||||
dofile(modpath.."/edibles.lua")
|
||||
dofile(modpath.."/edibles.lua")
|
||||
dofile(modpath.."/sapling_growth_conditions.lua")
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_primordial_items.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
-- Big jungle mushroom
|
||||
|
@ -109,12 +109,11 @@ minetest.register_node("df_primordial_items:jungle_mushroom_sapling", {
|
|||
sunlight_propagates = true,
|
||||
|
||||
on_construct = function(pos)
|
||||
if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") == 0 then
|
||||
return
|
||||
if df_primordial_items.jungle_mushroom_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.tree_max_growth_delay))
|
||||
end
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.tree_max_growth_delay))
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_primordial_items.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
----------------------------------------------------
|
||||
-- Ferns
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_primordial_items.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
-- Leaves
|
||||
minetest.register_node("df_primordial_items:jungle_leaves", {
|
||||
|
@ -237,12 +237,11 @@ minetest.register_node("df_primordial_items:jungletree_sapling", {
|
|||
use_texture_alpha = "clip",
|
||||
sunlight_propagates = true,
|
||||
on_construct = function(pos)
|
||||
if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") == 0 then
|
||||
return
|
||||
if df_primordial_items.jungletree_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.tree_max_growth_delay))
|
||||
end
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.tree_max_growth_delay))
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_primordial_items.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
minetest.register_node("df_primordial_items:mushroom_trunk", {
|
||||
description = S("Primordial Mushroom Trunk"),
|
||||
|
@ -750,12 +750,11 @@ minetest.register_node("df_primordial_items:mush_sapling", {
|
|||
use_texture_alpha = "clip",
|
||||
sunlight_propagates = true,
|
||||
on_construct = function(pos)
|
||||
if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") == 0 then
|
||||
return
|
||||
if df_primordial_items.primordial_mushroom_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.tree_max_growth_delay))
|
||||
end
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.tree_max_growth_delay))
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
|
22
df_primordial_items/sapling_growth_conditions.lua
Normal file
22
df_primordial_items/sapling_growth_conditions.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
-- these methods should indicate whether a sapling placed at pos should bother attempting to grow.
|
||||
-- check soil conditions and biome here, for example.
|
||||
|
||||
df_primordial_items.giant_fern_growth_permitted = function(pos)
|
||||
return minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") > 0
|
||||
end
|
||||
|
||||
df_primordial_items.giant_mycelium_growth_permitted = function(pos)
|
||||
return true
|
||||
end
|
||||
|
||||
df_primordial_items.jungle_mushroom_growth_permitted = function(pos)
|
||||
return minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") > 0
|
||||
end
|
||||
|
||||
df_primordial_items.jungletree_growth_permitted = function(pos)
|
||||
return minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") > 0
|
||||
end
|
||||
|
||||
df_primordial_items.primordial_mushroom_growth_permitted = function(pos)
|
||||
return minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") > 0
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_trees.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
--stem
|
||||
minetest.register_node("df_trees:black_cap_stem", {
|
||||
|
@ -151,8 +151,7 @@ minetest.register_node("df_trees:black_cap_sapling", {
|
|||
sounds = df_trees.sounds.leaves,
|
||||
|
||||
on_construct = function(pos)
|
||||
local below_node_name = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
if minetest.get_item_group(below_node_name, "soil") > 0 or minetest.get_item_group(below_node_name, "coal") > 0 then
|
||||
if df_trees.black_cap_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.black_cap_delay_multiplier*df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.black_cap_delay_multiplier*df_trees.config.tree_max_growth_delay))
|
||||
|
@ -163,6 +162,9 @@ minetest.register_node("df_trees:black_cap_sapling", {
|
|||
end,
|
||||
|
||||
on_timer = function(pos)
|
||||
if df_farming and df_farming.kill_if_sunlit(pos) then
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, {name="air"})
|
||||
df_trees.spawn_black_cap(pos)
|
||||
end,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- High density wood
|
||||
-- Depth 3
|
||||
|
||||
local S = df_trees.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local spike_directions = {
|
||||
{dir={x=0,y=0,z=1}, facedir=2},
|
||||
|
@ -224,11 +224,11 @@ function df_trees.grow_blood_thorn(pos, node)
|
|||
if node.param2 >= 4 then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y - 1
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then
|
||||
|
||||
if not df_trees.blood_thorn_growth_permitted(pos) then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y + 1
|
||||
|
||||
local height = 0
|
||||
local max_height = max_bloodthorn_height(pos)
|
||||
while node.name == "df_trees:blood_thorn" and height < max_height do
|
||||
|
|
|
@ -13,7 +13,7 @@ local function deep_copy(table_in)
|
|||
return table_out
|
||||
end
|
||||
|
||||
local S = df_trees.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
df_trees.sounds = {}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ if not minetest.get_modpath("doc") then
|
|||
return
|
||||
end
|
||||
|
||||
local S = df_trees.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
-- Trees
|
||||
df_trees.doc.black_cap_desc = S("The dense black wood of these mushrooms is heavy and hard to work with, and has few remarkable properties.")
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
-- Max trunk height 8
|
||||
-- depth 1-2
|
||||
|
||||
local S = df_trees.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
minetest.register_node("df_trees:fungiwood", {
|
||||
description = S("Fungiwood Stem"),
|
||||
|
@ -123,12 +123,11 @@ minetest.register_node("df_trees:fungiwood_sapling", {
|
|||
sounds = df_trees.sounds.leaves,
|
||||
|
||||
on_construct = function(pos)
|
||||
if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") == 0 then
|
||||
return
|
||||
if df_trees.fungiwood_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.fungiwood_delay_multiplier*df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.fungiwood_delay_multiplier*df_trees.config.tree_max_growth_delay))
|
||||
end
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.fungiwood_delay_multiplier*df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.fungiwood_delay_multiplier*df_trees.config.tree_max_growth_delay))
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S = df_trees.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local log_location
|
||||
if minetest.get_modpath("mapgen_helper") and mapgen_helper.log_location_enabled then
|
||||
log_location = mapgen_helper.log_first_location
|
||||
end
|
||||
|
||||
--stem
|
||||
minetest.register_node("df_trees:goblin_cap_stem", {
|
||||
|
@ -210,12 +215,11 @@ minetest.register_node("df_trees:goblin_cap_sapling", {
|
|||
sounds = df_trees.sounds.leaves,
|
||||
|
||||
on_construct = function(pos)
|
||||
if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") == 0 then
|
||||
return
|
||||
if df_trees.goblin_cap_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.goblin_cap_delay_multiplier*df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.goblin_cap_delay_multiplier*df_trees.config.tree_max_growth_delay))
|
||||
end
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.goblin_cap_delay_multiplier*df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.goblin_cap_delay_multiplier*df_trees.config.tree_max_growth_delay))
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
@ -297,18 +301,22 @@ df_trees.spawn_goblin_cap_vm = function(vi, area, data, data_param2)
|
|||
local pos = area:position(vi)
|
||||
if math.random() < 0.5 then
|
||||
mapgen_helper.place_schematic_on_data(data, data_param2, area, pos, big_goblin_cap_schem)
|
||||
if log_location then log_location("goblin_cap_big", pos) end
|
||||
elseif math.random() < 0.9 then
|
||||
mapgen_helper.place_schematic_on_data(data, data_param2, area, pos, bigger_goblin_cap_schem)
|
||||
if log_location then log_location("goblin_cap_bigger", pos) end
|
||||
else
|
||||
-- easter egg - every once in a while (0.5%), a mapgen Goblin cap is a Smurf house
|
||||
minetest.after(5, init_hut, pos)
|
||||
if math.random() < 0.5 then
|
||||
mapgen_helper.place_schematic_on_data(data, data_param2, area, pos, big_goblin_cap_hut_schem)
|
||||
if log_location then log_location("goblin_cap_big_hut", pos) end
|
||||
else
|
||||
if init_vessels then
|
||||
minetest.after(5, init_vessels, pos)
|
||||
end
|
||||
mapgen_helper.place_schematic_on_data(data, data_param2, area, pos, bigger_goblin_cap_hut_schem)
|
||||
if log_location then log_location("goblin_cap_bigger_hut", pos) end
|
||||
end
|
||||
end
|
||||
return
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
df_trees = {}
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
df_trees.S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
--load companion lua files
|
||||
|
@ -10,8 +9,6 @@ dofile(modpath.."/dependencies.lua")
|
|||
dofile(modpath.."/doc.lua")
|
||||
dofile(modpath.."/aliases.lua")
|
||||
|
||||
local S = df_trees.S
|
||||
|
||||
dofile(modpath.."/blood_thorn.lua")
|
||||
dofile(modpath.."/fungiwood.lua")
|
||||
dofile(modpath.."/tunnel_tube.lua")
|
||||
|
@ -24,3 +21,4 @@ dofile(modpath.."/tower_cap.lua")
|
|||
dofile(modpath.."/torchspine.lua")
|
||||
dofile(modpath.."/spindlestem.lua")
|
||||
|
||||
dofile(modpath.."/sapling_growth_conditions.lua")
|
|
@ -1,4 +1,4 @@
|
|||
name = df_trees
|
||||
description = Adds various types of underground fungal "trees". Light kills their saplings, they only grow in the dark.
|
||||
depends = default
|
||||
optional_depends = doc, moreblocks, stairs, vessels, basic_materials, farming, doors, beds, df_farming
|
||||
optional_depends = doc, moreblocks, stairs, vessels, basic_materials, farming, doors, beds, df_farming, mapgen_helper
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_trees.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
--stem
|
||||
minetest.register_node("df_trees:nether_cap_stem", {
|
||||
|
@ -109,14 +109,11 @@ minetest.register_node("df_trees:nether_cap_sapling", {
|
|||
sounds = df_trees.sounds.leaves,
|
||||
|
||||
on_construct = function(pos)
|
||||
local node_below_name = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
if minetest.get_item_group(node_below_name, "cools_lava") == 0 or minetest.get_item_group(node_below_name, "nether_cap") > 0 then
|
||||
return
|
||||
if df_trees.nether_cap_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.nether_cap_delay_multiplier*df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.nether_cap_delay_multiplier*df_trees.config.tree_max_growth_delay))
|
||||
end
|
||||
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.nether_cap_delay_multiplier*df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.nether_cap_delay_multiplier*df_trees.config.tree_max_growth_delay))
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
|
51
df_trees/sapling_growth_conditions.lua
Normal file
51
df_trees/sapling_growth_conditions.lua
Normal file
|
@ -0,0 +1,51 @@
|
|||
-- these methods should indicate whether a sapling placed at pos should bother attempting to grow.
|
||||
-- check soil conditions and biome here, for example.
|
||||
|
||||
local stone_with_coal = df_trees.node_names.stone_with_coal
|
||||
local coalblock = df_trees.node_names.coalblock
|
||||
local is_coal = function(name)
|
||||
return name == stone_with_coal or name == coalblock
|
||||
end
|
||||
|
||||
df_trees.black_cap_growth_permitted = function(pos)
|
||||
local below_name = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
return minetest.get_item_group(below_name, "soil") > 0 or is_coal(below_name)
|
||||
end
|
||||
|
||||
df_trees.blood_thorn_growth_permitted = function(pos)
|
||||
return minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "sand") > 0
|
||||
end
|
||||
|
||||
df_trees.fungiwood_growth_permitted = function(pos)
|
||||
return minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") > 0
|
||||
end
|
||||
|
||||
df_trees.goblin_cap_growth_permitted = function(pos)
|
||||
return minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") > 0
|
||||
end
|
||||
|
||||
df_trees.nether_cap_growth_permitted = function(pos)
|
||||
local below_name = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
return minetest.get_item_group(below_name, "cools_lava") > 0 and minetest.get_item_group(below_name, "nether_cap") == 0
|
||||
end
|
||||
|
||||
df_trees.spindlestem_growth_permitted = function(pos)
|
||||
return minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") > 0
|
||||
end
|
||||
|
||||
df_trees.spore_tree_growth_permitted = function(pos)
|
||||
return minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") > 0
|
||||
end
|
||||
|
||||
df_trees.torchspine_growth_permitted = function(pos)
|
||||
local below_name = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
return minetest.get_item_group(below_name, "flammable") > 0 or is_coal(below_name)
|
||||
end
|
||||
|
||||
df_trees.tower_cap_growth_permitted = function(pos)
|
||||
return minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") > 0
|
||||
end
|
||||
|
||||
df_trees.tunnel_tube_growth_permitted = function(pos)
|
||||
return minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") > 0
|
||||
end
|
|
@ -6,13 +6,13 @@ local n6 = { name = "df_trees:goblin_cap_stem", force_place=true } -- walls
|
|||
local n7 = { name = "df_trees:goblin_cap_stem_wood", force_place=true } -- internal floor
|
||||
local n8 = { name = "doors:door_wood_a", force_place=true }
|
||||
local n9 = { name = "doors:hidden", force_place=true }
|
||||
local n10 = { name = "default:furnace", param2 = 3, force_place=true }
|
||||
local n10 = { name = df_trees.node_names.furnace, param2 = 3, force_place=true }
|
||||
local n11 = { name = "air", force_place=true } -- internal air
|
||||
local n12 = { name = "beds:bed_bottom", force_place=true }
|
||||
local n13 = { name = "df_trees:goblin_cap_stem", prob = 198, force_place=true } -- possible window holes
|
||||
local n16 = { name = "default:chest", param2 = 3, force_place=true }
|
||||
local n16 = { name = df_trees.node_names.chest, param2 = 3, force_place=true }
|
||||
local n17 = { name = "beds:bed_top", force_place=true }
|
||||
local n18 = { name = "default:torch_wall", param2 = 4, force_place=true }
|
||||
local n18 = { name = df_trees.node_names.torch_wall, param2 = 4, force_place=true }
|
||||
local n19 = { name = "df_trees:goblin_cap_stem" } -- base
|
||||
|
||||
local n20 = {name = "stairs:stair_goblin_cap_stem_wood", param2 = 1 }
|
||||
|
@ -35,6 +35,13 @@ if not minetest.get_modpath("beds") then
|
|||
n12 = n11
|
||||
n17 = n11
|
||||
end
|
||||
if not minetest.get_modpath("stairs") then
|
||||
-- replace stairs with air
|
||||
n3 = nil
|
||||
n20 = nil
|
||||
n21 = nil
|
||||
n22 = nil
|
||||
end
|
||||
|
||||
return {
|
||||
yslice_prob = {},
|
||||
|
|
|
@ -5,17 +5,17 @@ local n4 = { name = "df_trees:goblin_cap_gills" }
|
|||
local n5 = { name = "df_trees:goblin_cap_stem", force_place = true } -- walls, force place these
|
||||
local n6 = { name = "df_trees:goblin_cap_stem", prob = 198, force_place=true } -- possible window holes
|
||||
local n7 = { name = "df_trees:goblin_cap_stem_wood", force_place=true } -- internal floor
|
||||
local n8 = { name = "default:furnace", param2 = 2, force_place=true }
|
||||
local n8 = { name = df_trees.node_names.furnace, param2 = 2, force_place=true }
|
||||
local n9 = { name = "air", force_place=true } -- internal air
|
||||
local n10 = { name = "default:torch_wall", param2 = 3, force_place = true }
|
||||
local n10 = { name = df_trees.node_names.torch_wall, param2 = 3, force_place = true }
|
||||
local n12 = {name = "stairs:slab_goblin_cap_stem_wood", param2 = 2} -- porch top
|
||||
local n13 = { name = "doors:door_wood_a", param2 = 3, force_place = true }
|
||||
local n14 = { name = "doors:hidden", param2 = 3, force_place = true }
|
||||
local n15 = n9 -- internal air, but could be a vessel shelf
|
||||
local n16 = { name = "beds:bed_top", param2 = 3, force_place = true }
|
||||
local n17 = { name = "beds:bed_bottom", param2 = 3, force_place = true }
|
||||
local n18 = { name = "default:chest", force_place = true }
|
||||
local n19 = { name = "default:torch_wall", param2 = 2, force_place = true }
|
||||
local n18 = { name = df_trees.node_names.chest, force_place = true }
|
||||
local n19 = { name = df_trees.node_names.torch_wall, param2 = 2, force_place = true }
|
||||
local n20 = {name = "stairs:stair_goblin_cap_stem_wood" }
|
||||
local n21 = {name = "stairs:stair_goblin_cap_stem_wood", param2 = 2 }
|
||||
local n22 = {name = "stairs:slab_goblin_cap_stem_wood", param2 = 22}
|
||||
|
@ -37,7 +37,13 @@ if not minetest.get_modpath("beds") then
|
|||
n16 = n9
|
||||
n17 = n9
|
||||
end
|
||||
|
||||
if not minetest.get_modpath("stairs") then
|
||||
-- replace stairs with air
|
||||
n12 = nil
|
||||
n20 = nil
|
||||
n21 = nil
|
||||
n22 = nil
|
||||
end
|
||||
|
||||
return {
|
||||
yslice_prob = {},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_trees.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local vessels = minetest.get_modpath("vessels")
|
||||
|
||||
|
@ -274,10 +274,9 @@ minetest.register_node("df_trees:spindlestem_seedling", {
|
|||
|
||||
on_place = stem_on_place,
|
||||
on_construct = function(pos)
|
||||
if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") == 0 then
|
||||
return
|
||||
if df_trees.spindlestem_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(growth_delay())
|
||||
end
|
||||
minetest.get_node_timer(pos):start(growth_delay())
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- Max trunk height 5
|
||||
-- depth 2-3
|
||||
|
||||
local S = df_trees.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
minetest.register_node("df_trees:spore_tree", {
|
||||
description = S("Spore Tree Stem"),
|
||||
|
@ -165,12 +165,11 @@ minetest.register_node("df_trees:spore_tree_sapling", {
|
|||
sounds = df_trees.sounds.leaves,
|
||||
|
||||
on_construct = function(pos)
|
||||
if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") == 0 then
|
||||
return
|
||||
if df_trees.spore_tree_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.spore_tree_delay_multiplier*df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.spore_tree_delay_multiplier*df_trees.config.tree_max_growth_delay))
|
||||
end
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.spore_tree_delay_multiplier*df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.spore_tree_delay_multiplier*df_trees.config.tree_max_growth_delay))
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
local S = df_trees.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local torchspine_min_delay = df_trees.config.blood_thorn_delay_multiplier*df_trees.config.tree_min_growth_delay
|
||||
local torchspine_max_delay = df_trees.config.blood_thorn_delay_multiplier*df_trees.config.tree_max_growth_delay
|
||||
|
||||
|
||||
-- Rather than make this whole mod depend on subterrane just for this, I copied and pasted a chunk of stalactite code.
|
||||
local x_disp = 0.125
|
||||
|
@ -52,6 +56,49 @@ local stal_box_2 = {{-0.125+x_disp, -0.5, -0.125+z_disp, 0.125+x_disp, 0.5, 0.12
|
|||
local stal_box_3 = {{-0.25+x_disp, -0.5, -0.25+z_disp, 0.25+x_disp, 0.5, 0.25+z_disp}}
|
||||
local stal_box_4 = {{-0.375+x_disp, -0.5, -0.375+z_disp, 0.375+x_disp, 0.5, 0.375+z_disp}}
|
||||
|
||||
local torchspine_list = {"df_trees:torchspine_1","df_trees:torchspine_2","df_trees:torchspine_3","df_trees:torchspine_4"}
|
||||
local grow_torchspine = function(pos)
|
||||
local param2 = minetest.get_node(pos).param2
|
||||
|
||||
if param2 > 3 then
|
||||
return -- tipped over, don't grow
|
||||
end
|
||||
|
||||
local node_above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
local node_above_def = minetest.registered_nodes[node_above.name]
|
||||
if not node_above_def.buildable_to then
|
||||
-- don't grow, but do continue cycling the torch state
|
||||
minetest.swap_node(pos, {name = "df_trees:torchspine_1", param2 = node.param2})
|
||||
minetest.get_node_timer(pos):start(math.random(torchspine_min_delay, torchspine_max_delay))
|
||||
return
|
||||
end
|
||||
|
||||
local pos_base = vector.new(pos)
|
||||
local height = 1
|
||||
for i = 1,3 do
|
||||
pos_base.y = pos_base.y-1
|
||||
if minetest.get_item_group(minetest.get_node(pos_base).name, "df_trees_torchspine") > 0 then
|
||||
height = height + 1
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
if height >= 4 then
|
||||
-- don't grow, but do continue cycling the torch state
|
||||
minetest.swap_node(pos, {name = "df_trees:torchspine_1", param2 = node.param2})
|
||||
minetest.get_node_timer(pos):start(math.random(torchspine_min_delay, torchspine_max_delay))
|
||||
return
|
||||
end
|
||||
|
||||
-- place a taller torchspine
|
||||
pos.y = pos.y + 1
|
||||
minetest.get_node_timer(pos):start(math.random(torchspine_min_delay, torchspine_max_delay))
|
||||
for i = 1, height+1 do
|
||||
minetest.swap_node(pos, {name=torchspine_list[i], param2=param2})
|
||||
pos.y = pos.y - 1
|
||||
end
|
||||
end
|
||||
|
||||
local torch_node = df_trees.node_names.torch
|
||||
|
||||
minetest.register_node("df_trees:torchspine_1", {
|
||||
|
@ -59,7 +106,7 @@ minetest.register_node("df_trees:torchspine_1", {
|
|||
_doc_items_longdesc = df_trees.doc.torchspine_desc,
|
||||
_doc_items_usagehelp = df_trees.doc.torchspine_usage,
|
||||
tiles = {"dfcaverns_torchspine_0.5.png", "dfcaverns_torchspine_1.5.png", "dfcaverns_torchspine_1.png"},
|
||||
groups = {oddly_breakable_by_hand = 1, subterrane_stal_align = 1, flow_through = 1, fall_damage_add_percent = 100},
|
||||
groups = {oddly_breakable_by_hand = 1, subterrane_stal_align = 1, flow_through = 1, fall_damage_add_percent = 100, df_trees_torchspine = 1},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
|
@ -75,6 +122,18 @@ minetest.register_node("df_trees:torchspine_1", {
|
|||
minetest.swap_node(pos, {name = "df_trees:torchspine_1_lit", param2 = node.param2})
|
||||
end
|
||||
end,
|
||||
|
||||
on_timer = function(pos)
|
||||
local above_def = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name]
|
||||
if above_def and above_def.buildable_to then
|
||||
minetest.swap_node(pos, {name="df_trees:torchspine_1_lit", param2=minetest.get_node(pos).param2})
|
||||
end
|
||||
minetest.get_node_timer(pos):start(math.random(torchspine_min_delay, torchspine_max_delay))
|
||||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("df_trees:torchspine_1_lit", {
|
||||
|
@ -82,7 +141,7 @@ minetest.register_node("df_trees:torchspine_1_lit", {
|
|||
_doc_items_longdesc = df_trees.doc.torchspine_desc,
|
||||
_doc_items_usagehelp = df_trees.doc.torchspine_usage,
|
||||
tiles = {df_trees.textures.gold_block, "dfcaverns_torchspine_1.5.png", "dfcaverns_torchspine_1_lit.png"},
|
||||
groups = {oddly_breakable_by_hand = 1, subterrane_stal_align = 1, flow_through = 1, torch = 1, fall_damage_add_percent = 150, smokey = 4},
|
||||
groups = {oddly_breakable_by_hand = 1, subterrane_stal_align = 1, flow_through = 1, torch = 1, fall_damage_add_percent = 150, smokey = 4, df_trees_torchspine = 1},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
|
@ -94,6 +153,14 @@ minetest.register_node("df_trees:torchspine_1_lit", {
|
|||
fixed = stal_box_1,
|
||||
},
|
||||
on_place = stal_on_place,
|
||||
|
||||
on_timer = function(pos)
|
||||
grow_torchspine(pos)
|
||||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("df_trees:torchspine_2", {
|
||||
|
@ -101,7 +168,7 @@ minetest.register_node("df_trees:torchspine_2", {
|
|||
_doc_items_longdesc = df_trees.doc.torchspine_desc,
|
||||
_doc_items_usagehelp = df_trees.doc.torchspine_usage,
|
||||
tiles = {"dfcaverns_torchspine_1.5.png", "dfcaverns_torchspine_2.5.png", "dfcaverns_torchspine_2.png"},
|
||||
groups = {oddly_breakable_by_hand = 1, subterrane_stal_align = 1, flow_through = 1, fall_damage_add_percent = 50},
|
||||
groups = {oddly_breakable_by_hand = 1, subterrane_stal_align = 1, flow_through = 1, fall_damage_add_percent = 50, df_trees_torchspine = 1},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
|
@ -127,7 +194,7 @@ minetest.register_node("df_trees:torchspine_3", {
|
|||
_doc_items_longdesc = df_trees.doc.torchspine_desc,
|
||||
_doc_items_usagehelp = df_trees.doc.torchspine_usage,
|
||||
tiles = {"dfcaverns_torchspine_2.5.png", "dfcaverns_torchspine_3.5.png", "dfcaverns_torchspine_3.png"},
|
||||
groups = {oddly_breakable_by_hand = 1, subterrane_stal_align = 1, flow_through = 1},
|
||||
groups = {oddly_breakable_by_hand = 1, subterrane_stal_align = 1, flow_through = 1, df_trees_torchspine = 1},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
|
@ -157,7 +224,7 @@ minetest.register_node("df_trees:torchspine_4", {
|
|||
_doc_items_longdesc = df_trees.doc.torchspine_desc,
|
||||
_doc_items_usagehelp = df_trees.doc.torchspine_usage,
|
||||
tiles = {"dfcaverns_torchspine_3.5.png", "dfcaverns_torchspine_4.5.png", "dfcaverns_torchspine_4.png"},
|
||||
groups = {oddly_breakable_by_hand = 1, subterrane_stal_align = 1, flow_through = 1},
|
||||
groups = {oddly_breakable_by_hand = 1, subterrane_stal_align = 1, flow_through = 1, df_trees_torchspine = 1},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
|
@ -201,6 +268,20 @@ minetest.register_node("df_trees:torchspine_ember", {
|
|||
}
|
||||
},
|
||||
on_place = stal_on_place,
|
||||
|
||||
on_construct = function(pos)
|
||||
if df_trees.torchspine_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(math.random(torchspine_min_delay, torchspine_max_delay))
|
||||
end
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end,
|
||||
|
||||
on_timer = function(pos)
|
||||
minetest.swap_node(pos, {name="df_trees:torchspine_1", param2=minetest.get_node(pos).param2})
|
||||
minetest.get_node_timer(pos):start(math.random(torchspine_min_delay, torchspine_max_delay))
|
||||
end,
|
||||
})
|
||||
|
||||
df_trees.spawn_torchspine = function(pos)
|
||||
|
@ -259,80 +340,12 @@ df_trees.spawn_torchspine_vm = function(vi, area, data, data_param2, height, lit
|
|||
end
|
||||
end
|
||||
|
||||
-- overriding node groups using override_item doesn't appear to work with ABMs:
|
||||
-- https://github.com/minetest/minetest/issues/5518
|
||||
local coal_def = minetest.registered_nodes[df_trees.node_names.stone_with_coal]
|
||||
local coal_block_def = minetest.registered_nodes[df_trees.node_names.coalblock]
|
||||
if coal_def then
|
||||
coal_def.groups.coal = 1
|
||||
minetest.register_node(":"..df_trees.node_names.stone_with_coal, coal_def)
|
||||
end
|
||||
coal_block_def.groups.coal = 1
|
||||
minetest.register_node(":"..df_trees.node_names.coalblock, coal_block_def)
|
||||
|
||||
minetest.register_abm{
|
||||
label = "torchspine germinating",
|
||||
nodenames = {"df_trees:torchspine_ember"},
|
||||
neighbors = {"group:flammable", "group:coal"},
|
||||
interval = 30,
|
||||
chance = 10,
|
||||
catch_up = true,
|
||||
action = function(pos)
|
||||
local below_name = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
if minetest.get_item_group(below_name, "flammable") > 0 or minetest.get_item_group(below_name, "coal") > 0 then
|
||||
minetest.swap_node(pos, {name="df_trees:torchspine_1", param2=minetest.get_node(pos).param2})
|
||||
end
|
||||
minetest.register_lbm({
|
||||
label = "Start timers for torchspine nodes that used to depend on the ABM",
|
||||
name = "df_trees:start_torchspine_timers",
|
||||
nodenames = {"df_trees:torchspine_ember", "df_trees:torchspine_1", "df_trees:torchspine_1_lit"},
|
||||
run_at_every_load = false,
|
||||
action = function(pos, node)
|
||||
minetest.get_node_timer(pos):start(math.random(torchspine_min_delay, torchspine_max_delay))
|
||||
end,
|
||||
}
|
||||
minetest.register_abm{
|
||||
label = "torchspine lighting",
|
||||
nodenames = {"df_trees:torchspine_1"},
|
||||
interval = 30,
|
||||
chance = 10,
|
||||
catch_up = true,
|
||||
action = function(pos)
|
||||
local above_def = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name]
|
||||
if above_def and above_def.buildable_to then
|
||||
minetest.swap_node(pos, {name="df_trees:torchspine_1_lit", param2=minetest.get_node(pos).param2})
|
||||
end
|
||||
end,
|
||||
}
|
||||
local torchspine_list = {"df_trees:torchspine_1","df_trees:torchspine_2","df_trees:torchspine_3","df_trees:torchspine_4"}
|
||||
minetest.register_abm{
|
||||
label = "torchspine growing",
|
||||
nodenames = {"df_trees:torchspine_1_lit"},
|
||||
interval = 37,
|
||||
chance = 10,
|
||||
catch_up = true,
|
||||
action = function(pos)
|
||||
local height = 0
|
||||
local param2 = minetest.get_node(pos).param2
|
||||
local dest_list = {{x=pos.x, y=pos.y+1, z=pos.z},pos,{x=pos.x, y=pos.y-1, z=pos.z},{x=pos.x, y=pos.y-2, z=pos.z},{x=pos.x, y=pos.y-3, z=pos.z}}
|
||||
local source_list = {
|
||||
minetest.get_node(dest_list[1]).name,
|
||||
minetest.get_node(dest_list[2]).name,
|
||||
minetest.get_node(dest_list[3]).name,
|
||||
minetest.get_node(dest_list[4]).name,
|
||||
minetest.get_node(dest_list[5]).name
|
||||
}
|
||||
local target_def = minetest.registered_nodes[source_list[1]]
|
||||
if target_def and target_def.buildable_to then
|
||||
for i = 2,4 do
|
||||
if minetest.get_item_group(source_list[i+1], "flammable") > 0 or minetest.get_item_group(source_list[i+1], "coal") > 0 then
|
||||
height = i
|
||||
break
|
||||
elseif source_list[i+1] ~= torchspine_list[i] then
|
||||
height = 0
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if height == 0 then
|
||||
minetest.swap_node(pos, {name="df_trees:torchspine_1", param2=param2})
|
||||
return
|
||||
end
|
||||
for i = 1, height do
|
||||
minetest.swap_node(dest_list[i], {name=torchspine_list[i], param2=param2})
|
||||
end
|
||||
end,
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local S = df_trees.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
--stem
|
||||
minetest.register_node("df_trees:tower_cap_stem", {
|
||||
|
@ -134,12 +134,11 @@ minetest.register_node("df_trees:tower_cap_sapling", {
|
|||
sounds = df_trees.sounds.leaves,
|
||||
|
||||
on_construct = function(pos)
|
||||
if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") == 0 then
|
||||
return
|
||||
if df_trees.tower_cap_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.tower_cap_delay_multiplier*df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.tower_cap_delay_multiplier*df_trees.config.tree_max_growth_delay))
|
||||
end
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.tower_cap_delay_multiplier*df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.tower_cap_delay_multiplier*df_trees.config.tree_max_growth_delay))
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- Max trunk height 8
|
||||
-- depth 2-3
|
||||
|
||||
local S = df_trees.S
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
minetest.register_node("df_trees:tunnel_tube", {
|
||||
description = S("Tunnel Tube"),
|
||||
|
@ -311,12 +311,11 @@ minetest.register_node("df_trees:tunnel_tube_sapling", {
|
|||
sounds = df_trees.sounds.leaves,
|
||||
|
||||
on_construct = function(pos)
|
||||
if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") == 0 then
|
||||
return
|
||||
if df_trees.tunnel_tube_growth_permitted(pos) then
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.tunnel_tube_delay_multiplier*df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.tunnel_tube_delay_multiplier*df_trees.config.tree_max_growth_delay))
|
||||
end
|
||||
minetest.get_node_timer(pos):start(math.random(
|
||||
df_trees.config.tunnel_tube_delay_multiplier*df_trees.config.tree_min_growth_delay,
|
||||
df_trees.config.tunnel_tube_delay_multiplier*df_trees.config.tree_max_growth_delay))
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
|
|
@ -28,6 +28,11 @@ if minetest.get_modpath("default") then
|
|||
end
|
||||
end
|
||||
|
||||
local log_location
|
||||
if minetest.get_modpath("mapgen_helper") and mapgen_helper.log_location_enabled then
|
||||
log_location = mapgen_helper.log_first_location
|
||||
end
|
||||
|
||||
local ignore
|
||||
if minetest.get_modpath("chasms") then
|
||||
-- the chasms mod already sets up a method to allow chasms to avoid overwriting stalactites and whatnot,
|
||||
|
@ -137,6 +142,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
data[vi] = c_gravel
|
||||
else
|
||||
data[vi] = c_air
|
||||
if log_location then log_location("pit_cave", vector.new(x,y,z)) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user