fix(Core/Travel): Tighten GetFullPath probe gate so graph routing wins when probe misses

This commit is contained in:
bash 2026-05-31 00:10:39 +02:00
parent 1c9fd126ba
commit 8efe3a4321

View File

@ -1684,31 +1684,20 @@ TravelPath TravelNodeMap::GetFullPath(WorldPosition botPos, uint32 botZoneId,
{ {
TravelPath path; TravelPath path;
// mmap-probe first: if a 40-step probe makes meaningful progress, // mmap-probe quick path: only accept if the probe REACHES the
// prefer it over the graph. Loosened from "reaches within spellDistance" // destination (within spellDistance). A partial-progress probe is
// because the strict gate falls through to graph routing whenever the // refused so the graph A* gets a chance — graph nodes can route
// probe stops a few yards short of the destination (e.g., bot can't // through cave entries / dungeon edges that the raw mmap probe can't
// reach the exact GO position, or destination is inside an area the // anchor on. Earlier looser acceptance (>50% progress) caused the
// probe can't fully enter). Graph paths come from DB-cached walk // bot to take a partial probe pointed at terrain instead of using
// edges baked at offline generation time and can route through // the travel-node graph that has a node inside the destination.
// terrain that current mmaps treat as unwalkable.
//
// Accept the probe if EITHER:
// (a) it reaches within 30y of destination, OR
// (b) it makes >50% progress and got at least 30y total
if (botPos.GetMapId() == destination.GetMapId()) if (botPos.GetMapId() == destination.GetMapId())
{ {
std::vector<WorldPosition> probe = destination.getPathFromPath({botPos}, bot, 40); std::vector<WorldPosition> probe = destination.getPathFromPath({botPos}, bot, 40);
if (probe.size() >= 2) if (probe.size() >= 2)
{ {
float const totalDist = botPos.distance(destination);
float const probeEndToDest = destination.distance(probe.back()); float const probeEndToDest = destination.distance(probe.back());
float const probeProgress = totalDist - probeEndToDest; if (probeEndToDest < sPlayerbotAIConfig.spellDistance)
bool const closeEnough = probeEndToDest < 30.0f;
bool const meaningfulProgress = probeProgress > totalDist * 0.5f && probeProgress > 30.0f;
if (closeEnough || meaningfulProgress)
{ {
path.addPoint(botPos, PathNodeType::NODE_PREPATH); path.addPoint(botPos, PathNodeType::NODE_PREPATH);
for (size_t i = 1; i < probe.size(); ++i) for (size_t i = 1; i < probe.size(); ++i)