mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
fix(Core/Travel): Tighten GetFullPath probe gate so graph routing wins when probe misses
This commit is contained in:
parent
2d68716b24
commit
b371eff871
@ -1684,31 +1684,20 @@ TravelPath TravelNodeMap::GetFullPath(WorldPosition botPos, uint32 botZoneId,
|
||||
{
|
||||
TravelPath path;
|
||||
|
||||
// mmap-probe first: if a 40-step probe makes meaningful progress,
|
||||
// prefer it over the graph. Loosened from "reaches within spellDistance"
|
||||
// because the strict gate falls through to graph routing whenever the
|
||||
// probe stops a few yards short of the destination (e.g., bot can't
|
||||
// reach the exact GO position, or destination is inside an area the
|
||||
// probe can't fully enter). Graph paths come from DB-cached walk
|
||||
// edges baked at offline generation time and can route through
|
||||
// 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
|
||||
// mmap-probe quick path: only accept if the probe REACHES the
|
||||
// destination (within spellDistance). A partial-progress probe is
|
||||
// refused so the graph A* gets a chance — graph nodes can route
|
||||
// through cave entries / dungeon edges that the raw mmap probe can't
|
||||
// anchor on. Earlier looser acceptance (>50% progress) caused the
|
||||
// bot to take a partial probe pointed at terrain instead of using
|
||||
// the travel-node graph that has a node inside the destination.
|
||||
if (botPos.GetMapId() == destination.GetMapId())
|
||||
{
|
||||
std::vector<WorldPosition> probe = destination.getPathFromPath({botPos}, bot, 40);
|
||||
if (probe.size() >= 2)
|
||||
{
|
||||
float const totalDist = botPos.distance(destination);
|
||||
float const probeEndToDest = destination.distance(probe.back());
|
||||
float const probeProgress = totalDist - probeEndToDest;
|
||||
|
||||
bool const closeEnough = probeEndToDest < 30.0f;
|
||||
bool const meaningfulProgress = probeProgress > totalDist * 0.5f && probeProgress > 30.0f;
|
||||
|
||||
if (closeEnough || meaningfulProgress)
|
||||
if (probeEndToDest < sPlayerbotAIConfig.spellDistance)
|
||||
{
|
||||
path.addPoint(botPos, PathNodeType::NODE_PREPATH);
|
||||
for (size_t i = 1; i < probe.size(); ++i)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user