From: paramat Date: Wed, 5 Jul 2017 14:12:21 +0000 (+0100) Subject: Saplings: Reduce grow time to ABM equivalent X-Git-Tag: 0.4.17.1~33 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f3e29bc2cc4629d1279d007861c38901aa8f5b3f;p=oweals%2Fminetest_game.git Saplings: Reduce grow time to ABM equivalent Previous times were chosen using statistical maths, but reports suggested this was too long. I tested by timing an ABM acting on 100 nodes, with interval and chance equal to the old sapling ABM. 50 at 4m59s. 99 at 24m58s. 100 at 26m58s. So choose a grow time between 5 and 25 min for tree and bush saplings. If 'can grow' is false at grow time the timer is reset to 5 min. --- diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 8e4d7120..701e70b6 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -608,7 +608,7 @@ minetest.register_node("default:sapling", { sounds = default.node_sound_leaves_defaults(), on_construct = function(pos) - minetest.get_node_timer(pos):start(math.random(2400,4800)) + minetest.get_node_timer(pos):start(math.random(300, 1500)) end, on_place = function(itemstack, placer, pointed_thing) @@ -742,7 +742,7 @@ minetest.register_node("default:junglesapling", { sounds = default.node_sound_leaves_defaults(), on_construct = function(pos) - minetest.get_node_timer(pos):start(math.random(2400,4800)) + minetest.get_node_timer(pos):start(math.random(300, 1500)) end, on_place = function(itemstack, placer, pointed_thing) @@ -821,7 +821,7 @@ minetest.register_node("default:pine_sapling", { sounds = default.node_sound_leaves_defaults(), on_construct = function(pos) - minetest.get_node_timer(pos):start(math.random(2400,4800)) + minetest.get_node_timer(pos):start(math.random(300, 1500)) end, on_place = function(itemstack, placer, pointed_thing) @@ -901,7 +901,7 @@ minetest.register_node("default:acacia_sapling", { sounds = default.node_sound_leaves_defaults(), on_construct = function(pos) - minetest.get_node_timer(pos):start(math.random(2400,4800)) + minetest.get_node_timer(pos):start(math.random(300, 1500)) end, on_place = function(itemstack, placer, pointed_thing) @@ -979,7 +979,7 @@ minetest.register_node("default:aspen_sapling", { sounds = default.node_sound_leaves_defaults(), on_construct = function(pos) - minetest.get_node_timer(pos):start(math.random(2400,4800)) + minetest.get_node_timer(pos):start(math.random(300, 1500)) end, on_place = function(itemstack, placer, pointed_thing) @@ -1362,7 +1362,7 @@ minetest.register_node("default:bush_sapling", { sounds = default.node_sound_leaves_defaults(), on_construct = function(pos) - minetest.get_node_timer(pos):start(math.random(1200, 2400)) + minetest.get_node_timer(pos):start(math.random(300, 1500)) end, on_place = function(itemstack, placer, pointed_thing) @@ -1433,7 +1433,7 @@ minetest.register_node("default:acacia_bush_sapling", { sounds = default.node_sound_leaves_defaults(), on_construct = function(pos) - minetest.get_node_timer(pos):start(math.random(1200, 2400)) + minetest.get_node_timer(pos):start(math.random(300, 1500)) end, on_place = function(itemstack, placer, pointed_thing) diff --git a/mods/default/trees.lua b/mods/default/trees.lua index 81c9831e..d00a6b5e 100644 --- a/mods/default/trees.lua +++ b/mods/default/trees.lua @@ -31,12 +31,12 @@ local function is_snow_nearby(pos) end --- Sapling ABM +-- Grow sapling function default.grow_sapling(pos) if not default.can_grow(pos) then - -- try a bit later again - minetest.get_node_timer(pos):start(math.random(240, 600)) + -- try again 5 min later + minetest.get_node_timer(pos):start(300) return end @@ -94,7 +94,7 @@ minetest.register_lbm({ "default:pine_sapling", "default:acacia_sapling", "default:aspen_sapling"}, action = function(pos) - minetest.get_node_timer(pos):start(math.random(1200, 2400)) + minetest.get_node_timer(pos):start(math.random(300, 1500)) end })