simplify tree growth config a bit

This commit is contained in:
FaceDeer 2017-03-16 13:33:50 -06:00
parent 2177175593
commit 9d781eca6c
9 changed files with 42 additions and 32 deletions

View File

@ -2,7 +2,7 @@ local CONFIG_FILE_PREFIX = "dfcaverns_"
dfcaverns.config = {}
local print_settingtypes = true
local print_settingtypes = false
local function setting(stype, name, default, description)
local value
@ -24,18 +24,20 @@ local function setting(stype, name, default, description)
end
local trees = {
{name="fungiwood", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
{name="tunnel_tube", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
{name="spore_tree", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
{name="black_cap", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
{name="nether_cap", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
{name="goblin_cap", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
{name="tower_cap", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
{name="fungiwood", min_depth=-100, max_depth=-31000, delay_multiplier = 1},
{name="tunnel_tube", min_depth=-100, max_depth=-31000, delay_multiplier = 1},
{name="spore_tree", min_depth=-100, max_depth=-31000, delay_multiplier = 1},
{name="black_cap", min_depth=-100, max_depth=-31000, delay_multiplier = 1},
{name="nether_cap", min_depth=-100, max_depth=-31000, delay_multiplier = 1},
{name="goblin_cap", min_depth=-100, max_depth=-31000, delay_multiplier = 1},
{name="tower_cap", min_depth=-100, max_depth=-31000, delay_multiplier = 1},
}
setting("int", "tree_min_growth_delay", 2400, "Minimum sapling growth delay")
setting("int", "tree_max_growth_delay", 4800, "Maximum sapling growth delay")
for _, tree in pairs(trees) do
setting("int", tree.name.."_min_growth_delay", tree.min_delay, tree.name.." minimum sapling growth delay")
setting("int", tree.name.."_max_growth_delay", tree.max_delay, tree.name.." maximum sapling growth delay")
setting("float", tree.name.."_delay_multiplier", tree.delay_multiplier, tree.name.." growth delay multiplier")
setting("int", tree.name.."_min_depth", tree.min_depth, tree.name.." minimum sapling growth depth")
setting("int", tree.name.."_max_depth", tree.max_depth, tree.name.." maximum sapling growth depth")
end

View File

@ -1,29 +1,24 @@
dfcaverns_fungiwood_min_growth_delay (fungiwood minimum sapling growth delay) int 2400
dfcaverns_fungiwood_max_growth_delay (fungiwood maximum sapling growth delay) int 4800
dfcaverns_tree_min_growth_delay (Minimum sapling growth delay) int 2400
dfcaverns_tree_max_growth_delay (Maximum sapling growth delay) int 4800
dfcaverns_fungiwood_delay_multiplier (fungiwood growth delay multiplier) float 1
dfcaverns_fungiwood_min_depth (fungiwood minimum sapling growth depth) int -100
dfcaverns_fungiwood_max_depth (fungiwood maximum sapling growth depth) int -31000
dfcaverns_tunnel_tube_min_growth_delay (tunnel_tube minimum sapling growth delay) int 2400
dfcaverns_tunnel_tube_max_growth_delay (tunnel_tube maximum sapling growth delay) int 4800
dfcaverns_tunnel_tube_delay_multiplier (tunnel_tube growth delay multiplier) float 1
dfcaverns_tunnel_tube_min_depth (tunnel_tube minimum sapling growth depth) int -100
dfcaverns_tunnel_tube_max_depth (tunnel_tube maximum sapling growth depth) int -31000
dfcaverns_spore_tree_min_growth_delay (spore_tree minimum sapling growth delay) int 2400
dfcaverns_spore_tree_max_growth_delay (spore_tree maximum sapling growth delay) int 4800
dfcaverns_spore_tree_delay_multiplier (spore_tree growth delay multiplier) float 1
dfcaverns_spore_tree_min_depth (spore_tree minimum sapling growth depth) int -100
dfcaverns_spore_tree_max_depth (spore_tree maximum sapling growth depth) int -31000
dfcaverns_black_cap_min_growth_delay (black_cap minimum sapling growth delay) int 2400
dfcaverns_black_cap_max_growth_delay (black_cap maximum sapling growth delay) int 4800
dfcaverns_black_cap_delay_multiplier (black_cap growth delay multiplier) float 1
dfcaverns_black_cap_min_depth (black_cap minimum sapling growth depth) int -100
dfcaverns_black_cap_max_depth (black_cap maximum sapling growth depth) int -31000
dfcaverns_nether_cap_min_growth_delay (nether_cap minimum sapling growth delay) int 2400
dfcaverns_nether_cap_max_growth_delay (nether_cap maximum sapling growth delay) int 4800
dfcaverns_nether_cap_delay_multiplier (nether_cap growth delay multiplier) float 1
dfcaverns_nether_cap_min_depth (nether_cap minimum sapling growth depth) int -100
dfcaverns_nether_cap_max_depth (nether_cap maximum sapling growth depth) int -31000
dfcaverns_goblin_cap_min_growth_delay (goblin_cap minimum sapling growth delay) int 2400
dfcaverns_goblin_cap_max_growth_delay (goblin_cap maximum sapling growth delay) int 4800
dfcaverns_goblin_cap_delay_multiplier (goblin_cap growth delay multiplier) float 1
dfcaverns_goblin_cap_min_depth (goblin_cap minimum sapling growth depth) int -100
dfcaverns_goblin_cap_max_depth (goblin_cap maximum sapling growth depth) int -31000
dfcaverns_tower_cap_min_growth_delay (tower_cap minimum sapling growth delay) int 2400
dfcaverns_tower_cap_max_growth_delay (tower_cap maximum sapling growth delay) int 4800
dfcaverns_tower_cap_delay_multiplier (tower_cap growth delay multiplier) float 1
dfcaverns_tower_cap_min_depth (tower_cap minimum sapling growth depth) int -100
dfcaverns_tower_cap_max_depth (tower_cap maximum sapling growth depth) int -31000
dfcaverns_blood_thorn_growth_interval (blood_thorn growth ABM interval) int 12

View File

@ -63,7 +63,9 @@ minetest.register_node("dfcaverns:black_cap_sapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.black_cap_min_growth_delay,dfcaverns.config.black_cap_max_growth_delay))
minetest.get_node_timer(pos):start(math.random(
dfcaverns.config.black_cap_delay_multiplier*dfcaverns.config.tree_min_growth_delay,
dfcaverns.config.black_cap_delay_multiplier*dfcaverns.config.tree_max_growth_delay))
end,
on_timer = function(pos)

View File

@ -68,7 +68,9 @@ minetest.register_node("dfcaverns:fungiwood_sapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.fungiwood_min_growth_delay,dfcaverns.config.fungiwood_max_growth_delay))
minetest.get_node_timer(pos):start(math.random(
dfcaverns.config.fungiwood_delay_multiplier*dfcaverns.config.tree_min_growth_delay,
dfcaverns.config.fungiwood_delay_multiplier*dfcaverns.config.tree_max_growth_delay))
end,
on_timer = function(pos)

View File

@ -63,7 +63,9 @@ minetest.register_node("dfcaverns:goblin_cap_sapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.goblin_cap_min_growth_delay,dfcaverns.config.goblin_cap_max_growth_delay))
minetest.get_node_timer(pos):start(math.random(
dfcaverns.config.goblin_cap_delay_multiplier*dfcaverns.config.tree_min_growth_delay,
dfcaverns.config.goblin_cap_delay_multiplier*dfcaverns.config.tree_max_growth_delay))
end,
on_timer = function(pos)

View File

@ -63,7 +63,9 @@ minetest.register_node("dfcaverns:nether_cap_sapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.nether_cap_min_growth_delay,dfcaverns.config.nether_cap_max_growth_delay))
minetest.get_node_timer(pos):start(math.random(
dfcaverns.config.nether_cap_delay_multiplier*dfcaverns.config.tree_min_growth_delay,
dfcaverns.config.nether_cap_delay_multiplier*dfcaverns.config.tree_max_growth_delay))
end,
on_timer = function(pos)

View File

@ -24,7 +24,6 @@ minetest.register_node("dfcaverns:spore_tree", {
minetest.set_node(pos, {name="air"})
minetest.spawn_tree(pos, dfcaverns.spore_tree_model)
end,
})
minetest.register_node("dfcaverns:spore_tree_frond", {
@ -109,7 +108,9 @@ minetest.register_node("dfcaverns:spore_tree_sapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.spore_tree_min_growth_delay, dfcaverns.config.spore_tree_max_growth_delay))
minetest.get_node_timer(pos):start(math.random(
dfcaverns.config.spore_tree_delay_multiplier*dfcaverns.config.tree_min_growth_delay,
dfcaverns.config.spore_tree_delay_multiplier*dfcaverns.config.tree_max_growth_delay))
end,
on_timer = function(pos)

View File

@ -63,7 +63,9 @@ minetest.register_node("dfcaverns:tower_cap_sapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.tower_cap_min_growth_delay,dfcaverns.config.tower_cap_max_growth_delay))
minetest.get_node_timer(pos):start(math.random(
dfcaverns.config.tower_cap_delay_multiplier*dfcaverns.config.tree_min_growth_delay,
dfcaverns.config.tower_cap_delay_multiplier*dfcaverns.config.tree_max_growth_delay))
end,
on_timer = function(pos)

View File

@ -77,7 +77,9 @@ minetest.register_node("dfcaverns:tunnel_tube_sapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.tunnel_tube_min_growth_delay,dfcaverns.config.tunnel_tube_max_growth_delay))
minetest.get_node_timer(pos):start(math.random(
dfcaverns.config.tunnel_tube_delay_multiplier*dfcaverns.config.tree_min_growth_delay,
dfcaverns.config.tunnel_tube_delay_multiplier*dfcaverns.config.tree_max_growth_delay))
end,
on_timer = function(pos)