Skip to content

Commit 356607f

Browse files
rodney528NexIsDumb
andauthored
Clear Static Vars Map on Mod Switch (#740)
* Update MainState.hx * using clear() --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com>
1 parent f9402fe commit 356607f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

source/funkin/backend/system/MainState.hx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ class MainState extends FlxState {
6666
)
6767
];
6868

69-
for(path in addonPaths) {
69+
for (path in addonPaths) {
7070
if (path == null) continue;
7171
if (!isDirectory(path)) continue;
7272

73-
for(addon in FileSystem.readDirectory(path)) {
74-
if(!FileSystem.isDirectory(path + addon)) {
73+
for (addon in FileSystem.readDirectory(path)) {
74+
if (!FileSystem.isDirectory(path + addon)) {
7575
switch(Path.extension(addon).toLowerCase()) {
7676
case 'zip':
7777
addon = Path.withoutExtension(addon);
@@ -90,7 +90,11 @@ class MainState extends FlxState {
9090
else _noPriorityAddons.insert(0, data);
9191
}
9292
}
93+
#end
94+
95+
funkin.backend.scripting.Script.staticVariables.clear();
9396

97+
#if MOD_SUPPORT
9498
for (addon in _lowPriorityAddons)
9599
loadLib(addon.path, ltrim(addon.name, "[LOW]"));
96100

@@ -143,4 +147,4 @@ class MainState extends FlxState {
143147

144148
FlxG.switchState(cast Type.createInstance(startState, []));
145149
}
146-
}
150+
}

0 commit comments

Comments
 (0)