Interrupts: Add a special case for certain movement tasks

This commit is contained in:
Liza 2025-01-21 21:44:08 +01:00
parent 3a763d625a
commit 325d5368a5
Signed by: liza
GPG Key ID: 2C41B84815CF6445

View File

@ -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)
{
@ -286,7 +297,16 @@ internal static class MoveTo
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)
{