mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
fix(Core/Travel): Drop stale TravelPlan when destination shifts
This commit is contained in:
parent
7b60310c4e
commit
de64d9780c
@ -163,9 +163,19 @@ 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.
|
// If a node plan is already active, ride it — but only if its
|
||||||
|
// destination still matches the requested dest. Otherwise the
|
||||||
|
// old plan (e.g. built toward a quest objective POI) would keep
|
||||||
|
// driving the bot after the caller switched targets (e.g. to a
|
||||||
|
// turn-in NPC). cmangos's ResolveMovePath dodges this by being
|
||||||
|
// stateless; we have a long-lived plan flag, so check explicitly.
|
||||||
if (tryNodes && botAI->rpgInfo.HasActiveTravelPlan())
|
if (tryNodes && botAI->rpgInfo.HasActiveTravelPlan())
|
||||||
return UpdateTravelPlan();
|
{
|
||||||
|
if (botAI->rpgInfo.travelPlan.destination.distance(dest) > 10.0f)
|
||||||
|
botAI->rpgInfo.ClearTravel();
|
||||||
|
else
|
||||||
|
return UpdateTravelPlan();
|
||||||
|
}
|
||||||
|
|
||||||
// PRIORITY: try the travel-node graph FIRST when the move is
|
// PRIORITY: try the travel-node graph FIRST when the move is
|
||||||
// long enough to need it.
|
// long enough to need it.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user