From 57febb76833f117dc1d5ccedb4a823076f9f5c77 Mon Sep 17 00:00:00 2001 From: bash Date: Fri, 8 May 2026 22:58:15 +0200 Subject: [PATCH] fix(Core/Movement): Force replan when dest shifts >40y from cached spline endpoint --- src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp b/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp index 374ec1359..8644188a4 100644 --- a/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp +++ b/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp @@ -73,7 +73,16 @@ bool NewRpgBaseAction::MoveFarTo(WorldPosition dest) if (bot->isMoving() && lastMove.lastMoveToMapId == bot->GetMapId()) { float remaining = bot->GetExactDist(lastMove.lastMoveToX, lastMove.lastMoveToY, lastMove.lastMoveToZ); - if (remaining > 10.0f) + // Only ride the existing spline if the cached endpoint is + // still close to the requested dest. A dest shift > 40y is + // a target change (objective POI -> turn-in NPC, new POI + // selection, …) and needs a fresh travelplan/mmap probe; + // otherwise the bot rides a stale spline straight through + // geometry. + float endpointToDest = dest.distance(WorldPosition( + lastMove.lastMoveToMapId, lastMove.lastMoveToX, + lastMove.lastMoveToY, lastMove.lastMoveToZ)); + if (remaining > 10.0f && endpointToDest <= 40.0f) { EmitDebugMove("MoveFar", "spline-plan", lastMove.lastMoveToX, lastMove.lastMoveToY, lastMove.lastMoveToZ);