- frame:RegisterUnitEvent("INCOMING_RESURRECT_CHANGED", frame.unit, displayed);
-end
-local registerEvents = M.RegisterEvents;
-
-local function updateHealth(frame, unit)
- local current, max = UnitHealth(unit), frame.health.max;
- frame.health:Show();
- -- sanity check, occasionally UnitHealthMax gives zero
- if current > max then
- -- somehow current health has gone over the maximum (missed maxhealth event)
- frame.health.max = UnitHealthMax(unit);
- max = frame.health.max;
- if current > max then
- -- error state, still over maximum
- frame.health:SetWidth(width);
- return;
- end
- elseif max > 0 then
- frame.health:SetWidth(current/frame.health.max*width);
- else
- frame.health:SetWidth(width);
- return;
- end
-
- if UnitIsDeadOrGhost(unit) then
- frame.health:Hide();
- end
+ frame:RegisterUnitEvent("PLAYER_FLAGS_CHANGED", frame.unit, displayed);
+ frame:RegisterUnitEvent("READY_CHECK_CONFIRM", frame.unit, displayed);
+ frame:RegisterUnitEvent("UNIT_ENTERED_VEHICLE", frame.unit, displayed);
+ frame:RegisterUnitEvent("UNIT_EXITED_VEHICLE", frame.unit, displayed);
+ frame:RegisterUnitEvent("UNIT_PET", frame.unit, displayed);