Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Commit

Permalink
[action_timers] Convert globalstep to minetest.after for #179
Browse files Browse the repository at this point in the history
  • Loading branch information
Lymkwi committed Aug 3, 2016
1 parent 66c5582 commit f3001af
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mods/action_timers/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit f3001af

Please sign in to comment.