fix(Core/RPG): LOS check on MoveRandomNear samples to avoid tree tunneling

This commit is contained in:
bash 2026-05-14 22:07:14 +02:00
parent 6ace916242
commit f516104f97

View File

@ -553,6 +553,13 @@ bool NewRpgBaseAction::MoveRandomNear(float moveStep, MovementPriority priority,
if (map->IsInWater(bot->GetPhaseMask(), dx, dy, dz, bot->GetCollisionHeight())) if (map->IsInWater(bot->GetPhaseMask(), dx, dy, dz, bot->GetCollisionHeight()))
continue; continue;
// Reject samples whose straight-line passes through visual
// obstacles (trees, models) that aren't in the navmesh. The
// smooth-path step can otherwise interpolate a waypoint inside
// a tree, making the bot visibly walk through it.
if (!bot->IsWithinLOS(dx, dy, dz))
continue;
bool moved = MoveTo(bot->GetMapId(), dx, dy, dz, false, false, false, true, priority); bool moved = MoveTo(bot->GetMapId(), dx, dy, dz, false, false, false, true, priority);
if (moved) if (moved)
{ {