master #3

Open
cacahuetes wants to merge 640 commits from liza/Questionable:master into cacahuetes-ShB-Healer
Showing only changes of commit b92531f2ec - Show all commits

View File

@ -120,7 +120,8 @@ internal sealed class MovementController : IDisposable
{ {
Destination.NavmeshCalculations++; Destination.NavmeshCalculations++;
Destination.PartialRoute.AddRange(navPoints); Destination.PartialRoute.AddRange(navPoints);
_logger.LogInformation("Running navmesh recalculation with fudged point ({From} to {To})", navPoints.Last(), Destination.Position); _logger.LogInformation("Running navmesh recalculation with fudged point ({From} to {To})",
navPoints.Last(), Destination.Position);
_cancellationTokenSource = new(); _cancellationTokenSource = new();
_cancellationTokenSource.CancelAfter(TimeSpan.FromSeconds(30)); _cancellationTokenSource.CancelAfter(TimeSpan.FromSeconds(30));
@ -161,20 +162,12 @@ internal sealed class MovementController : IDisposable
if (Destination is { IsFlying: true } && _condition[ConditionFlag.Swimming]) if (Destination is { IsFlying: true } && _condition[ConditionFlag.Swimming])
{ {
_logger.LogInformation("Flying but swimming, restarting as non-flying path..."); _logger.LogInformation("Flying but swimming, restarting as non-flying path...");
var dest = Destination; Restart(Destination);
Stop(); }
else if (Destination is { IsFlying: true } && !_condition[ConditionFlag.Mounted])
if (dest.UseNavmesh) {
{ _logger.LogInformation("Flying but not mounted, restarting as non-flying path...");
NavigateTo(EMovementType.None, dest.DataId, dest.Position, false, false, dest.StopDistance, Restart(Destination);
dest.IgnoreDistanceToObject);
}
else
{
NavigateTo(EMovementType.None, dest.DataId, [dest.Position], false, false, dest.StopDistance,
dest.IgnoreDistanceToObject);
}
return; return;
} }
@ -260,6 +253,22 @@ internal sealed class MovementController : IDisposable
} }
} }
private void Restart(DestinationData destination)
{
Stop();
if (destination.UseNavmesh)
{
NavigateTo(EMovementType.None, destination.DataId, destination.Position, false, false,
destination.StopDistance, destination.IgnoreDistanceToObject);
}
else
{
NavigateTo(EMovementType.None, destination.DataId, [destination.Position], false, false,
destination.StopDistance, destination.IgnoreDistanceToObject);
}
}
private bool IsOnFlightPath(Vector3 p) private bool IsOnFlightPath(Vector3 p)
{ {
Vector3? pointOnFloor = _navmeshIpc.GetPointOnFloor(p, true); Vector3? pointOnFloor = _navmeshIpc.GetPointOnFloor(p, true);