Core/Movement: add optional velocity argument for MoveLand and MoveTakeoff (PR #25516)

This commit is contained in:
Ovah
2020-10-01 02:50:45 +02:00
committed by GitHub
parent 0152878de5
commit 31abdc6ecf
2 changed files with 9 additions and 5 deletions

View File

@@ -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<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(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<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(AnimationTier::Hover);
if (velocity)
init.SetVelocity(*velocity);
Add(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id));
}

View File

@@ -168,8 +168,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);
void MoveCharge(PathGenerator const& path, float speed = SPEED_CHARGE);
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ);