From 356607f53aa80ec71703bf9f504e0d1b1c53acda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=92=9C=20Rodney=2C=20An=20Imaginative=20Furball=20?= =?UTF-8?q?=F0=9F=92=99?= Date: Sat, 23 Aug 2025 20:10:55 -0400 Subject: [PATCH] Clear Static Vars Map on Mod Switch (#740) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update MainState.hx * using clear() --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/backend/system/MainState.hx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/funkin/backend/system/MainState.hx b/source/funkin/backend/system/MainState.hx index 3b78f47e..6762652d 100644 --- a/source/funkin/backend/system/MainState.hx +++ b/source/funkin/backend/system/MainState.hx @@ -66,12 +66,12 @@ class MainState extends FlxState { ) ]; - for(path in addonPaths) { + for (path in addonPaths) { if (path == null) continue; if (!isDirectory(path)) continue; - for(addon in FileSystem.readDirectory(path)) { - if(!FileSystem.isDirectory(path + addon)) { + for (addon in FileSystem.readDirectory(path)) { + if (!FileSystem.isDirectory(path + addon)) { switch(Path.extension(addon).toLowerCase()) { case 'zip': addon = Path.withoutExtension(addon); @@ -90,7 +90,11 @@ class MainState extends FlxState { else _noPriorityAddons.insert(0, data); } } + #end + funkin.backend.scripting.Script.staticVariables.clear(); + + #if MOD_SUPPORT for (addon in _lowPriorityAddons) loadLib(addon.path, ltrim(addon.name, "[LOW]")); @@ -143,4 +147,4 @@ class MainState extends FlxState { FlxG.switchState(cast Type.createInstance(startState, [])); } -} \ No newline at end of file +}