View Single Post
01-11-16, 03:40 PM   #7
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by SDPhantom View Post
On a side note, you can use @player and @vehicle to specify the target of the condition rather than the old target= syntax. This option was implemented as a more intuitive way to define the target of a condition since people were trying to use the old syntax for checking if your target was a specified unit.
My current handler works fine i only have a small issue.
When the player have a pet summoned and have a pet frame, then i switch the pet frame to the player frame when the UNIT_ENTERED_VEHICLE gets triggeted with a vehicle ui.
However sometimes from UNIT_ENTERING_VEHICLE to UNIT_ENTERED_VEHICLE and from UNIT_EXITING_VEHICLE to UNIT_EXITED_VEHICLE, the pet frame instead of showing the player or the pet shows the vehicle frame for a second for no reason. I'm not sure how to dodge that securely.

I wrote a workaround to unregisted and reregister the pet frame between this events, but thats not gonna work in combat:

Lua Code:
  1. function PlayerPet:UNIT_ENTERING_VEHICLE(unit, showVehicleUI, arg3, vehicleType, vehicleID, arg6, vehicleGUID, arg8, arg9)
  2.     if showVehicleUI then
  3.         if not InCombatLockdown() then
  4.             UnregisterUnitWatch(self.frame)
  5.             self.frame:Hide()
  6.         end
  7.         self.frame.unit = "player"
  8.         self:UpdateDisplay()
  9.     end
  10. end
  11.  
  12. function PlayerPet:UNIT_ENTERED_VEHICLE(unit, showVehicleUI, arg3, vehicleType, vehicleID, arg6, vehicleGUID, arg8, arg9)
  13.     if showVehicleUI then
  14.         if not InCombatLockdown() then
  15.             RegisterUnitWatch(self.frame)
  16.         end
  17.         self.frame.unit = "player"
  18.         self:UpdateDisplay()
  19.     end
  20. end
  21.  
  22. function PlayerPet:UNIT_EXITING_VEHICLE()
  23.     if self.frame.unit ~= "pet" then
  24.         if not InCombatLockdown() then
  25.             UnregisterUnitWatch(self.frame)
  26.             self.frame:Hide()
  27.         end
  28.         self.frame.unit = "pet"
  29.         self:UpdateDisplay()
  30.     end
  31. end
  32.  
  33. function PlayerPet:UNIT_EXITED_VEHICLE()
  34.     --if self.frame.unit ~= "pet" then
  35.         --self.frame:Show()
  36.         if not InCombatLockdown() then
  37.             RegisterUnitWatch(self.frame)
  38.         end
  39.         --self.frame.unit = "pet"
  40.         self:UpdateDisplay()
  41.     --end
  42. end
  Reply With Quote