mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
Add MoveKnockbackFromForPlayer
This commit is contained in:
@@ -833,6 +833,30 @@ void MotionMaster::MoveRotate(uint32 time, RotateDirection direction)
|
|||||||
Mutate(new RotateMovementGenerator(time, direction), MOTION_SLOT_ACTIVE);
|
Mutate(new RotateMovementGenerator(time, direction), MOTION_SLOT_ACTIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOD_PLAYERBOTS
|
||||||
|
void MotionMaster::MoveKnockbackFromForPlayer(float srcX, float srcY, float speedXY, float speedZ)
|
||||||
|
{
|
||||||
|
if (speedXY <= 0.1f)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Position dest = _owner->GetPosition();
|
||||||
|
float moveTimeHalf = speedZ / Movement::gravity;
|
||||||
|
float dist = 2 * moveTimeHalf * speedXY;
|
||||||
|
float max_height = -Movement::computeFallElevation(moveTimeHalf, false, -speedZ);
|
||||||
|
|
||||||
|
// Use a mmap raycast to get a valid destination.
|
||||||
|
_owner->MovePositionToFirstCollision(dest, dist, _owner->GetRelativeAngle(srcX, srcY) + float(M_PI));
|
||||||
|
|
||||||
|
Movement::MoveSplineInit init(_owner);
|
||||||
|
init.MoveTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ());
|
||||||
|
init.SetParabolic(max_height, 0);
|
||||||
|
init.SetOrientationFixed(true);
|
||||||
|
init.SetVelocity(speedXY);
|
||||||
|
init.Launch();
|
||||||
|
Mutate(new EffectMovementGenerator(0), MOTION_SLOT_CONTROLLED);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void MotionMaster::propagateSpeedChange()
|
void MotionMaster::propagateSpeedChange()
|
||||||
{
|
{
|
||||||
/*Impl::container_type::iterator it = Impl::c.begin();
|
/*Impl::container_type::iterator it = Impl::c.begin();
|
||||||
|
|||||||
@@ -235,7 +235,9 @@ public:
|
|||||||
void MoveDistract(uint32 time);
|
void MoveDistract(uint32 time);
|
||||||
void MovePath(uint32 path_id, bool repeatable);
|
void MovePath(uint32 path_id, bool repeatable);
|
||||||
void MoveRotate(uint32 time, RotateDirection direction);
|
void MoveRotate(uint32 time, RotateDirection direction);
|
||||||
|
#ifdef MOD_PLAYERBOTS
|
||||||
|
void MoveKnockbackFromForPlayer(float srcX, float srcY, float speedXY, float speedZ);
|
||||||
|
#endif
|
||||||
[[nodiscard]] MovementGeneratorType GetCurrentMovementGeneratorType() const;
|
[[nodiscard]] MovementGeneratorType GetCurrentMovementGeneratorType() const;
|
||||||
[[nodiscard]] MovementGeneratorType GetMotionSlotType(int slot) const;
|
[[nodiscard]] MovementGeneratorType GetMotionSlotType(int slot) const;
|
||||||
[[nodiscard]] uint32 GetCurrentSplineId() const; // Xinef: Escort system
|
[[nodiscard]] uint32 GetCurrentSplineId() const; // Xinef: Escort system
|
||||||
|
|||||||
Reference in New Issue
Block a user