mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- fixed pet health/mana modules getting stuck on the player when leaving an instance while on a vehicle
This commit is contained in:
@ -62,6 +62,7 @@ function PetHealth.prototype:Enable(core)
|
||||
|
||||
self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle")
|
||||
self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle")
|
||||
self:RegisterEvent("PLAYER_ENTERING_WORLD", "CheckVehicle")
|
||||
|
||||
self.frame:SetAttribute("unit", self.unit)
|
||||
RegisterUnitWatch(self.frame)
|
||||
@ -227,21 +228,33 @@ function PetHealth.prototype:EnableClickTargeting(bEnable)
|
||||
end
|
||||
|
||||
function PetHealth.prototype:EnteringVehicle(event, unit, arg2)
|
||||
if (self.unit == "pet" and IceHUD:ShouldSwapToVehicle(unit, arg2)) then
|
||||
self.unit = "player"
|
||||
self:RegisterFontStrings()
|
||||
if (self.unit == "pet") then
|
||||
if IceHUD:ShouldSwapToVehicle(unit, arg2) then
|
||||
self.unit = "player"
|
||||
self:RegisterFontStrings()
|
||||
end
|
||||
self:Update(self.unit)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function PetHealth.prototype:ExitingVehicle(event, unit)
|
||||
if (unit == "player" and self.unit == "player") then
|
||||
self.unit = "pet"
|
||||
self:RegisterFontStrings()
|
||||
if (unit == "player") then
|
||||
if self.unit == "player" then
|
||||
self.unit = "pet"
|
||||
self:RegisterFontStrings()
|
||||
end
|
||||
self:Update(self.unit)
|
||||
end
|
||||
end
|
||||
|
||||
function PetHealth.prototype:CheckVehicle()
|
||||
if UnitHasVehicleUI("player") then
|
||||
self:EnteringVehicle(nil, "player", true)
|
||||
else
|
||||
self:ExitingVehicle(nil, "player")
|
||||
end
|
||||
end
|
||||
|
||||
-- Load us up
|
||||
IceHUD.PetHealth = PetHealth:new()
|
||||
|
Reference in New Issue
Block a user