NodeTimerRef - Uberi/MineTest-API GitHub Wiki

NodeTimerRef

Description

Reference to a high resolution persistent per-node timer.

Can be obtained using minetest.env:get_node_timer(pos).

Syntax

set(timeout,elapsed)
^ set a timer's state
^ timeout is in seconds, and supports fractional values (0.1 etc)
^ elapsed is in seconds, and supports fractional values (0.1 etc)
^ will trigger the node's on_timer function after timeout-elapsed seconds
  • start(timeout) ^ start a timer ^ equivelent to set(timeout,0)
  • stop() ^ stops the timer
  • get_timeout() -> current timeout in seconds ^ if timeout is 0, timer is inactive
  • get_elapsed() -> current elapsed time in seconds ^ the node's on_timer function will be called after timeout-elapsed seconds
  • is_started() -> boolean state of timer ^ returns true if timer is started, otherwise false
⚠️ **GitHub.com Fallback** ⚠️