From e585de7db5918db5e43cd4588b801ec661d1e228 Mon Sep 17 00:00:00 2001 From: Ralty <78720179+Raltyro@users.noreply.github.com> Date: Thu, 18 Dec 2025 17:20:12 +0700 Subject: [PATCH] Fix Sustain Miss As One Note --- source/funkin/game/Note.hx | 4 ++-- source/funkin/game/PlayState.hx | 21 ++++++++++++++------- source/funkin/game/StrumLine.hx | 28 +++------------------------- 3 files changed, 19 insertions(+), 34 deletions(-) diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index bea0e4da..4d1b5d6c 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -113,8 +113,8 @@ class Note extends FlxSprite public var animSuffix:String = null; - public var tripTimer:Float = 0; // ranges from 0 to 1 - + // Deprecated? + @:dox(hide) public var tripTimer:Float = 0; // ranges from 0 to 1 private static function customTypePathExists(path:String) { if (__customNoteTypeExists.exists(path)) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index f3838462..83d669d4 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1833,18 +1833,25 @@ class PlayState extends MusicBeatState */ public function noteMiss(strumLine:StrumLine, note:Note, ?direction:Int, ?player:Int):Void { - var playerID:Null = note == null ? player : strumLines.members.indexOf(strumLine); - var directionID:Null = note == null ? direction : note.strumID; + var hasNote:Bool = note != null; + var playerID:Null = hasNote ? strumLines.members.indexOf(strumLine) : player; + var directionID:Null = hasNote ? note.strumID : direction; if (playerID == null || directionID == null || playerID == -1) return; - if (Flags.SUSTAINS_AS_ONE_NOTE) { - if (note != null ? (note.isSustainNote && note.prevNote != null && note.prevNote.isSustainNote && !note.prevNote.wasGoodHit) : false) { + if (hasNote) { + if (Flags.SUSTAINS_AS_ONE_NOTE && note.isSustainNote) { strumLine.deleteNote(note); - return; + if (note.sustainParent.wasGoodHit) { + note.sustainParent.wasGoodHit = false; + note.sustainParent.tooLate = true; + note = note.sustainParent; + } + else + return; } } - var event:NoteMissEvent = gameAndCharsEvent("onPlayerMiss", EventManager.get(NoteMissEvent).recycle(note, -10, 1, muteVocalsOnMiss, note != null ? ((note.isSustainNote && Flags.SUSTAINS_AS_ONE_NOTE) ? -0.1425 : -0.0475) : -0.04, Paths.sound(FlxG.random.getObject(Flags.DEFAULT_MISS_SOUNDS)), FlxG.random.float(0.1, 0.2), note == null, combo > 5, "sad", true, true, "miss", strumLines.members[playerID].characters, playerID, note != null ? note.noteType : null, directionID, 0)); + var event:NoteMissEvent = gameAndCharsEvent("onPlayerMiss", EventManager.get(NoteMissEvent).recycle(note, -10, 1, muteVocalsOnMiss, hasNote ? ((note.isSustainNote && Flags.SUSTAINS_AS_ONE_NOTE) ? -0.1425 : -0.0475) : -0.04, Paths.sound(FlxG.random.getObject(Flags.DEFAULT_MISS_SOUNDS)), FlxG.random.float(0.1, 0.2), !hasNote, combo > 5, "sad", true, true, "miss", strumLines.members[playerID].characters, playerID, hasNote ? note.noteType : null, directionID, 0)); strumLine.onMiss.dispatch(event); if (event.cancelled) { gameAndCharsEvent("onPostPlayerMiss", event); @@ -1883,7 +1890,7 @@ class PlayState extends MusicBeatState } } - if (event.deleteNote && strumLine != null && note != null) + if (event.deleteNote && strumLine != null && hasNote) strumLine.deleteNote(note); gameAndCharsEvent("onPostPlayerMiss", event); diff --git a/source/funkin/game/StrumLine.hx b/source/funkin/game/StrumLine.hx index 8945c7d5..a6211fec 100644 --- a/source/funkin/game/StrumLine.hx +++ b/source/funkin/game/StrumLine.hx @@ -241,20 +241,8 @@ class StrumLine extends FlxTypedGroup { if (__updateNote_event.strum == null) return; if (__updateNote_event.__reposNote) __updateNote_event.strum.updateNotePosition(daNote); - - if (daNote.isSustainNote) - { + if (daNote.isSustainNote) { daNote.updateSustain(__updateNote_event.strum); - - if (daNote.tripTimer > 0 && daNote.tailCount > 3) - { - daNote.tripTimer -= 0.05 / daNote.sustainLength; - if (daNote.tripTimer <= 0) - { - daNote.tripTimer = 0; - daNote.canBeHit = false; - } - } } } @@ -264,14 +252,7 @@ class StrumLine extends FlxTypedGroup { var __notePerStrum:Array = []; function __inputProcessPressed(note:Note) { - if (__pressed[note.strumID] && note.isSustainNote && note.strumTime < __updateNote_songPos && !note.wasGoodHit) { - note.tripTimer = 1; - PlayState.instance.goodNoteHit(this, note); - } - } - function __inputProcessPressedOne(note:Note) { - if (__pressed[note.strumID] && note.isSustainNote && note.sustainParent != null && note.prevNote != null && note.prevNote.wasGoodHit && note.strumTime < __updateNote_songPos && !note.wasGoodHit) { - note.tripTimer = 1; + if (__pressed[note.strumID] && note.isSustainNote && note.sustainParent.wasGoodHit && note.strumTime < __updateNote_songPos && !note.wasGoodHit) { PlayState.instance.goodNoteHit(this, note); } } @@ -338,10 +319,7 @@ class StrumLine extends FlxTypedGroup { if (c.lastAnimContext != DANCE) c.__lockAnimThisFrame = true; - if (Flags.SUSTAINS_AS_ONE_NOTE) - notes.forEachAlive(__inputProcessPressedOne); - else - notes.forEachAlive(__inputProcessPressed); + notes.forEachAlive(__inputProcessPressed); } forEach(function(str:Strum) {