From cd50276d35b62402c3032a3cdc6ec25c7d13e70e Mon Sep 17 00:00:00 2001 From: Parnic Date: Wed, 22 Sep 2010 00:15:35 +0000 Subject: [PATCH] - minor fixes to enabling a module and how updates are handled that should allow custom modules to react appropriately when they are enabled while a player has the buff they're monitoring --- IceCore.lua | 16 ++++++++-------- modules/CustomCDBar.lua | 2 +- modules/CustomCount.lua | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/IceCore.lua b/IceCore.lua index 254b0e7..df2a369 100644 --- a/IceCore.lua +++ b/IceCore.lua @@ -667,19 +667,19 @@ function IceCore.prototype:SetUpdatePeriod(period) end -- For elements that want to receive updates even when hidden -function IceCore.HandleUpdates() - local update_period = IceHUD.IceCore:UpdatePeriod() +function IceCore.prototype:HandleUpdates() + local update_period = self:UpdatePeriod() local elapsed = 1 / GetFramerate() - IceCore.prototype.update_elapsed = IceCore.prototype.update_elapsed + elapsed - if (IceCore.prototype.update_elapsed > update_period) then - for frame, func in pairs(IceCore.prototype.updatees) + self.update_elapsed = self.update_elapsed + elapsed + if (self.update_elapsed > update_period) then + for frame, func in pairs(self.updatees) do func() end if (elapsed > update_period) then - IceCore.prototype.update_elapsed = 0 + self.update_elapsed = 0 else - IceCore.prototype.update_elapsed = IceCore.prototype.update_elapsed - update_period + self.update_elapsed = self.update_elapsed - update_period end end end @@ -695,7 +695,7 @@ function IceCore.prototype:RequestUpdates(frame, func) if (count == 0) then self.IceHUDFrame:SetScript("OnUpdate", nil) else - self.IceHUDFrame:SetScript("OnUpdate", IceCore.HandleUpdates) + self.IceHUDFrame:SetScript("OnUpdate", function() self:HandleUpdates() end) end end diff --git a/modules/CustomCDBar.lua b/modules/CustomCDBar.lua index 3388ee8..0f03df9 100644 --- a/modules/CustomCDBar.lua +++ b/modules/CustomCDBar.lua @@ -32,9 +32,9 @@ function IceCustomCDBar.prototype:Enable(core) self.moduleSettings.auraIconScale = 1 end + self:EnableUpdates(false) self:UpdateCustomBar() self:UpdateIcon() - self:EnableUpdates(false) if self.moduleSettings.auraIconXOffset == nil then self.moduleSettings.auraIconXOffset = 40 diff --git a/modules/CustomCount.lua b/modules/CustomCount.lua index c7b3c37..233fe7a 100644 --- a/modules/CustomCount.lua +++ b/modules/CustomCount.lua @@ -388,6 +388,7 @@ function IceCustomCount.prototype:Enable(core) self.unit = self.moduleSettings.auraTarget self:CreateCustomFrame(true) + self:UpdateCustomCount() end