diff --git a/config.lua b/config.lua index 278ea8b..00c7651 100644 --- a/config.lua +++ b/config.lua @@ -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 diff --git a/settingtypes.txt b/settingtypes.txt index 66973e6..da6b20e 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -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 diff --git a/trees/black_cap.lua b/trees/black_cap.lua index 6f58dc5..3a0ca72 100644 --- a/trees/black_cap.lua +++ b/trees/black_cap.lua @@ -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) diff --git a/trees/fungiwood.lua b/trees/fungiwood.lua index 5ae20c0..1f4c4bc 100644 --- a/trees/fungiwood.lua +++ b/trees/fungiwood.lua @@ -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) diff --git a/trees/goblin_cap.lua b/trees/goblin_cap.lua index b6234bd..40754bd 100644 --- a/trees/goblin_cap.lua +++ b/trees/goblin_cap.lua @@ -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) diff --git a/trees/nether_cap.lua b/trees/nether_cap.lua index 02119b2..1eb5aa3 100644 --- a/trees/nether_cap.lua +++ b/trees/nether_cap.lua @@ -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) diff --git a/trees/spore_tree.lua b/trees/spore_tree.lua index 32745de..9eb169c 100644 --- a/trees/spore_tree.lua +++ b/trees/spore_tree.lua @@ -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) diff --git a/trees/tower_cap.lua b/trees/tower_cap.lua index d2a589f..c4a4454 100644 --- a/trees/tower_cap.lua +++ b/trees/tower_cap.lua @@ -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) diff --git a/trees/tunnel_tube.lua b/trees/tunnel_tube.lua index 61e0567..dfd94f8 100644 --- a/trees/tunnel_tube.lua +++ b/trees/tunnel_tube.lua @@ -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)