From dbc6f7c03108f540d12024bda2c928a95c1fc4ac Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Fri, 22 May 2020 16:47:57 +0900 Subject: [PATCH] =?UTF-8?q?makeScript=E3=81=ABFIXModelPack=E3=82=92?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/anatawa12/fixRtm/scripting/FIXScriptUtil.kt | 2 +- .../java/com/anatawa12/fixRtm/scripting/ScriptImporter.kt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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 {