From 31abdc6ecfd84ef019880ffb531bf0298f921e77 Mon Sep 17 00:00:00 2001 From: Ovah Date: Thu, 1 Oct 2020 02:50:45 +0200 Subject: Core/Movement: add optional velocity argument for MoveLand and MoveTakeoff (PR #25516) --- src/server/game/Movement/MotionMaster.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/server/game/Movement/MotionMaster.cpp') diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 5299421c0a0..2a45220a2a7 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -671,23 +671,27 @@ void MotionMaster::MoveCloserAndStop(uint32 id, Unit* target, float distance) } } -void MotionMaster::MoveLand(uint32 id, Position const& pos) +void MotionMaster::MoveLand(uint32 id, Position const& pos, Optional velocity /*= {}*/) { TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveLand: '%s', landing point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); Movement::MoveSplineInit init(_owner); init.MoveTo(PositionToVector3(pos), false); init.SetAnimation(AnimationTier::Ground); + if (velocity) + init.SetVelocity(*velocity); Add(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id)); } -void MotionMaster::MoveTakeoff(uint32 id, Position const& pos) +void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, Optional velocity /*= {}*/) { TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTakeoff: '%s', landing point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); Movement::MoveSplineInit init(_owner); - init.MoveTo(PositionToVector3(pos)); + init.MoveTo(PositionToVector3(pos), false); init.SetAnimation(AnimationTier::Hover); + if (velocity) + init.SetVelocity(*velocity); Add(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id)); } -- cgit v1.2.3