mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-18 18:40:49 +00:00
cooldown: cache parent frame to scoped variable
This commit is contained in:
@@ -6,22 +6,17 @@ pfUI:RegisterModule("cooldown", "vanilla:tbc", function ()
|
|||||||
local hourcolor = {strsplit(",", C.appearance.cd.hourcolor)}
|
local hourcolor = {strsplit(",", C.appearance.cd.hourcolor)}
|
||||||
local daycolor = {strsplit(",", C.appearance.cd.daycolor)}
|
local daycolor = {strsplit(",", C.appearance.cd.daycolor)}
|
||||||
|
|
||||||
|
local parent
|
||||||
local function pfCooldownOnUpdate()
|
local function pfCooldownOnUpdate()
|
||||||
if not this:GetParent() then this:Hide() end
|
parent = this:GetParent()
|
||||||
|
if not parent then this:Hide() end
|
||||||
-- avoid to set cooldowns on invalid frames
|
|
||||||
if this:GetParent() and this:GetParent():GetName() and _G[this:GetParent():GetName() .. "Cooldown"] then
|
|
||||||
if not _G[this:GetParent():GetName() .. "Cooldown"]:IsShown() then
|
|
||||||
this:Hide()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if not this.next then this.next = GetTime() + .1 end
|
if not this.next then this.next = GetTime() + .1 end
|
||||||
if this.next > GetTime() then return end
|
if this.next > GetTime() then return end
|
||||||
this.next = GetTime() + .1
|
this.next = GetTime() + .1
|
||||||
|
|
||||||
-- fix own alpha value (should be inherited, but somehow isn't always)
|
-- fix own alpha value (should be inherited, but somehow isn't always)
|
||||||
this:SetAlpha(this:GetParent():GetAlpha())
|
this:SetAlpha(parent:GetAlpha())
|
||||||
|
|
||||||
local remaining = this.duration - (GetTime() - this.start)
|
local remaining = this.duration - (GetTime() - this.start)
|
||||||
if remaining >= 0 then
|
if remaining >= 0 then
|
||||||
|
|||||||
Reference in New Issue
Block a user