Commit f191ed91 authored by NihilisticPandemonium's avatar NihilisticPandemonium Committed by NihilisticPandemonium

Also ensure the unit matches before starting playback.


(cherry picked from commit c6038272)
parent b20a6666
......@@ -44,6 +44,7 @@ local function Health_PreUpdate(self, unit)
end
element.cur = self.cur
element.unit = unit
element:SetValue(element.cur)
element:SetMinMaxValues(0, UnitHealthMax(unit))
element.ready = true
......@@ -51,7 +52,7 @@ end
local function Health_PostUpdate(self, unit, curHealth, maxHealth)
local element = self.__owner.Cutaway.Health
if (not element.ready or not element.cur or not curHealth or not maxHealth) or element.playing then
if (not element.ready or not element.cur or not curHealth or not maxHealth) or element.playing or element.unit ~= unit then
return
end
......@@ -82,6 +83,7 @@ local function Power_PreUpdate(self, unit)
end
element.cur = self.cur
element.unit = unit
element:SetValue(element.cur)
element:SetMinMaxValues(0, UnitPowerMax(unit))
element.ready = true
......@@ -89,7 +91,7 @@ end
local function Power_PostUpdate(self, unit, curPower, maxPower)
local element = self.__owner.Cutaway.Power
if (not element.ready or not element.cur or not curPower or not maxPower) or element.playing then
if (not element.ready or not element.cur or not curPower or not maxPower) or element.playing or element.unit ~= unit then
return
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment