diff --git a/src/main/java/com/anatawa12/fixRtm/scripting/FIXScriptUtil.kt b/src/main/java/com/anatawa12/fixRtm/scripting/FIXScriptUtil.kt index 0f3524a2..d7077876 100644 --- a/src/main/java/com/anatawa12/fixRtm/scripting/FIXScriptUtil.kt +++ b/src/main/java/com/anatawa12/fixRtm/scripting/FIXScriptUtil.kt @@ -69,7 +69,7 @@ fun ModelPackManager.getScriptAndDoScript(fileName: String): ScriptEngine { usingContext { cx -> val scope = makeNewScope() - val script = ScriptImporter.makeScript(filePath, scriptStr) + val script = ScriptImporter.makeScript(filePath, scriptStr, resource.pack) script.exec(cx, scope) diff --git a/src/main/java/com/anatawa12/fixRtm/scripting/ScriptImporter.kt b/src/main/java/com/anatawa12/fixRtm/scripting/ScriptImporter.kt index 54873112..8afe6484 100644 --- a/src/main/java/com/anatawa12/fixRtm/scripting/ScriptImporter.kt +++ b/src/main/java/com/anatawa12/fixRtm/scripting/ScriptImporter.kt @@ -21,8 +21,9 @@ object ScriptImporter { fun getScript(name: String): Script { val resourceLocation = ResourceLocation(name) - val script = FIXFileLoader.getInputStream(resourceLocation).reader().use { it.readText() } - return makeScript(resourceLocation, script) + val resource = FIXFileLoader.getResource(resourceLocation) + val script = resource.inputStream.reader().use { it.readText() } + return makeScript(resourceLocation, script, resource.pack) } fun makeScript(location: ResourceLocation, script: String, pack: FIXModelPack? = null): Script {