1366 {
1370 if (
Unit* passenger = vehicle->GetPassenger(3))
1371 {
1372
1373 std::list<WorldObject*> targetList;
1377 float minDist = 99 * 99;
1378 Unit* target =
nullptr;
1379 for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
1380 {
1383 if (
Vehicle* seat = unit->GetVehicleKit())
1384 if (!seat->GetPassenger(0))
1385 if (
Unit* device = seat->GetPassenger(2))
1387 {
1389 if (dist < minDist)
1390 {
1391 minDist = dist;
1392 target = unit;
1393 }
1394 }
1395 }
1397 {
1399 passenger->EnterVehicle(target, 0);
1400 }
1401 else
1402 {
1403 passenger->ExitVehicle();
1404 float x, y, z;
1406 passenger->GetMotionMaster()->MoveJump(x, y, z, targets.
GetSpeedXY(), targets.
GetSpeedZ());
1407 }
1408 }
1409 }
@ EFFECT_0
Definition SharedDefines.h:31
@ TARGET_CHECK_DEFAULT
Definition SpellInfo.h:115
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:557
@ NPC_SEAT
Definition boss_flame_leviathan.cpp:92
Unit * ToUnit()
Definition Object.h:210
float GetSpeedZ() const
Definition Spell.h:187
float GetSpeedXY() const
Definition Spell.h:186
WorldLocation const * GetDstPos() const
Definition Spell.cpp:400
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
SpellCastTargets m_targets
Definition Spell.h:542
void ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:15674
bool IsWithinDist2d(float x, float y, float dist) const
Definition Object.cpp:1355
Definition GridNotifiers.h:230
static void VisitObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:165
void GetPosition(float &x, float &y) const
Definition Position.h:126
float GetExactDistSq(float x, float y, float z) const
Definition Position.h:174