Skip to content

Commit

Permalink
helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
lemz1 committed May 31, 2024
1 parent 146e4df commit f04129e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions source/funkin/play/notes/notekind/NoteKind.hx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ class NoteKind implements INoteScriptedClass
*/
public var description:String = "";

/**
* this only exists for people that don't like calling functions
*/
var notes(get, never):Array<NoteSprite>;

function get_notes():Array<NoteSprite>
{
return this.getNotes();
}

public function new(noteKind:String, description:String = "")
{
this.noteKind = noteKind;
Expand All @@ -29,6 +39,18 @@ class NoteKind implements INoteScriptedClass
return noteKind;
}

/**
* Retrieve all notes of this kind
* @return Array<NoteSprite>
*/
function getNotes():Array<NoteSprite>
{
var allNotes:Array<NoteSprite> = PlayState.instance.playerStrumline.notes.members.concat(PlayState.instance.opponentStrumline.notes.members);
return allNotes.filter(function(note:NoteSprite) {
return note != null && note.noteData.kind == this.noteKind;
});
}

public function onScriptEvent(event:ScriptEvent):Void {}

public function onCreate(event:ScriptEvent):Void {}
Expand Down

0 comments on commit f04129e

Please sign in to comment.