Skip to content

Commit

Permalink
Allow hold notes to be forced deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
NeeEoo committed Nov 6, 2024
1 parent 72238d7 commit 25b5630
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions source/funkin/backend/scripting/events/NoteHitEvent.hx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ final class NoteHitEvent extends CancellableEvent {
@:dox(hide)
public function cancelDeletion() {preventDeletion();}

/**
* Forces the note to be deleted.
**/
public function forceDeletion() {
deleteNote = true;
}

/**
* Prevents the vocals volume from being set to 1 after pressing the note.
*/
Expand Down
8 changes: 5 additions & 3 deletions source/funkin/game/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1645,9 +1645,11 @@ class PlayState extends MusicBeatState

var event:NoteHitEvent;
if (strumLine != null && !strumLine.cpu)
event = scripts.event("onPlayerHit", EventManager.get(NoteHitEvent).recycle(false, !note.isSustainNote, !note.isSustainNote, note, strumLine.characters, true, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, score, note.isSustainNote ? null : accuracy, 0.023, daRating, Options.splashesEnabled && !note.isSustainNote && daRating == "sick"));
event = EventManager.get(NoteHitEvent).recycle(false, !note.isSustainNote, !note.isSustainNote, note, strumLine.characters, true, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, score, note.isSustainNote ? null : accuracy, 0.023, daRating, Options.splashesEnabled && !note.isSustainNote && daRating == "sick");
else
event = scripts.event("onDadHit", EventManager.get(NoteHitEvent).recycle(false, false, false, note, strumLine.characters, false, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, 0, null, 0, daRating, false));
event = EventManager.get(NoteHitEvent).recycle(false, false, false, note, strumLine.characters, false, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, 0, null, 0, daRating, false);
event.deleteNote = !note.isSustainNote; // work around, to allow sustain notes to be deleted
event = scripts.event(strumLine != null && !strumLine.cpu ? "onPlayerHit" : "onDadHit", event);
strumLine.onHit.dispatch(event);
scripts.event("onNoteHit", event);

Expand Down Expand Up @@ -1694,7 +1696,7 @@ class PlayState extends MusicBeatState
}
}

if (event.deleteNote && !note.isSustainNote) strumLine.deleteNote(note);
if (event.deleteNote) strumLine.deleteNote(note);
}

public function displayRating(myRating:String, ?evt:NoteHitEvent = null):Void {
Expand Down

0 comments on commit 25b5630

Please sign in to comment.