mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
fix(Core/RPG): Per-tick re-resolve travel plan instead of advancing cached plan
This commit is contained in:
parent
558e9ee1e1
commit
8cb54416bf
@ -146,20 +146,20 @@ bool NewRpgBaseAction::MoveFarTo(WorldPosition dest)
|
|||||||
((bot->GetMapId() != dest.GetMapId()) ||
|
((bot->GetMapId() != dest.GetMapId()) ||
|
||||||
(dis > sPlayerbotAIConfig.sightDistance));
|
(dis > sPlayerbotAIConfig.sightDistance));
|
||||||
|
|
||||||
// Ride the active node plan only if its dest still matches.
|
// Per-tick re-resolve (cmangos pattern). Rebuild the travel plan
|
||||||
// A stale plan would steer the bot past a new target.
|
// from the bot's CURRENT position every tick rather than caching
|
||||||
if (tryNodes && botAI->rpgInfo.HasActiveTravelPlan())
|
// a multi-step plan and advancing through it. Recovers naturally
|
||||||
{
|
// from knockback, off-route drift, mid-execution destination
|
||||||
if (botAI->rpgInfo.travelPlan.destination.distance(dest) > 10.0f)
|
// changes, and blocked waypoints. Cost: per-tick GetFullPath call;
|
||||||
botAI->rpgInfo.ClearTravel();
|
// the lastPath cache (10% reuse block above) handles the common
|
||||||
else
|
// case where the cached path still ends near the same destination
|
||||||
return UpdateTravelPlan();
|
// and avoids re-derivation.
|
||||||
}
|
|
||||||
|
|
||||||
// PRIORITY: try the travel-node graph FIRST when the move is
|
|
||||||
// long enough to need it.
|
|
||||||
if (tryNodes)
|
if (tryNodes)
|
||||||
{
|
{
|
||||||
|
if (botAI->rpgInfo.HasActiveTravelPlan() &&
|
||||||
|
botAI->rpgInfo.travelPlan.destination.distance(dest) > 10.0f)
|
||||||
|
botAI->rpgInfo.ClearTravel();
|
||||||
|
|
||||||
StartTravelPlan(dest);
|
StartTravelPlan(dest);
|
||||||
if (botAI->rpgInfo.HasActiveTravelPlan())
|
if (botAI->rpgInfo.HasActiveTravelPlan())
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user