From c83e505f5bae0e1a61a1d010aec8765d53cab36d Mon Sep 17 00:00:00 2001 From: lemz <ismael.amjad07@gmail.com> Date: Fri, 31 May 2024 17:49:25 +0200 Subject: [PATCH] onUpdate, etc. works now too --- source/funkin/play/PlayState.hx | 6 +++++- source/funkin/play/notes/notekind/NoteKindManager.hx | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index bc441a7d5..3b098be14 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1178,12 +1178,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); + } } /** diff --git a/source/funkin/play/notes/notekind/NoteKindManager.hx b/source/funkin/play/notes/notekind/NoteKindManager.hx index 99502af08..0de1a0a33 100644 --- a/source/funkin/play/notes/notekind/NoteKindManager.hx +++ b/source/funkin/play/notes/notekind/NoteKindManager.hx @@ -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); + } + } }