1687 {
1691 if (
Unit* passenger = vehicle->GetPassenger(3))
1692 {
1693
1694 std::list<WorldObject*> targetList;
1698 float minDist = 99 * 99;
1699 Unit* target =
nullptr;
1700 for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
1701 {
1704 if (
Vehicle* seat = unit->GetVehicleKit())
1705 if (!seat->GetPassenger(0))
1706 if (
Unit* device = seat->GetPassenger(2))
1708 {
1710 if (dist < minDist)
1711 {
1712 minDist = dist;
1713 target = unit;
1714 }
1715 }
1716 }
1718 {
1720 passenger->EnterVehicle(target, 0);
1721 }
1722 else
1723 {
1724 passenger->ExitVehicle();
1725 float x, y, z;
1727 passenger->GetMotionMaster()->MoveJump(x, y, z, targets.
GetSpeedXY(), targets.
GetSpeedZ());
1728 }
1729 }
1730 }
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:992
@ TARGET_CHECK_DEFAULT
Definition: SpellInfo.h:114
@ NPC_SEAT
Definition: boss_flame_leviathan.cpp:83
@ EFFECT_0
Definition: SharedDefines.h:30
Unit * ToUnit()
Definition: Object.h:200
bool IsWithinDist2d(float x, float y, float dist) const
Definition: Object.cpp:1305
void GetPosition(float &x, float &y) const
Definition: Position.h:122
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:170
void ExitVehicle(Position const *exitPosition=nullptr)
Definition: Unit.cpp:19976
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:207
Definition: GridNotifiers.h:236
float GetSpeedZ() const
Definition: Spell.h:175
float GetSpeedXY() const
Definition: Spell.h:174
WorldLocation const * GetDstPos() const
Definition: Spell.cpp:395
SpellCastTargets m_targets
Definition: Spell.h:527
WorldLocation const * GetExplTargetDest()
Definition: SpellScript.cpp:416
SpellInfo const * GetSpellInfo()
Definition: SpellScript.cpp:411
Spell * GetSpell()
Definition: SpellScript.h:442
Unit * GetCaster()
Definition: SpellScript.cpp:401