mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-03-13 16:10:25 +01:00
[action_timers] Convert globalstep to minetest.after for #179
This commit is contained in:
parent
66c55825e8
commit
f3001afa7b
@ -48,14 +48,15 @@ function action_timers.api.get_timer(name)
|
||||
return action_timers.timers[name]
|
||||
end
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
local function step()
|
||||
for name, _ in pairs(action_timers.timers) do
|
||||
action_timers.timers[name] = action_timers.timers[name] - dtime
|
||||
if action_timers.timers[name] < 0 then
|
||||
action_timers.timers[name] = 0
|
||||
if (action_timers.timers[name] > 0) then
|
||||
action_timers.timers[name] = action_timers.timers[name] - 1
|
||||
end
|
||||
end
|
||||
end)
|
||||
minetest.after(1, step)
|
||||
end
|
||||
minetest.after(0, step)
|
||||
|
||||
minetest.log("action", "[ACTimers] Loaded")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user