yzelast wrote:hi guys,i have a few questions about node timers.
If a timer end in an unloaded mapblock what will happen with the code inside the on_timer function?
And how i do to make a node timer stop decreasing on night, and return to decrease on day?
If i could pause the timers at night my
trees mod will benefits a lot,making the growing more precise.
You can't dynamically put code in `on_timer()`, it has to be known at init time, so the code is always known no matter what.
The default trees in the game use node timers and if the timer elapses during the night, the growth is attempted again and again every 2 minutes or so until light levels are in order.
Postponing a node timer is possible, but not on unloaded blocks, so you need to do this in the `on_timer()` function.
If a node timer expires while the block is unloaded, the node timer code for that node is run as soon as the block is loaded. Unlike ABM's, nodetimers are never skipped.
Making a node timer stop decreasing at night is pretty much not possible, not reliably anyway. You're better off finding an algorithm that works for you that doesn't require that type of mechanism.