1689 {
1693 if (
Unit* passenger = vehicle->GetPassenger(3))
1694 {
1695
1696 std::list<WorldObject*> targetList;
1700 float minDist = 99 * 99;
1701 Unit* target =
nullptr;
1702 for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
1703 {
1706 if (
Vehicle* seat = unit->GetVehicleKit())
1707 if (!seat->GetPassenger(0))
1708 if (
Unit* device = seat->GetPassenger(2))
1710 {
1712 if (dist < minDist)
1713 {
1714 minDist = dist;
1715 target = unit;
1716 }
1717 }
1718 }
1720 {
1722 passenger->EnterVehicle(target, 0);
1723 }
1724 else
1725 {
1726 passenger->ExitVehicle();
1727 float x, y, z;
1729 passenger->GetMotionMaster()->MoveJump(x, y, z, targets.
GetSpeedXY(), targets.
GetSpeedZ());
1730 }
1731 }
1732 }
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:992
@ TARGET_CHECK_DEFAULT
Definition: SpellInfo.h:114
@ NPC_SEAT
Definition: boss_flame_leviathan.cpp:85
@ EFFECT_0
Definition: SharedDefines.h:31
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:19992
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:400
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