From 129aa6a7391f030d0524bc5eb1a42b7cdf76e96d Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Tue, 28 Mar 2023 20:29:54 -0700 Subject: [PATCH] You cant just hold to hit sustains anymore --- source/funkin/game/Note.hx | 8 ++++++-- source/funkin/game/PlayState.hx | 3 +-- source/funkin/game/StrumLine.hx | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index 70597696..4555d4e4 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -53,6 +53,10 @@ class Note extends FlxSprite * The next sustain after this one */ public var nextSustain:Note; + /** + * The parent note of the sustains, the top note + */ + public var parentNote:Note; /** * Name of the splash. @@ -93,13 +97,12 @@ class Note extends FlxSprite public var animSuffix:String = ""; - private static function customTypePathExists(path:String) { if (__customNoteTypeExists.exists(path)) return __customNoteTypeExists[path]; return __customNoteTypeExists[path] = Assets.exists(path); } - public function new(strumLine:StrumLine, noteData:ChartNote, sustain:Bool = false, sustainLength:Float = 0, sustainOffset:Float = 0) + public function new(strumLine:StrumLine, noteData:ChartNote, sustain:Bool = false, sustainLength:Float = 0, sustainOffset:Float = 0, ?parentNote:Null = null) { super(); @@ -110,6 +113,7 @@ class Note extends FlxSprite this.isSustainNote = sustain; this.sustainLength = sustainLength; this.strumLine = strumLine; + this.parentNote = parentNote; x += 50; // MAKE SURE ITS DEFINITELY OFF SCREEN? diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index d4d85ba1..7ef8f594 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1303,14 +1303,13 @@ class PlayState extends MusicBeatState __justPressed = CoolUtil.getDefault(event.justPressed, []); __justReleased = CoolUtil.getDefault(event.justReleased, []); - if (__pressed.contains(true)) { for(c in p.characters) if (c.lastAnimContext != DANCE) c.__lockAnimThisFrame = true; __funcsToExec.push(function(note:Note) { - if (__pressed[note.strumID] && note.isSustainNote && note.canBeHit && !note.wasGoodHit) { + if (__pressed[note.strumID] && (note.isSustainNote && (note.parentNote != null ? note.parentNote.wasGoodHit : true)) && note.canBeHit && !note.wasGoodHit) { goodNoteHit(p, note); } }); diff --git a/source/funkin/game/StrumLine.hx b/source/funkin/game/StrumLine.hx index 25e11077..82eebcdf 100644 --- a/source/funkin/game/StrumLine.hx +++ b/source/funkin/game/StrumLine.hx @@ -79,14 +79,14 @@ class StrumLine extends FlxTypedGroup { public function generate(strumLine:ChartStrumLine) { if (strumLine.notes != null) for(note in strumLine.notes) { - notes.add(new Note(this, note, false)); + var parentNote:Note = notes.add(new Note(this, note, false)); if (note.sLen > Conductor.stepCrochet * 0.75) { var len:Float = note.sLen; var curLen:Float = 0; while(len > 10) { curLen = Math.min(len, Conductor.stepCrochet); - notes.add(new Note(this, note, true, curLen, note.sLen - len)); + notes.add(new Note(this, note, true, curLen, note.sLen - len, parentNote)); len -= curLen; } }