forked from liza/Questionable
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();
|
}
|
||||||
|
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user