dreambuilder_game/mods/function_delayer
VanessaE 4394beec6a Convert the modpack into a standalone game for the Minetest engine
Integrated into the game is most of minetest_game as the stable base
2021-02-24 22:05:32 -05:00
..
.luacheckrc Convert the modpack into a standalone game for the Minetest engine 2021-02-24 22:05:32 -05:00
LICENSE.txt Convert the modpack into a standalone game for the Minetest engine 2021-02-24 22:05:32 -05:00
README.md Convert the modpack into a standalone game for the Minetest engine 2021-02-24 22:05:32 -05:00
depends.txt Convert the modpack into a standalone game for the Minetest engine 2021-02-24 22:05:32 -05:00
init.lua Convert the modpack into a standalone game for the Minetest engine 2021-02-24 22:05:32 -05:00

README.md

allows executing functions after a delay to reduce possible lag (EDD scheduler?)

minetest.after executes the function after a specific time (and not exactly if it's lagging (dtime can be long))
and minetest.delay_function executes the function after a specific time only if it's lagging, the function can be and is usually executed earlier.

If you e.g. want to grow 1000 big trees you can
either place them all at once and need to wait long until you can play again
or you can use minetest.delay_function to let the trees grow in globalsteps with time limit. e.g. growing of a couple of trees is not allowed to take more than 1s but all trees have to been grown after a specific time

Do not use make minetest.delay_function constantly call itself instead of using globalstep or minetest.after because
it would call itself immediately very often in a loop, so without pauses.

TODO:
— add minetest.add_task where nice level can be set
— ensure if get_us_time really is faster (https://forum.minetest.net/viewtopic.php?p=214962#p214962)