Fix custom bar update errors

I was tracking updates with two separate variables depending on where
the registration happened. The order that updates ran in was not
reliable, so sometimes one would register and sometimes the other would.
Since only one of them was setting itself as "from update", the behavior
internal to the bar was also inconsistent.
This commit is contained in:
Parnic
2021-06-26 14:13:44 -05:00
parent 209fbe2b4e
commit 90f126d7a0

View File

@ -19,6 +19,7 @@ IceCustomBar.prototype.bIsAura = false
function IceCustomBar.prototype:init()
IceCustomBar.super.prototype.init(self, "MyCustomBar", "player")
self.textColorOverride = true
self.CustomBarUpdateFunc = function() self:UpdateCustomBar(self.unit, true) end
end
-- 'Public' methods -----------------------------------------------------------
@ -107,11 +108,7 @@ end
function IceCustomBar.prototype:ConditionalSubscribe()
if self:ShouldAlwaysSubscribe() then
if not IceHUD.IceCore:IsUpdateSubscribed(self) then
if not self.CustomBarUpdateFunc then
self.CustomBarUpdateFunc = function() self:UpdateCustomBar() end
end
if not IceHUD.IceCore:IsUpdateSubscribed(self, self.CustomBarUpdateFunc) then
self.handlesOwnUpdates = true
IceHUD.IceCore:RequestUpdates(self, self.CustomBarUpdateFunc)
end
@ -795,13 +792,9 @@ function IceCustomBar.prototype:UpdateCustomBar(unit, fromUpdate)
self.auraBuffCount = self.auraBuffCount or 0
if self.auraEndTime ~= nil and (self.auraEndTime == 0 or self.auraEndTime >= now) and (not self.moduleSettings.minCount or self.auraBuffCount >= self.moduleSettings.minCount) then
if not self:ShouldAlwaysSubscribe() and not fromUpdate and not IceHUD.IceCore:IsUpdateSubscribed(self) then
if not self.UpdateCustomBarFunc then
self.UpdateCustomBarFunc = function() self:UpdateCustomBar(self.unit, true) end
end
if not self:ShouldAlwaysSubscribe() and not fromUpdate and not IceHUD.IceCore:IsUpdateSubscribed(self, self.CustomBarUpdateFunc) then
self.handlesOwnUpdates = true
IceHUD.IceCore:RequestUpdates(self, self.UpdateCustomBarFunc)
IceHUD.IceCore:RequestUpdates(self, self.CustomBarUpdateFunc)
end
self:Show(true)