[action_timers] Convert globalstep to minetest.after for #179

This commit is contained in:
LeMagnesium 2016-08-03 18:48:31 +02:00
parent 66c55825e8
commit f3001afa7b
No known key found for this signature in database
GPG Key ID: A54DDB5272C51E8B
1 changed files with 6 additions and 5 deletions

View File

@ -48,14 +48,15 @@ function action_timers.api.get_timer(name)
return action_timers.timers[name] return action_timers.timers[name]
end end
minetest.register_globalstep(function(dtime) local function step()
for name, _ in pairs(action_timers.timers) do for name, _ in pairs(action_timers.timers) do
action_timers.timers[name] = action_timers.timers[name] - dtime if (action_timers.timers[name] > 0) then
if action_timers.timers[name] < 0 then action_timers.timers[name] = action_timers.timers[name] - 1
action_timers.timers[name] = 0
end end
end end
end) minetest.after(1, step)
end
minetest.after(0, step)
minetest.log("action", "[ACTimers] Loaded") minetest.log("action", "[ACTimers] Loaded")