Skip to content

Commit

Permalink
found a good fix actually lol
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Nov 12, 2024
1 parent a1c0dd2 commit 8857ebf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
19 changes: 15 additions & 4 deletions source/states/ScriptedState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,22 @@ class ScriptedState extends ExtendableState {
Paths.clearUnusedMemory();

try {
if (FileSystem.exists(Paths.script('classes/$path')))
path = Paths.script('classes/$path');
var folders:Array<String> = [Paths.file('classes/')];
#if FUTURE_POLYMOD
for (mod in ModHandler.getModIDs())
folders.push('mods/' + mod + '/classes/');
#end

script = new Hscript(path, false);
script.execute(path, false);
var foundPath:String = null;
for (folder in folders) {
if (FileSystem.exists(folder + path)) {
foundPath = folder + path + '.hxs';
break;
}
}

script = new Hscript(foundPath, false);
script.execute(foundPath, false);

scriptSet('this', this);
scriptSet('add', add);
Expand Down
19 changes: 15 additions & 4 deletions source/substates/ScriptedSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,22 @@ class ScriptedSubState extends ExtendableSubState {
instance = this;

try {
if (FileSystem.exists(Paths.script('classes/$path')))
path = Paths.script('classes/$path');
var folders:Array<String> = [Paths.file('classes/')];
#if FUTURE_POLYMOD
for (mod in ModHandler.getModIDs())
folders.push('mods/' + mod + '/classes/');
#end

script = new Hscript(path, false);
script.execute(path, false);
var foundPath:String = null;
for (folder in folders) {
if (FileSystem.exists(folder + path)) {
foundPath = folder + path + '.hxs';
break;
}
}

script = new Hscript(foundPath, false);
script.execute(foundPath, false);

scriptSet('this', this);
scriptSet('add', add);
Expand Down

0 comments on commit 8857ebf

Please sign in to comment.