Minor tweak to flying pathfindng starting location

This commit is contained in:
Liza 2024-11-27 21:26:54 +01:00
parent 35f1079bc3
commit f3e418f440
Signed by: liza
GPG Key ID: 8DD6D21C03BB0848

View File

@ -317,6 +317,13 @@ internal sealed class MovementController : IDisposable
_logger.LogInformation("Using modified start position for flying pathfinding: {StartPosition}", _logger.LogInformation("Using modified start position for flying pathfinding: {StartPosition}",
startPosition.ToString("G", CultureInfo.InvariantCulture)); startPosition.ToString("G", CultureInfo.InvariantCulture));
} }
else if (fly)
{
// other positions have a (lesser) chance of starting from underground too, in which case pathfinding takes
// >10 seconds and gets stuck trying to go through the ground.
// only for flying; as walking uses a different algorithm
startPosition = startPosition with { Y = startPosition.Y + 0.2f };
}
_pathfindTask = _pathfindTask =
_navmeshIpc.Pathfind(startPosition, to, fly, _cancellationTokenSource.Token); _navmeshIpc.Pathfind(startPosition, to, fly, _cancellationTokenSource.Token);