refactor(Core/Movement): Drop IsWaitingForLastMove throttle

This commit is contained in:
bash 2026-05-30 21:07:36 +02:00
parent d85d0aabbc
commit 2f00af0352
6 changed files with 2 additions and 51 deletions

View File

@ -95,9 +95,8 @@ bool FollowAction::Execute(Event /*event*/)
bool const movingAllowed = IsMovingAllowed(); bool const movingAllowed = IsMovingAllowed();
bool const dupMove = IsDuplicateMove(destX, destY, destZ); bool const dupMove = IsDuplicateMove(destX, destY, destZ);
bool const waiting = IsWaitingForLastMove(priority);
if (movingAllowed && !dupMove && !waiting) if (movingAllowed && !dupMove)
{ {
if (bot->IsSitState()) if (bot->IsSitState())
bot->SetStandState(UNIT_STAND_STATE_STAND); bot->SetStandState(UNIT_STAND_STATE_STAND);

View File

@ -215,9 +215,6 @@ bool MovementAction::JumpTo(uint32 mapId, float x, float y, float z, MovementPri
if (IsDuplicateMove(x, y, z)) if (IsDuplicateMove(x, y, z))
return false; return false;
if (IsWaitingForLastMove(priority))
return false;
float speed = bot->GetSpeed(MOVE_RUN); float speed = bot->GetSpeed(MOVE_RUN);
MotionMaster& mm = *bot->GetMotionMaster(); MotionMaster& mm = *bot->GetMotionMaster();
mm.Clear(); mm.Clear();
@ -325,10 +322,6 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
{ {
return false; return false;
} }
if (IsWaitingForLastMove(priority))
{
return false;
}
bool generatePath = !bot->IsFlying() && !bot->isSwimming(); bool generatePath = !bot->IsFlying() && !bot->isSwimming();
bool disableMoveSplinePath = bool disableMoveSplinePath =
@ -1053,27 +1046,6 @@ bool MovementAction::IsDuplicateMove(float x, float y, float z)
return true; return true;
} }
bool MovementAction::IsWaitingForLastMove(MovementPriority priority)
{
LastMovement& lastMove = *context->GetValue<LastMovement&>("last movement");
if (priority > lastMove.priority)
return false;
// Stale delay bypass: if the bot has actually stopped moving (spline
// finalized + no movement flags), the delay is meaningless — common
// after combat ends with MOVEMENT_COMBAT priority still recorded,
// which would otherwise silently gate every non-combat MoveFarTo /
// MoveRandomNear request until the leftover delay expires.
if (bot->movespline->Finalized() && !bot->isMoving())
return false;
if (lastMove.lastdelayTime + lastMove.msTime > getMSTime())
return true;
return false;
}
bool MovementAction::IsMovingAllowed() bool MovementAction::IsMovingAllowed()
{ {
return botAI->CanMove(); return botAI->CanMove();

View File

@ -72,7 +72,6 @@ protected:
void SetNextMovementDelay(float delayMillis); void SetNextMovementDelay(float delayMillis);
bool IsMovingAllowed(WorldObject* target); bool IsMovingAllowed(WorldObject* target);
bool IsDuplicateMove(float x, float y, float z); bool IsDuplicateMove(float x, float y, float z);
bool IsWaitingForLastMove(MovementPriority priority);
bool IsMovingAllowed(); bool IsMovingAllowed();
bool Flee(Unit* target); bool Flee(Unit* target);
void ClearIdleState(); void ClearIdleState();

View File

@ -1462,15 +1462,6 @@ bool HodirBitingColdJumpAction::Execute(Event /*event*/)
// float speed = 7.96f; // float speed = 7.96f;
// UpdateMovementState(); // UpdateMovementState();
// if (!IsMovingAllowed(mapId, x, y, z))
//{
// return false;
// }
// MovementPriority priority;
// if (IsWaitingForLastMove(priority))
//{
// return false;
// }
// MotionMaster& mm = *bot->GetMotionMaster(); // MotionMaster& mm = *bot->GetMotionMaster();
// mm.Clear(); // mm.Clear();

View File

@ -50,10 +50,6 @@ bool NewRpgBaseAction::MoveFarTo(WorldPosition dest)
if (dest == WorldPosition()) if (dest == WorldPosition())
return false; return false;
// performance optimization
if (IsWaitingForLastMove(MovementPriority::MOVEMENT_NORMAL))
return false;
// Already-at-dest short-stop. Below targetPosRecalcDistance the // Already-at-dest short-stop. Below targetPosRecalcDistance the
// move is effectively done — stop any active spline and clear // move is effectively done — stop any active spline and clear
// the cached path if it pointed here, so we don't keep gliding. // the cached path if it pointed here, so we don't keep gliding.
@ -473,9 +469,6 @@ bool NewRpgBaseAction::MoveWorldObjectTo(ObjectGuid guid, float distance)
bool NewRpgBaseAction::MoveRandomNear(float moveStep, MovementPriority priority, WorldObject* center) bool NewRpgBaseAction::MoveRandomNear(float moveStep, MovementPriority priority, WorldObject* center)
{ {
if (IsWaitingForLastMove(priority))
return false;
float const distance = (0.4f + rand_norm() * 0.6f) * moveStep; float const distance = (0.4f + rand_norm() * 0.6f) * moveStep;
float const angle = (float)rand_norm() * 2 * static_cast<float>(M_PI); float const angle = (float)rand_norm() * 2 * static_cast<float>(M_PI);
float const dx = bot->GetPositionX() + distance * cos(angle); float const dx = bot->GetPositionX() + distance * cos(angle);

View File

@ -9,7 +9,7 @@ bool NewRpgOutdoorPvpAction::Execute(Event event)
botAI->rpgInfo.ChangeToIdle(); botAI->rpgInfo.ChangeToIdle();
return false; return false;
} }
if (IsWaitingForLastMove(MovementPriority::MOVEMENT_NORMAL) || !bot->IsOutdoorPvPActive()) if (!bot->IsOutdoorPvPActive())
return false; return false;
uint32 zoneId = bot->GetZoneId(); uint32 zoneId = bot->GetZoneId();
@ -113,9 +113,6 @@ OPvPCapturePoint* NewRpgOutdoorPvpAction::SelectNewObjective(OutdoorPvP::OPvPCap
bool NewRpgOutdoorPvpAction::PatrolCapturePoint(GameObject* objectiveGO, float radius) bool NewRpgOutdoorPvpAction::PatrolCapturePoint(GameObject* objectiveGO, float radius)
{ {
if (IsWaitingForLastMove(MovementPriority::MOVEMENT_NORMAL))
return false;
// Randomly pause at the current spot before picking a new patrol point // Randomly pause at the current spot before picking a new patrol point
if (urand(0, 2) == 0) if (urand(0, 2) == 0)
return ForceToWait(urand(3000, 6000)); return ForceToWait(urand(3000, 6000));