From 5736cea3339d4e8fd52aec03ff705373e556d8e5 Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Mon, 5 Jun 2023 22:52:12 -0700 Subject: [PATCH] event scripts fix --- source/funkin/game/PlayState.hx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 0c7dcdfc..29e7ec26 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -565,8 +565,15 @@ class PlayState extends MusicBeatState for(content in [Paths.getFolderContent('songs/${SONG.meta.name.toLowerCase()}/scripts', true, fromMods ? MODS : BOTH), Paths.getFolderContent('data/charts/', true, fromMods ? MODS : BOTH)]) for(file in content) addScript(file); - for (file in Paths.getFolderContent('data/events/', true, fromMods ? MODS : BOTH)) - if (EventsData.eventsList.contains(Path.withoutExtension(Path.withoutDirectory(file)))) addScript(file); + var songEvents:Array = []; + for (event in SONG.events) + if (!songEvents.contains(event.name)) songEvents.push(event.name); + + for (file in Paths.getFolderContent('data/events/', true, fromMods ? MODS : BOTH)) { + var fileName:String = Path.withoutExtension(Path.withoutDirectory(file)); + if (EventsData.eventsList.contains(fileName) && songEvents.contains(fileName)) addScript(file); + } + } }