Compare commits
2 Commits
92b4b99083
...
083d8319eb
Author | SHA1 | Date | |
---|---|---|---|
083d8319eb | |||
bf1b2d4f7c |
@ -207,10 +207,9 @@ function sharedstate.commit()
|
|||||||
-- }
|
-- }
|
||||||
-- send_queue[key]=t
|
-- send_queue[key]=t
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
|
|
||||||
pings.sharedstate_unpack(state_queue)
|
pings.sharedstate_recv_table(state_queue)
|
||||||
state_queue={}
|
sharedstate.clear()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Clear a value from the shared state queue
|
--- Clear a value from the shared state queue
|
||||||
|
10
timers.lua
10
timers.lua
@ -4,6 +4,10 @@
|
|||||||
timers={}
|
timers={}
|
||||||
do
|
do
|
||||||
local timers = {}
|
local timers = {}
|
||||||
|
--- Wait
|
||||||
|
--Wait a certain number of ticks and execute a function.
|
||||||
|
---@param ticks integer Number of ticks to wait
|
||||||
|
---@param next function Callback to run
|
||||||
function wait(ticks,next)
|
function wait(ticks,next)
|
||||||
table.insert(timers, {t=world.getTime()+ticks,n=next})
|
table.insert(timers, {t=world.getTime()+ticks,n=next})
|
||||||
end
|
end
|
||||||
@ -24,6 +28,12 @@ timers.wait=wait
|
|||||||
-- if timer is armed twice before expiring it will only be called once) --
|
-- if timer is armed twice before expiring it will only be called once) --
|
||||||
do
|
do
|
||||||
local timers = {}
|
local timers = {}
|
||||||
|
--- Wait
|
||||||
|
--Wait a certain number of ticks and execute a function. Store the timer with a name so that
|
||||||
|
--it can be overwritten.
|
||||||
|
---@param ticks integer Number of ticks to wait
|
||||||
|
---@param next function Callback to run
|
||||||
|
---@param name function Name of callback
|
||||||
function namedWait(ticks, next, name)
|
function namedWait(ticks, next, name)
|
||||||
-- main difference, this will overwrite an existing timer with
|
-- main difference, this will overwrite an existing timer with
|
||||||
-- the same name
|
-- the same name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user