mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
fix(Core/Unit): rework Walk/Run mode (#22988)
Co-authored-by: sudlud <sudlud@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -387,6 +387,7 @@ void MotionMaster::MoveBackwards(Unit* target, float dist)
|
||||
|
||||
Movement::MoveSplineInit init(_owner);
|
||||
init.MoveTo(point.x, point.y, point.z, false);
|
||||
init.SetWalk(true);
|
||||
init.SetFacing(target);
|
||||
init.SetOrientationInversed();
|
||||
init.Launch();
|
||||
@@ -469,7 +470,7 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo
|
||||
*
|
||||
* For transition movement between the ground and the air, use MoveLand or MoveTakeoff instead.
|
||||
*/
|
||||
void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generatePath, bool forceDestination, MovementSlot slot, float orientation /* = 0.0f*/)
|
||||
void MotionMaster::MovePoint(uint32 id, float x, float y, float z, ForcedMovement forcedMovement, float speed, float orientation, bool generatePath, bool forceDestination, MovementSlot slot)
|
||||
{
|
||||
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
|
||||
return;
|
||||
@@ -477,16 +478,16 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate
|
||||
if (_owner->IsPlayer())
|
||||
{
|
||||
LOG_DEBUG("movement.motionmaster", "Player ({}) targeted point (Id: {} X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), id, x, y, z);
|
||||
Mutate(new PointMovementGenerator<Player>(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot);
|
||||
Mutate(new PointMovementGenerator<Player>(id, x, y, z, forcedMovement, speed, orientation, nullptr, generatePath, forceDestination), slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("movement.motionmaster", "Creature ({}) targeted point (ID: {} X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), id, x, y, z);
|
||||
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot);
|
||||
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, forcedMovement, speed, orientation, nullptr, generatePath, forceDestination), slot);
|
||||
}
|
||||
}
|
||||
|
||||
void MotionMaster::MoveSplinePath(Movement::PointsArray* path)
|
||||
void MotionMaster::MoveSplinePath(Movement::PointsArray* path, ForcedMovement forcedMovement)
|
||||
{
|
||||
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
|
||||
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
|
||||
@@ -494,15 +495,15 @@ void MotionMaster::MoveSplinePath(Movement::PointsArray* path)
|
||||
|
||||
if (_owner->IsPlayer())
|
||||
{
|
||||
Mutate(new EscortMovementGenerator<Player>(path), MOTION_SLOT_ACTIVE);
|
||||
Mutate(new EscortMovementGenerator<Player>(forcedMovement, path), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mutate(new EscortMovementGenerator<Creature>(path), MOTION_SLOT_ACTIVE);
|
||||
Mutate(new EscortMovementGenerator<Creature>(forcedMovement, path), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
void MotionMaster::MoveSplinePath(uint32 path_id)
|
||||
void MotionMaster::MoveSplinePath(uint32 path_id, ForcedMovement forcedMovement)
|
||||
{
|
||||
// convert the path id to a Movement::PointsArray*
|
||||
Movement::PointsArray* points = new Movement::PointsArray();
|
||||
@@ -514,7 +515,7 @@ void MotionMaster::MoveSplinePath(uint32 path_id)
|
||||
}
|
||||
|
||||
// pass the new PointsArray* to the appropriate MoveSplinePath function
|
||||
MoveSplinePath(points);
|
||||
MoveSplinePath(points, forcedMovement);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -539,8 +540,8 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed /* = 0.0
|
||||
}
|
||||
|
||||
init.SetAnimation(Movement::ToGround);
|
||||
init.Launch();
|
||||
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
|
||||
|
||||
Mutate(new EffectMovementGenerator(init, id), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -569,16 +570,12 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed /* =
|
||||
init.MoveTo(x, y, z);
|
||||
|
||||
if (speed > 0.0f)
|
||||
{
|
||||
init.SetVelocity(speed);
|
||||
}
|
||||
|
||||
if (!skipAnimation)
|
||||
{
|
||||
init.SetAnimation(Movement::ToFly);
|
||||
}
|
||||
init.Launch();
|
||||
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
|
||||
|
||||
Mutate(new EffectMovementGenerator(init, id), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -612,8 +609,8 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa
|
||||
init.SetParabolic(max_height, 0);
|
||||
init.SetOrientationFixed(true);
|
||||
init.SetVelocity(speedXY);
|
||||
init.Launch();
|
||||
Mutate(new EffectMovementGenerator(0), MOTION_SLOT_CONTROLLED);
|
||||
|
||||
Mutate(new EffectMovementGenerator(init, 0), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -652,8 +649,8 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee
|
||||
init.SetVelocity(speedXY);
|
||||
if (target)
|
||||
init.SetFacing(target);
|
||||
init.Launch();
|
||||
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
|
||||
|
||||
Mutate(new EffectMovementGenerator(init, id), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -695,8 +692,8 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC)
|
||||
Movement::MoveSplineInit init(_owner);
|
||||
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz + _owner->GetHoverHeight());
|
||||
init.SetFall();
|
||||
init.Launch();
|
||||
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
|
||||
|
||||
Mutate(new EffectMovementGenerator(init, id), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -713,12 +710,12 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id,
|
||||
if (_owner->IsPlayer())
|
||||
{
|
||||
LOG_DEBUG("movement.motionmaster", "Player ({}) charge point (X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), x, y, z);
|
||||
Mutate(new PointMovementGenerator<Player>(id, x, y, z, speed, orientation, path, generatePath, generatePath, targetGUID), MOTION_SLOT_CONTROLLED);
|
||||
Mutate(new PointMovementGenerator<Player>(id, x, y, z, FORCED_MOVEMENT_NONE, speed, orientation, path, generatePath, generatePath, targetGUID), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("movement.motionmaster", "Creature ({}) charge point (X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), x, y, z);
|
||||
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, speed, orientation, path, generatePath, generatePath, targetGUID), MOTION_SLOT_CONTROLLED);
|
||||
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, FORCED_MOVEMENT_NONE, speed, orientation, path, generatePath, generatePath, targetGUID), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user