Permalink
Browse files

retarded attempt to synchronize unit attr updates

  • Loading branch information...
1 parent 0a0989e commit e2ab28d81bfed43d4eb6d4bdc4de21ce85a175e1 @d87 d87 committed Oct 14, 2011
Showing with 32 additions and 6 deletions.
  1. +31 −5 Aptechka.lua
  2. +1 −1 config.lua
View
@@ -677,12 +677,37 @@ function Aptechka.Colorize(self, event, unit)
end
end
+local UnitUpdateQueue = {}
+local UnitUpdateBusy = false
--UnitButton initialization
local OnAttributeChanged = function(self, attrname, unit)
if attrname ~= "unit" then return end
- local name = unit and UnitName(unit)
+ -- if self:GetAttribute("unit") == unit then return end
+ if UnitUpdateBusy then
+ -- print("queueing", self:GetName(), unit)
+ table.insert(UnitUpdateQueue, {self, unit})
+ Aptechka.UnitUpdate()
+ else
+ Aptechka.UnitUpdate(self, unit)
+ end
+ -- local name = unit and UnitName(unit)
-- print(self:GetName(), "AttrChanged", attrname, unit, name)
- --DEFAULT_CHAT_FRAME:AddMessage(string.format("OnAttributeChanged>>> %s = %s",attrname,unit or ""),1,0.4,0.4)
+ UPD = UnitUpdateQueue
+ ROSTER = Roster
+ -- DEFAULT_CHAT_FRAME:AddMessage(string.format("OnAttributeChanged>>> %s = %s",attrname,unit or ""),1,0.4,0.4)
+end
+
+function Aptechka.UnitUpdate(self, unit)
+ if not self then
+ if not UnitUpdateQueue[1] then
+ UnitUpdateBusy = false
+ return
+ end
+ self, unit = unpack(table.remove(UnitUpdateQueue,1))
+ end
+
+ UnitUpdateBusy = true
+
local owner = unit
if self.InVehicle and unit == self.unitOwner then
unit = self.unit
@@ -698,8 +723,7 @@ local OnAttributeChanged = function(self, attrname, unit)
end
for unit, frames in pairs(Roster) do
- --self:GetAttribute("unit")
- if frames[self] and ( self.unit ~= unit or (self.InVehicle and self.unitOwner ~= unit) ) then
+ if frames[self] and ( self:GetAttribute("unit") ~= unit or (self.InVehicle and self.unitOwner ~= unit) ) then
-- print ("Removing frame", self:GetName(), self:GetAttribute("unit"))
frames[self] = nil
end
@@ -739,6 +763,8 @@ local OnAttributeChanged = function(self, attrname, unit)
if UnitHasVehicleUI(owner) then Aptechka:UNIT_ENTERED_VEHICLE(nil,owner) end -- scary
Aptechka:CheckLFDTank(unit)
if config.enableIncomingHeals then Aptechka:UNIT_HEAL_PREDICTION(nil,unit) end
+
+ return Aptechka.UnitUpdate()
end
@@ -817,7 +843,7 @@ function Aptechka.CreateHeader(self,group,petgroup)
end
function Aptechka.CreateAnchor(self,hdr,num)
- local f = CreateFrame("Frame",nil,UIParent)
+ local f = CreateFrame("Frame","NugRaidAnchor"..num,UIParent)
f:SetHeight(20)
f:SetWidth(20)
View
@@ -75,7 +75,7 @@ config.HealthBarColor = { name = "HealthBar", assignto = { "health" }, color = {
config.PowerBarColor = { name = "PowerBar", assignto = { "power" }, color = {.5,.5,1}, priority = 20 }
config.OutOfRangeStatus = { name = "OOR", assignto = { "self" }, color = {0.5,0.5,0.5}, alpha = 0.3, text = "OOR", priority = 50 }
config.InVehicleStatus = { name = "InVehicle", assignto = { "border" }, color = {0.3,1,0.3}, priority = 21 }
-config.LOSStatus = { name = "OutOfSight", assignto = { "spell2" }, color = {1,0.1,0.1}, priority = 95, fade = 1.0 }
+config.LOSStatus = { name = "OutOfSight", assignto = { "spell2", "dispel" }, color = {1,0.1,0.1}, priority = 95, fade = 1.0 }
-- default priority is 80

0 comments on commit e2ab28d

Please sign in to comment.