forked from minetest/minetest_game
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.
This commit is contained in:
parent
3a72f7b84b
commit
f3e29bc2cc
@ -608,7 +608,7 @@ minetest.register_node("default:sapling", {
|
|||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
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,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
@ -742,7 +742,7 @@ minetest.register_node("default:junglesapling", {
|
|||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
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,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
@ -821,7 +821,7 @@ minetest.register_node("default:pine_sapling", {
|
|||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
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,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
@ -901,7 +901,7 @@ minetest.register_node("default:acacia_sapling", {
|
|||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
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,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
@ -979,7 +979,7 @@ minetest.register_node("default:aspen_sapling", {
|
|||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
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,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
@ -1362,7 +1362,7 @@ minetest.register_node("default:bush_sapling", {
|
|||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
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,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
@ -1433,7 +1433,7 @@ minetest.register_node("default:acacia_bush_sapling", {
|
|||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
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,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
@ -31,12 +31,12 @@ local function is_snow_nearby(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Sapling ABM
|
-- Grow sapling
|
||||||
|
|
||||||
function default.grow_sapling(pos)
|
function default.grow_sapling(pos)
|
||||||
if not default.can_grow(pos) then
|
if not default.can_grow(pos) then
|
||||||
-- try a bit later again
|
-- try again 5 min later
|
||||||
minetest.get_node_timer(pos):start(math.random(240, 600))
|
minetest.get_node_timer(pos):start(300)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ minetest.register_lbm({
|
|||||||
"default:pine_sapling", "default:acacia_sapling",
|
"default:pine_sapling", "default:acacia_sapling",
|
||||||
"default:aspen_sapling"},
|
"default:aspen_sapling"},
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
minetest.get_node_timer(pos):start(math.random(1200, 2400))
|
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user