diff --git a/script.lua b/script.lua index 17eaadd..fa74f11 100644 --- a/script.lua +++ b/script.lua @@ -96,6 +96,23 @@ end function onDamage(amount, source) end +-- Timer (not mine lol) -- +do + local timers = {} + function wait(ticks,next) + table.insert(timers, {t=world.getTime()+ticks,n=next}) + end + function tick() + for key,timer in pairs(timers) do + if world.getTime() >= timer.t then + timer.n() + table.remove(timers,key) + end + end + end +end + + -- Tick function -- function tick() -- expression reset spaghetti code --