dreambuilder_game/function_delayer
VanessaE e124b79ada update castles, cool_trees, plantlife, basic_materials, bees, bonemeal,
homedecor, currency, digilines, farming redo, item_drop, maptools,
mesecons, moreblocks, moreores, moretrees, pipeworks, signs_lib,
stained_glass, technic, titanium, unified_inventory, unifieddyes,and
worldedit.

added Tenplus1's ambience mod
2020-11-01 13:02:30 -05:00
..
.luacheckrc update castles, cool_trees, plantlife, basic_materials, bees, bonemeal, 2020-11-01 13:02:30 -05:00
LICENSE.txt Added HybridDog's function delayer mod 2020-05-31 23:27:33 -04:00
README.md Added HybridDog's function delayer mod 2020-05-31 23:27:33 -04:00
depends.txt Added HybridDog's function delayer mod 2020-05-31 23:27:33 -04:00
init.lua Added HybridDog's function delayer mod 2020-05-31 23:27:33 -04: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)