From f3001afa7b37931fed479e024fcd306d6b6d2a32 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Wed, 3 Aug 2016 18:48:31 +0200 Subject: [PATCH] [action_timers] Convert globalstep to minetest.after for #179 --- mods/action_timers/init.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mods/action_timers/init.lua b/mods/action_timers/init.lua index 276fd56f..7268e3e5 100755 --- a/mods/action_timers/init.lua +++ b/mods/action_timers/init.lua @@ -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")