From 769be195f94be6b7e1b2ce72dbe2a7280bcda49e Mon Sep 17 00:00:00 2001 From: nurdle <50721698+nurd3@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:12:35 -0400 Subject: [PATCH] mobkit.timer: Add support for floats --- init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 3a8773e..43ceb5c 100644 --- a/init.lua +++ b/init.lua @@ -518,10 +518,10 @@ function mobkit.drive_to_pos(self,tpos,speed,turn_rate,dist) return false end -function mobkit.timer(self,s) -- returns true approx every s seconds - local t1 = floor(self.time_total) - local t2 = floor(self.time_total+self.dtime) - if t2>t1 and t2%s==0 then return true end +function mobkit.timer(self,s) -- returns true approx every interval + local t1 = floor(self.time_total/s) + local t2 = floor((self.time_total+self.dtime)/s) + if t2>t1 then return true end end -- Memory functions.