From cfebb9f5af27b831a3938b5c656b5fb945a2da39 Mon Sep 17 00:00:00 2001 From: Parnic Date: Wed, 12 Aug 2009 07:26:34 +0000 Subject: [PATCH] - maybe fix some vehicle issues in ulduar --- IceHUD.lua | 14 ++++++++++++++ modules/CastBar.lua | 6 +++--- modules/PlayerHealth.lua | 6 +++--- modules/PlayerMana.lua | 6 +++--- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/IceHUD.lua b/IceHUD.lua index 36d8bd3..6d43ce2 100644 --- a/IceHUD.lua +++ b/IceHUD.lua @@ -851,3 +851,17 @@ function IceHUD:Clamp(value, min, max) return value end + +function IceHUD:ShouldSwapToVehicle(...) + local arg1, arg2 = ... + + if (arg1 == "player") then + if (arg2) then + return true + end + end + + if (UnitHasVehicleUI("player")) then + return true + end +end diff --git a/modules/CastBar.lua b/modules/CastBar.lua index ea7ca6e..93f14a5 100644 --- a/modules/CastBar.lua +++ b/modules/CastBar.lua @@ -309,8 +309,8 @@ function CastBar.prototype:Enable(core) end -function CastBar.prototype:EnteringVehicle(unit) - if (unit == "player") then +function CastBar.prototype:EnteringVehicle(unit, arg2) + if (self.unit == "player" and IceHUD:ShouldSwapToVehicle(unit, arg2)) then self.unit = "vehicle" self:Update(self.unit) end @@ -318,7 +318,7 @@ end function CastBar.prototype:ExitingVehicle(unit) - if (unit == "player") then + if (unit == "player" and self.unit == "vehicle") then self.unit = "player" self:Update(self.unit) end diff --git a/modules/PlayerHealth.lua b/modules/PlayerHealth.lua index 6d9af75..ed9212d 100644 --- a/modules/PlayerHealth.lua +++ b/modules/PlayerHealth.lua @@ -673,8 +673,8 @@ function PlayerHealth.prototype:GetOptions() end -function PlayerHealth.prototype:EnteringVehicle(unit) - if (unit == "player") then +function PlayerHealth.prototype:EnteringVehicle(unit, arg2) + if (self.unit == "player" and IceHUD:ShouldSwapToVehicle(unit, arg2)) then self.unit = "vehicle" self:RegisterFontStrings() self:Update(self.unit) @@ -683,7 +683,7 @@ end function PlayerHealth.prototype:ExitingVehicle(unit) - if (unit == "player") then + if (unit == "player" and self.unit == "vehicle") then self.unit = "player" self:RegisterFontStrings() self:Update(self.unit) diff --git a/modules/PlayerMana.lua b/modules/PlayerMana.lua index 4940f66..c9a9727 100644 --- a/modules/PlayerMana.lua +++ b/modules/PlayerMana.lua @@ -142,8 +142,8 @@ function PlayerMana.prototype:SetupOnUpdate(enable) end -function PlayerMana.prototype:EnteringVehicle(unit) - if (unit == "player") then +function PlayerMana.prototype:EnteringVehicle(unit, arg2) + if (self.unit == "player" and IceHUD:ShouldSwapToVehicle(unit, arg2)) then self.unit = "vehicle" self:RegisterFontStrings() self:Update(self.unit) @@ -152,7 +152,7 @@ end function PlayerMana.prototype:ExitingVehicle(unit) - if (unit == "player") then + if (unit == "player" and self.unit == "vehicle") then self.unit = "player" self:RegisterFontStrings() self:Update(self.unit)