mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
fix(Core/Movement): Drop SearchForBestPath multi-Z probe (causes spurious z-shifts)
This commit is contained in:
parent
9b335bf6cf
commit
9715c5d214
@ -385,32 +385,29 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float modifiedZ;
|
// Direct dispatch — engine MovePoint(generatePath=true) handles
|
||||||
Movement::PointsArray path =
|
// path-finding internally. Previously called SearchForBestPath
|
||||||
SearchForBestPath(x, y, z, modifiedZ, sPlayerbotAIConfig.maxMovementSearchTime, normal_only);
|
// here to probe ±step around the target z; that helped find
|
||||||
if (modifiedZ == INVALID_HEIGHT)
|
// polygons when the input z was several yards off the navmesh,
|
||||||
return false;
|
// but its "shortest path" preference would shift modifiedZ to
|
||||||
float distance = bot->GetExactDist(x, y, modifiedZ);
|
// an unreachable nearby polygon (upper terrace, ledge above)
|
||||||
|
// and then the engine's straight-spline NOPATH fallback would
|
||||||
|
// air-walk the bot up to it. cmangos doesn't have an
|
||||||
|
// equivalent — single-z PathFinder call is sufficient.
|
||||||
|
float distance = bot->GetExactDist(x, y, z);
|
||||||
if (distance > 0.01f)
|
if (distance > 0.01f)
|
||||||
{
|
{
|
||||||
if (bot->IsSitState())
|
if (bot->IsSitState())
|
||||||
bot->SetStandState(UNIT_STAND_STATE_STAND);
|
bot->SetStandState(UNIT_STAND_STATE_STAND);
|
||||||
|
|
||||||
// if (bot->IsNonMeleeSpellCast(true))
|
DoMovePoint(bot, x, y, z, generatePath, backwards);
|
||||||
// {
|
|
||||||
// bot->CastStop();
|
|
||||||
// botAI->InterruptSpell();
|
|
||||||
// }
|
|
||||||
DoMovePoint(bot, x, y, modifiedZ, generatePath, backwards);
|
|
||||||
float delay = 1000.0f * MoveDelay(distance, backwards);
|
float delay = 1000.0f * MoveDelay(distance, backwards);
|
||||||
if (lessDelay)
|
if (lessDelay)
|
||||||
{
|
|
||||||
delay -= botAI->GetReactDelay();
|
delay -= botAI->GetReactDelay();
|
||||||
}
|
|
||||||
delay = std::max(.0f, delay);
|
delay = std::max(.0f, delay);
|
||||||
delay = std::min((float)sPlayerbotAIConfig.maxWaitForMove, delay);
|
delay = std::min((float)sPlayerbotAIConfig.maxWaitForMove, delay);
|
||||||
AI_VALUE(LastMovement&, "last movement")
|
AI_VALUE(LastMovement&, "last movement")
|
||||||
.Set(mapId, x, y, modifiedZ, bot->GetOrientation(), delay, priority);
|
.Set(mapId, x, y, z, bot->GetOrientation(), delay, priority);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user