diff options
author | Ovah <dreadkiller@gmx.de> | 2020-10-01 02:50:45 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-02-28 14:08:22 +0100 |
commit | eeac4a12f244e7f730f772b4093cc5089dfc6a0c (patch) | |
tree | 4c9363ef4c80bd44f210d1316dc194578353b3a7 | |
parent | 76a2332e37946505cef933674feeeac20fed6374 (diff) |
Core/Movement: add optional velocity argument for MoveLand and MoveTakeoff (PR #25516)
(cherry picked from commit 31abdc6ecfd84ef019880ffb531bf0298f921e77)
-rw-r--r-- | src/server/game/Movement/MotionMaster.cpp | 10 | ||||
-rw-r--r-- | src/server/game/Movement/MotionMaster.h | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 24d81b84e1d..2cb243cc847 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -672,23 +672,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<float> 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(AnimTier::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<float> 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(AnimTier::Hover); + if (velocity) + init.SetVelocity(*velocity); Add(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id)); } diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 830d6ca8628..b86e643f588 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -169,8 +169,8 @@ 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 MoveTakeoff(uint32 id, Position const& pos); + void MoveLand(uint32 id, Position const& pos, Optional<float> velocity = {}); + void MoveTakeoff(uint32 id, Position const& pos, Optional<float> velocity = {}); void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE, bool generatePath = false, Unit const* target = nullptr, Movement::SpellEffectExtraData const* spellEffectExtraData = nullptr); void MoveCharge(PathGenerator const& path, float speed = SPEED_CHARGE, Unit const* target = nullptr, Movement::SpellEffectExtraData const* spellEffectExtraData = nullptr); void MoveKnockbackFrom(Position const& origin, float speedXY, float speedZ, Movement::SpellEffectExtraData const* spellEffectExtraData = nullptr); |