![]() So far, both newly-created saplings and saplings with bad growth conditions are covered, but there's one more rather subtle case left uncovered: saplings which were created before the change to timer-based growth were made. In this case cant_grow is a bool which, obviously, has been set based on whether or not the tree can grow. Minetest.get_node_timer(pos):start(math.random(240, 600)) In that case the timer would be deactivated and the tree would never grow even if conditions changed this meant that it was necessary to also reset the timer in the generate_tree function (again, using the values from the default trees): There's a caveat, though: suppose that the on_timer function is called but the tree doesn't grow because it's too dark out or some other reason. This meant that trees would then grow after 40 to 80 minutes (2400 to 4800 seconds, respectively), making growth generally much longer than the previous duration but also normalizing the growth rate. If it doesn't grow, it waits the same amount of time again before again having the same chance to grow, ad infinitum. The idea is pretty simple: after a certain amount of time has passed then the tree has a chance to grow. ![]() ![]() The first thing I learned was that the mod's trees were using something called an Active Block Modifier (ABM) in order to trigger their growth. Note, however, that I wrote the mod against the v0.4.16 version while v5.0.0 (v0.5.0 and company were skipped) is the latest at the time of this posting, so some information may be slightly dated. The growth asymmetry bothered me, so I decided to study and modify the code so that the mod would match the default game. The trees in the default game, however, seemed to grow at a steady rate. Immediately after being harvested and re-planted, one of the saplings has already grown into a tree. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |