diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 448e8cba0..3aee9721e 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -462,7 +462,7 @@ void MotionMaster::MoveSplinePath(Movement::PointsArray* path) } } -void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed) +void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed /* = 0.0f*/) { // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) @@ -477,19 +477,24 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed) Movement::MoveSplineInit init(_owner); init.MoveTo(x, y, z); - init.SetVelocity(speed); + + if (speed > 0.0f) + { + init.SetVelocity(speed); + } + init.SetAnimation(Movement::ToGround); init.Launch(); Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE); } -void MotionMaster::MoveLand(uint32 id, float x, float y, float z, float speed) +void MotionMaster::MoveLand(uint32 id, float x, float y, float z, float speed /* = 0.0f*/) { Position pos = {x, y, z, 0.0f}; MoveLand(id, pos, speed); } -void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed) +void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed /* = 0.0f*/) { // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) @@ -504,13 +509,18 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed) Movement::MoveSplineInit init(_owner); init.MoveTo(x, y, z); - init.SetVelocity(speed); + + if (speed > 0.0f) + { + init.SetVelocity(speed); + } + init.SetAnimation(Movement::ToFly); init.Launch(); Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE); } -void MotionMaster::MoveTakeoff(uint32 id, float x, float y, float z, float speed) +void MotionMaster::MoveTakeoff(uint32 id, float x, float y, float z, float speed /* = 0.0f*/) { Position pos = {x, y, z, 0.0f}; MoveTakeoff(id, pos, speed); diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 33b0d2cad..7baabcb51 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -202,10 +202,10 @@ public: void MoveSplinePath(Movement::PointsArray* path); // These two movement types should only be used with creatures having landing/takeoff animations - void MoveLand(uint32 id, Position const& pos, float speed); - void MoveLand(uint32 id, float x, float y, float z, float speed); // pussywizard: added for easy calling by passing 3 floats x, y, z - void MoveTakeoff(uint32 id, Position const& pos, float speed); - void MoveTakeoff(uint32 id, float x, float y, float z, float speed); // pussywizard: added for easy calling by passing 3 floats x, y, z + void MoveLand(uint32 id, Position const& pos, float speed = 0.0f); + void MoveLand(uint32 id, float x, float y, float z, float speed = 0.0f); // pussywizard: added for easy calling by passing 3 floats x, y, z + void MoveTakeoff(uint32 id, Position const& pos, float speed = 0.0f); + void MoveTakeoff(uint32 id, float x, float y, float z, float speed = 0.0f); // pussywizard: added for easy calling by passing 3 floats x, y, z void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE, const Movement::PointsArray* path = nullptr, bool generatePath = false, float orientation = 0.0f); void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ);