Skip to content

Commit

Permalink
script classes working on, using .hxc for coding advance script
Browse files Browse the repository at this point in the history
  • Loading branch information
khuonghoanghuy committed Nov 12, 2024
1 parent 14ecde5 commit d2a07e8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<haxelib name="funkin.vis" />
<haxelib name="grig.audio" />

<haxelib name="hscript" />
<haxelib name="hscript" if="SIMPLE_SCRIPT" />
<haxelib name="polymod" if="FUTURE_POLYMOD" />
<haxelib name="hxcpp-debug-server" if="desktop debug" />

Expand Down
1 change: 1 addition & 0 deletions source/backend/MacrosUtil.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package backend;

import haxe.macro.Expr;
import sys.io.Process;

class MacrosUtil {
Expand Down
15 changes: 13 additions & 2 deletions source/modding/ModHandler.hx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ class ModHandler {
},
parseRules: getParseRules(),
extensionMap: extensions,
ignoredFiles: Polymod.getDefaultIgnoreList()
ignoredFiles: Polymod.getDefaultIgnoreList(),
useScriptedClasses: true,
loadScriptsAsync: #if html5 true #else false #end,
});

buildImports();

if (loadedModlist == null)
return;

Expand All @@ -66,6 +70,13 @@ class ModHandler {
trace('Name: ${mod.title}, [${mod.id}]');
}

public static function buildImports():Void {
Polymod.addImportAlias("Paths", backend.Paths);
Polymod.blacklistImport('Sys');
Polymod.blacklistImport('Reflect');
Polymod.blacklistImport('Type');
}

public static function getMods():Array<String> {
trackedMods = [];

Expand Down Expand Up @@ -97,7 +108,7 @@ class ModHandler {
public static function getParseRules():ParseRules {
final output:ParseRules = ParseRules.getDefault();
output.addType("txt", TextFileFormat.LINES);
output.addType("hxs", TextFileFormat.PLAINTEXT);
output.addType("hxc", TextFileFormat.PLAINTEXT);
return output != null ? output : null;
}

Expand Down

0 comments on commit d2a07e8

Please sign in to comment.