From 9c021f319e5a0a1db71fcd2a2f7ea4d0df01cb05 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Tue, 8 Nov 2022 18:18:31 +0100 Subject: [PATCH] oh my god i found the source --- buildnumber.txt | 2 +- source/funkin/game/PlayState.hx | 11 ++++++----- source/funkin/scripting/ScriptPack.hx | 6 ++++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/buildnumber.txt b/buildnumber.txt index caa2f5af..ca25bea8 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1239 \ No newline at end of file +1241 \ No newline at end of file diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 7c1b8f5c..9c05f04f 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -627,19 +627,20 @@ class PlayState extends MusicBeatState name = "Unknown"; } + for(k=>e in noteTypesArray) + if (e == name) return k; + + noteTypesArray.push(name); + // loads script var scriptPath = Paths.script('data/notes/${name}'); - if (Assets.exists(scriptPath)) { + if (Assets.exists(scriptPath) && !scripts.contains(scriptPath)) { var script = Script.create(scriptPath); if (!(script is DummyScript)) { scripts.add(script); script.load(); } } - - for(k=>e in noteTypesArray) - if (e == name) return k; - noteTypesArray.push(name); return noteTypesArray.length-1; } function sortByShit(Obj1:Note, Obj2:Note):Int diff --git a/source/funkin/scripting/ScriptPack.hx b/source/funkin/scripting/ScriptPack.hx index 5e8fb394..f704900d 100644 --- a/source/funkin/scripting/ScriptPack.hx +++ b/source/funkin/scripting/ScriptPack.hx @@ -15,6 +15,12 @@ class ScriptPack extends Script { } } + public function contains(path:String) { + for(e in scripts) + if (e.path == path) + return true; + return false; + } public function new(name:String) { additionalDefaultVariables["importScript"] = importScript; super(name);