NodeTimerRef

From Minetest Developer Wiki
Jump to navigation Jump to search
Mbox warning.png This page contains unofficial Lua API documentation and is likely to be outdated or wrong.
For the official and up-to-date documentation, refer to lua_api.txt found in your Minetest installation directory under doc.
Mbox warning.png This page has been proposed for deletion for the following reason: "Contains unofficial and potentially outdated, redundant and inconsistent Lua API information"
If you don't think that this page should be deleted, please explain why on the talk page.

A high resolution persistent per-node timer. Can be gotten via <source enclose="none">minetest.get_node_timer(pos)</source>

Methods

  • <source enclose="none">set(timeout, elapsed)</source> — set a timer's state. timeout, elapsed are in seconds, and supports fractional values (0.1 etc). Will trigger the node's on_timer function after timeout - elapsed seconds.
  • <source enclose="none">start(timeout)</source> — start a timer, equivalent to <source enclose="none">set(timeout, 0)</source>
  • <source enclose="none">stop()</source> — stops the timer
  • <source enclose="none">get_timeout()</source> — current timeout in seconds, if timeout is 0, timer is inactive
  • <source enclose="none">get_elapsed()</source> — current elapsed time in seconds
  • <source enclose="none">is_started()</source> — boolean state of timer, returns <source enclose="none">true</source> if timer is started, otherwise <source enclose="none">false</source>