add preventSustainClip (#856)

This commit is contained in:
sillyborja
2025-12-19 08:16:59 +07:00
committed by GitHub
parent e585de7db5
commit e6f1fed96e
4 changed files with 16 additions and 3 deletions
@@ -11,6 +11,7 @@ final class NoteHitEvent extends CancellableEvent {
@:dox(hide) public var unmuteVocals:Bool = true;
@:dox(hide) public var enableCamZooming:Bool = true;
@:dox(hide) public var autoHitLastSustain:Bool = true;
@:dox(hide) public var clipSustain:Bool = true;
/**
* Whenever a miss should be added.
@@ -145,6 +146,13 @@ final class NoteHitEvent extends CancellableEvent {
deleteNote = true;
}
/**
* Prevents the sustain from being cut. Only works if the note is a sustain.
*/
public function preventSustainClip() {
clipSustain = false;
}
/**
* Prevents the vocals volume from being set to 1 after pressing the note.
*/
+3 -1
View File
@@ -83,6 +83,7 @@ class Note extends FlxSprite
public var sustainLength:Float = 0;
public var isSustainNote:Bool = false;
public var noSustainClip:Bool = false;
public var flipSustain:Bool = true;
public var noteTypeID:Int = 0;
@@ -222,6 +223,7 @@ class Note extends FlxSprite
public var lastScrollSpeed:Null<Float> = null;
public var gapFix:SingleOrFloat = 0;
public var useAntialiasingFix(get, set):Bool;
inline function set_useAntialiasingFix(v:Bool) {
if(v != useAntialiasingFix) {
gapFix = v ? 1 : 0;
@@ -308,7 +310,7 @@ class Note extends FlxSprite
updateSustainClip();
}
public function updateSustainClip() if (wasGoodHit) {
public function updateSustainClip() if (wasGoodHit && !noSustainClip) {
var t = FlxMath.bound((Conductor.songPosition - strumTime) / height * 0.45 * lastScrollSpeed, 0, 1);
var rect = clipRect == null ? FlxRect.get() : clipRect;
clipRect = rect.set(0, frameHeight * t, frameWidth, frameHeight * (1 - t));
+2
View File
@@ -1952,6 +1952,8 @@ class PlayState extends MusicBeatState
strumLine.onHit.dispatch(event);
gameAndCharsEvent("onNoteHit", event);
note.noSustainClip = !event.clipSustain;
if (!event.cancelled) {
if (!note.isSustainNote) {
if (event.countScore) songScore += event.score;
+3 -2
View File
@@ -224,9 +224,10 @@ class StrumLine extends FlxTypedGroup<Strum> {
daNote.tooLate = true;
}
if (cpu && __updateNote_event.__autoCPUHit && !daNote.avoid && !daNote.wasGoodHit && daNote.strumTime < __updateNote_songPos) PlayState.instance.goodNoteHit(this, daNote);
if (cpu && __updateNote_event.__autoCPUHit && !daNote.avoid && !daNote.wasGoodHit && daNote.strumTime < __updateNote_songPos)
PlayState.instance.goodNoteHit(this, daNote);
if (daNote.wasGoodHit && daNote.isSustainNote && daNote.strumTime + daNote.sustainLength < __updateNote_songPos) {
if (daNote.wasGoodHit && daNote.isSustainNote && daNote.strumTime + daNote.sustainLength < __updateNote_songPos && !daNote.noSustainClip) {
deleteNote(daNote);
return;
}