Skip to content

Commit

Permalink
explicit tostring
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuller committed Nov 19, 2024
1 parent 9c4f626 commit 4f08bb6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions OmniCC/core/timer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Timer:GetOrCreate(cooldown)
local endTime = (cooldown._occ_start + cooldown._occ_duration) * SECOND
local kind = cooldown._occ_kind
local settings = cooldown._occ_settings
local key = strjoin('/', endTime, kind, tostring(settings or 'NONE'))
local key = strjoin('/', kind, tostring(endTime), tostring(settings or 'NONE'))

local timer = active[key]
if not timer then
Expand Down Expand Up @@ -91,17 +91,16 @@ function Timer:Destroy()
inactive[self] = true
end

---@param key string?
function Timer:Update(key)
if self.key ~= key then return end

local remain = self.endTime - (GetTime() * SECOND)
if remain <= 0 then
if self.key then
self:Destroy()
end
self:Destroy()
return
end

local text, textSleep = self:GetTimerText(remain)
if self.text ~= text then
self.text = text
Expand Down Expand Up @@ -150,7 +149,7 @@ end

-- Calculates timer text
---@param remain number -- The remaining time on the timer, in miliseconds
---@return stringView? -- The formatted text for the time remaining
---@return string? -- The formatted text for the time remaining
---@return number -- How long, in miliseconds, until the the next text update
function Timer:GetTimerText(remain)
if remain <= 0 then
Expand Down

0 comments on commit 4f08bb6

Please sign in to comment.