mirror of https://github.com/ppy/osu
Sanitise interceptor logic to now require two separate check paths
This commit is contained in:
parent
0036d0e26d
commit
fed63abd83
|
@ -33,8 +33,6 @@ public class OsuModAlternate : Mod, IApplicableToDrawableRuleset<OsuHitObject>,
|
|||
private OsuAction? lastActionPressed;
|
||||
private DrawableRuleset<OsuHitObject> ruleset;
|
||||
|
||||
private bool shouldAlternate => !isBreakTime.Value && introEnded;
|
||||
|
||||
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
||||
{
|
||||
ruleset = drawableRuleset;
|
||||
|
@ -54,16 +52,22 @@ public void ApplyToPlayer(Player player)
|
|||
};
|
||||
}
|
||||
|
||||
private bool onPressed(OsuAction key)
|
||||
private bool checkCorrectAction(OsuAction action)
|
||||
{
|
||||
if (lastActionPressed == key)
|
||||
if (isBreakTime.Value)
|
||||
return true;
|
||||
|
||||
if (!introEnded)
|
||||
return true;
|
||||
|
||||
if (lastActionPressed != action)
|
||||
{
|
||||
ruleset.Cursor.FlashColour(Colour4.Red, flash_duration, Easing.OutQuint);
|
||||
// User alternated correctly
|
||||
lastActionPressed = action;
|
||||
return true;
|
||||
}
|
||||
|
||||
lastActionPressed = key;
|
||||
|
||||
ruleset.Cursor.FlashColour(Colour4.Red, flash_duration, Easing.OutQuint);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -83,7 +87,8 @@ public InputInterceptor(OsuModAlternate mod)
|
|||
}
|
||||
|
||||
public bool OnPressed(KeyBindingPressEvent<OsuAction> e)
|
||||
=> mod.shouldAlternate && mod.onPressed(e.Action);
|
||||
// if the pressed action is incorrect, block it from reaching gameplay.
|
||||
=> !mod.checkCorrectAction(e.Action);
|
||||
|
||||
public void OnReleased(KeyBindingReleaseEvent<OsuAction> e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue