1662 {
1666 if (
Unit* passenger = vehicle->GetPassenger(3))
1667 {
1668
1669 std::list<WorldObject*> targetList;
1673 float minDist = 99 * 99;
1674 Unit* target =
nullptr;
1675 for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
1676 {
1679 if (
Vehicle* seat = unit->GetVehicleKit())
1680 if (!seat->GetPassenger(0))
1681 if (
Unit* device = seat->GetPassenger(2))
1683 {
1685 if (dist < minDist)
1686 {
1687 minDist = dist;
1688 target = unit;
1689 }
1690 }
1691 }
1693 {
1695 passenger->EnterVehicle(target, 0);
1696 }
1697 else
1698 {
1699 passenger->ExitVehicle();
1700 float x, y, z;
1702 passenger->GetMotionMaster()->MoveJump(x, y, z, targets.
GetSpeedXY(), targets.
GetSpeedZ());
1703 }
1704 }
1705 }
@ NPC_SEAT
Definition: boss_flame_leviathan.cpp:91
@ EFFECT_0
Definition: SharedDefines.h:31
@ TARGET_CHECK_DEFAULT
Definition: SpellInfo.h:114
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:539
Unit * ToUnit()
Definition: Object.h:209
bool IsWithinDist2d(float x, float y, float dist) const
Definition: Object.cpp:1316
void GetPosition(float &x, float &y) const
Definition: Position.h:121
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:169
void ExitVehicle(Position const *exitPosition=nullptr)
Definition: Unit.cpp:19735
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:206
Definition: GridNotifiers.h:239
float GetSpeedZ() const
Definition: Spell.h:177
float GetSpeedXY() const
Definition: Spell.h:176
WorldLocation const * GetDstPos() const
Definition: Spell.cpp:401
SpellCastTargets m_targets
Definition: Spell.h:530
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