Shara wrote:Hi Fixer, I think it's simply because no one (to the best of my knowledge) did this with node timers yet. It's very likely I will try and get this added to MTG if no one finds any bugs I can't fix.
I think it needs a slight improvement with regard to configuration. The regrow timer will certainly need to be adapted to the duration of the day and other parameters. As an extreme example, I have hacked MTG's default so that trees grow in one or two IRL days.
Also, for having played with something similar for some time, I think one might want to make the regrowth unreliable, so that trees with four apples don't become "food fountains"; you still have to manage your trees and cut down trees that don't give apples anymore (for games that have a resource management focus).
I think those choices depend heavily on the population size: single player, small server or 24/7 crowded server.
So I suggest something like this:
Code: Select all
local get_apple_timer=function(pos)
-- this function defines how long it takes to grow an apple
-- if it returns 0, the apple won't regrow.
-- the position is passed to the function so that additional environment
-- checks can be performed
return math.random(4800, 9600)
end
and then in after_dig_node():
Code: Select all
local t=get_apple_timer(pos)
if t>0 then minetest.get_node_timer(pos):start(t) end
A question: why do you re-register the apple node rather than using override_item()?
PS: yep, still no Github account...