From 53060a39f5755a2b4446c3e855deba89dc552ca9 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Mon, 1 Jun 2020 21:48:30 +0200 Subject: [PATCH] Core/Movement: implement optional velocity argument to MoveLand motion master helper --- src/server/game/Movement/MotionMaster.cpp | 4 +++- src/server/game/Movement/MotionMaster.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index eebafb70e7e..692adad0353 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -338,7 +338,7 @@ 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 /*= nullptr*/) { 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()); @@ -347,6 +347,8 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos) init.SetSmooth(); init.SetFly(); init.SetAnimation(Movement::ToGround); + if (velocity) + init.SetVelocity(velocity.get()); Mutate(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id), MOTION_SLOT_ACTIVE); } diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index bd3c2dcb4fe..38cbdb64c35 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -168,7 +168,7 @@ class TC_GAME_API MotionMaster void MoveCloserAndStop(uint32 id, Unit* target, float distance); // These two movement types should only be used with creatures having landing/takeoff animations - void MoveLand(uint32 id, Position const& pos); + void MoveLand(uint32 id, Position const& pos, Optional velocity = nullptr); void MoveTakeoff(uint32 id, Position const& pos); void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE, bool generatePath = false);