fix(Core/Travel): Ride active node plan to completion across threshold

This commit is contained in:
bash 2026-05-16 16:41:23 +02:00
parent b8adda0a90
commit 9f3a8a49f8

View File

@ -163,13 +163,12 @@ bool NewRpgBaseAction::MoveFarTo(WorldPosition dest)
// waypoint spline at dest. // waypoint spline at dest.
bool tryNodes = (dis >= nodeFirstDis && sPlayerbotAIConfig.enableTravelNodes); bool tryNodes = (dis >= nodeFirstDis && sPlayerbotAIConfig.enableTravelNodes);
// If a node plan is already active, ride it — but only if its // Ride an active plan to completion as long as its destination
// destination still matches the requested dest. Otherwise the // still matches. Remaining distance can drop below nodeFirstDis
// old plan (e.g. built toward a quest objective POI) would keep // mid-route (e.g. crossing a zone border near the target); killing
// driving the bot after the caller switched targets (e.g. to a // the plan here would replace remaining waypoints with raw mmap
// turn-in NPC). cmangos's ResolveMovePath dodges this by being // and often produce a u-turn. Clear only on dest change.
// stateless; we have a long-lived plan flag, so check explicitly. if (botAI->rpgInfo.HasActiveTravelPlan())
if (tryNodes && botAI->rpgInfo.HasActiveTravelPlan())
{ {
if (botAI->rpgInfo.travelPlan.destination.distance(dest) > 10.0f) if (botAI->rpgInfo.travelPlan.destination.distance(dest) > 10.0f)
botAI->rpgInfo.ClearTravel(); botAI->rpgInfo.ClearTravel();
@ -192,11 +191,6 @@ bool NewRpgBaseAction::MoveFarTo(WorldPosition dest)
} }
// Graph returned no plan — fall through to mmap probe. // Graph returned no plan — fall through to mmap probe.
} }
else if (botAI->rpgInfo.HasActiveTravelPlan())
{
// Move dropped below node-first threshold — drop any leftover plan.
botAI->rpgInfo.ClearTravel();
}
// 40-step chained mmap probe — fallback when the node graph // 40-step chained mmap probe — fallback when the node graph
// returned no plan (or for short moves below nodeFirstDis). // returned no plan (or for short moves below nodeFirstDis).