I love this mod: it allows for so much expressive space on our minetest farms and in great communal kolkhozes. However, when one attemps to grow a tree, it takes multiple attempts, during which nothing happens and the fertilizer isn't spent, and only once the random number generator strikes a '1' it generates particles and erects the tree from the sapling. This just begs the fix.
I suppose it should spend the bonemeal in the meantime: that would just achieve the desired balance, for if there is only one meal per tree, one can unfairly and unrealistically make plenty within mere minutes.
Next comes the fix.
On line 127 in 'init.lua' there is a predicate to test whether we can actually grow the tree. Inside, the procedure that grows the tree is evaluated and the bonemeal:on_use procedure returns true. That's so bad!
I fixed it and it should resemble this (but that's not all to it):
-- check if we can grow sapling at current light level
if can_grow and (light_ok or saplings[n][4] == true) then
particle_effect(pos)
if math.random (5 - strength) == 1 then
grow_tree(pos, saplings[n][2])
end
return true
end
What I did is I added an extra predicate inside the very procedure that's called every time a bonemeal is used and the sapling is checked for validity: a random number generator, contrary to the one that evaluates the check_sapling procedure outside.
-- check for sapling growth
if check_sapling(pos, node.name, light_ok, strength) then
return true
end
On line 479, remove the "and", also erasing the extra random number generator, which, as you could have seen, has been moved inside check_sapling.
Don't forget to modify check_sampling and the procedure call so that it accepts an extra "strength" argument, which is needed for 'math.random (5 - strength)'.
I love this mod: it allows for so much expressive space on our minetest farms and in great communal kolkhozes. However, when one attemps to grow a tree, it takes multiple attempts, during which nothing happens and the fertilizer isn't spent, and only once the random number generator strikes a '1' it generates particles and erects the tree from the sapling. This just begs the fix.
I suppose it should spend the bonemeal in the meantime: that would just achieve the desired balance, for if there is only one meal per tree, one can unfairly and unrealistically make plenty within mere minutes.
Next comes the fix.
On line 127 in 'init.lua' there is a predicate to test whether we can actually grow the tree. Inside, the procedure that grows the tree is evaluated and the bonemeal:on_use procedure returns true. That's so bad!
I fixed it and it should resemble this (but that's not all to it):
What I did is I added an extra predicate inside the very procedure that's called every time a bonemeal is used and the sapling is checked for validity: a random number generator, contrary to the one that evaluates the check_sapling procedure outside.
On line 479, remove the "and", also erasing the extra random number generator, which, as you could have seen, has been moved inside check_sapling.
Don't forget to modify check_sampling and the procedure call so that it accepts an extra "strength" argument, which is needed for 'math.random (5 - strength)'.
Happy hacking.
I did prefer it this way when it used a bonemeal item every sapling chance, growing or not :)