Skip to content

Commit

Permalink
onUpdate, etc. works now too
Browse files Browse the repository at this point in the history
  • Loading branch information
lemz1 committed May 31, 2024
1 parent a7d78c0 commit 146e4df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/funkin/play/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1170,12 +1170,16 @@ class PlayState extends MusicBeatSubState
// Dispatch event to conversation script.
ScriptEventDispatcher.callEvent(currentConversation, event);

// Dispatch event to note script
// Dispatch event to only the specific note script
if (Std.isOfType(event, NoteScriptEvent))
{
var noteEvent:NoteScriptEvent = cast(event, NoteScriptEvent);
NoteKindManager.callEvent(noteEvent.note.noteData.kind, noteEvent);
}
else // Dispatch event to all note scripts
{
NoteKindManager.callEventForAll(event);
}
}

/**
Expand Down
8 changes: 8 additions & 0 deletions source/funkin/play/notes/notekind/NoteKindManager.hx
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,12 @@ class NoteKindManager

ScriptEventDispatcher.callEvent(noteKind, event);
}

public static function callEventForAll(event:ScriptEvent):Void
{
for (noteKind in noteKinds.iterator())
{
ScriptEventDispatcher.callEvent(noteKind, event);
}
}
}

0 comments on commit 146e4df

Please sign in to comment.