1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:12:56 +08:00

Schedule FailScore inside onFail instead of onFailComplete

This commit is contained in:
Dean Herbert 2023-11-23 11:05:52 +09:00
parent ef5dd24589
commit d3a55d83c0
No known key found for this signature in database

View File

@ -930,10 +930,22 @@ namespace osu.Game.Screens.Play
failAnimationContainer.Start(); failAnimationContainer.Start();
if (GameplayState.Mods.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail)) // Failures can be triggered either by a judgement, or by a mod.
Restart(true); //
// For the case of a judgement, due to ordering considerations, ScoreProcessor will not have received
// the final judgement which triggered the failure yet (see DrawableRuleset.NewResult handling above).
//
// A schedule here ensures that any lingering judgements from the current frame are applied before we
// finalise the score as "failed".
Schedule(() =>
{
ScoreProcessor.FailScore(Score.ScoreInfo);
OnFail();
if (GameplayState.Mods.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail))
Restart(true);
});
OnFail();
return true; return true;
} }
@ -942,11 +954,6 @@ namespace osu.Game.Screens.Play
/// </summary> /// </summary>
private void onFailComplete() private void onFailComplete()
{ {
// fail completion is a good point to mark a score as failed,
// since the last judgement that caused the fail only applies to score processor after onFail.
// todo: this should probably be handled better.
ScoreProcessor.FailScore(Score.ScoreInfo);
GameplayClockContainer.Stop(); GameplayClockContainer.Stop();
FailOverlay.Retries = RestartCount; FailOverlay.Retries = RestartCount;