-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnodetimer.lua
41 lines (34 loc) · 1.24 KB
/
nodetimer.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---@meta
---NodeTimerRef
---------------
-- Node Timers: a high resolution persistent per-node timer. Can be gotten via
-- `minetest.get_node_timer(pos)`.
---@class mt.NodeTimerRef
local NodeTimerRef
-- - Set a timer's state.
-- - Will trigger the node's `on_timer` function after `(timeout - elapsed)`
-- seconds.
---@param timeout number is in seconds, and supports fractional values (0.1 etc)
---@param elapsed number is in seconds, and supports fractional values (0.1 etc)
function NodeTimerRef:set(timeout, elapsed) end
-- - Start a timer.
-- - Equivalent to `set(timeout, 0)`.
---@param timeout number is in seconds, and supports fractional values (0.1 etc)
function NodeTimerRef:start(timeout) end
-- Stops the timer.
function NodeTimerRef:stop() end
-- Returns current timeout in seconds.
--
-- - If `timeout` equals `0`, timer is inactive.
---@return number
function NodeTimerRef:get_timeout() end
-- Returns current elapsed time in seconds.
--
-- - The node's `on_timer` function will be called after `(timeout - elapsed)` seconds.
---@return number
function NodeTimerRef:get_elapsed() end
-- Returns boolean state of timer.
--
-- - Returns `true` if timer is started, otherwise `false`.
---@return boolean
function NodeTimerRef:is_started() end