Interrupts: Add a special case for certain movement tasks
This commit is contained in:
parent
3a763d625a
commit
325d5368a5
@ -228,6 +228,17 @@ internal static class MoveTo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!ShouldResolveCombatBeforeNextInteraction() &&
|
||||||
|
_movementController is { IsPathfinding: false, IsPathRunning: false } &&
|
||||||
|
mountExecutor.EvaluateMountState() == Mount.MountResult.DontMount)
|
||||||
|
{
|
||||||
|
// except for e.g. jumping which would maybe break if combat navigates us away, if we don't
|
||||||
|
// need a mount anymore we can just skip combat and assume that the interruption is handled
|
||||||
|
// later.
|
||||||
|
//
|
||||||
|
// without this, the character would just stand around while getting hit
|
||||||
|
_nestedExecutor = (new NoOpTaskExecutor(), new NoOpTask(), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (nestedExecutor.Executor.Update() == ETaskResult.TaskComplete)
|
else if (nestedExecutor.Executor.Update() == ETaskResult.TaskComplete)
|
||||||
{
|
{
|
||||||
@ -286,7 +297,16 @@ internal static class MoveTo
|
|||||||
return base.WasInterrupted();
|
return base.WasInterrupted();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool ShouldInterruptOnDamage() => false;
|
public override bool ShouldInterruptOnDamage()
|
||||||
|
{
|
||||||
|
// have we stopped moving, and are we
|
||||||
|
// (a) waiting for a mount to complete, or
|
||||||
|
// (b) want combat to be done before any other interaction?
|
||||||
|
return _movementController is { IsPathfinding: false, IsPathRunning: false } &&
|
||||||
|
(_nestedExecutor is { Triggered: false, Executor: Mount.MountExecutor } || ShouldResolveCombatBeforeNextInteraction());
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ShouldResolveCombatBeforeNextInteraction() => Task.InteractionType is EInteractionType.Jump;
|
||||||
|
|
||||||
public bool OnErrorToast(SeString message)
|
public bool OnErrorToast(SeString message)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user