Skip to content

Commit

Permalink
hook clear
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuller committed Nov 19, 2024
1 parent dce874f commit 9c4f626
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion OmniCC/core/cooldown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ function Cooldown:SetTimer(start, duration, modRate)
if modRate == nil then
modRate = 1
end

-- both the wow api and addons (espcially auras) have a habit of resetting
-- cooldowns every time there's an update to an aura
-- we chack and do nothing if there's an exact start/duration match
Expand Down Expand Up @@ -487,6 +487,17 @@ function Cooldown:OnVisibilityUpdated()
Cooldown.RequestUpdate(self)
end

---@param self OmniCCCooldown
function Cooldown:OnClear()
if self._occ_start ~= nil then
self._occ_start = nil
self._occ_duration = nil
self._occ_modRate = nil

Cooldown.HideText(self)
end
end

---@param self OmniCCCooldown
function Cooldown:UpdateSettings(force)
local newSettings = Cooldown.GetTheme(self)
Expand Down Expand Up @@ -525,6 +536,7 @@ function Cooldown.SetupHooks()

hooksecurefunc(cooldown_mt, 'SetCooldown', Cooldown.OnSetCooldown)
hooksecurefunc(cooldown_mt, 'SetCooldownDuration', Cooldown.OnSetCooldownDuration)
hooksecurefunc(cooldown_mt, 'Clear', Cooldown.OnClear)
hooksecurefunc('CooldownFrame_SetDisplayAsPercentage', Cooldown.SetDisplayAsPercentage)
end

Expand Down

0 comments on commit 9c4f626

Please sign in to comment.