Restart movement if you're unmounted while moving (Logistics of War)
This commit is contained in:
parent
0e33da7385
commit
b92531f2ec
@ -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();
|
|
||||||
|
|
||||||
if (dest.UseNavmesh)
|
|
||||||
{
|
|
||||||
NavigateTo(EMovementType.None, dest.DataId, dest.Position, false, false, dest.StopDistance,
|
|
||||||
dest.IgnoreDistanceToObject);
|
|
||||||
}
|
}
|
||||||
else
|
else if (Destination is { IsFlying: true } && !_condition[ConditionFlag.Mounted])
|
||||||
{
|
{
|
||||||
NavigateTo(EMovementType.None, dest.DataId, [dest.Position], false, false, dest.StopDistance,
|
_logger.LogInformation("Flying but not mounted, restarting as non-flying path...");
|
||||||
dest.IgnoreDistanceToObject);
|
Restart(Destination);
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user