Skip to content

Commit 981284d

Browse files
committed
⬆️(loader) v1.11.4
1 parent e5de6a2 commit 981284d

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ allprojects {
7272
}
7373

7474
dependencies {
75-
val libraryVersion = "1.11.3.1"
75+
val libraryVersion = "1.11.4"
7676
val mindustryVersion = "v2025.06.X10" //v149
7777
api("cf.wayzer:ScriptAgent:$libraryVersion")
7878
implementation("cf.wayzer:LibraryManager:1.6")

scripts/bootStrap/generate.kts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package bootStrap
22

3-
import cf.wayzer.scriptAgent.impl.LoaderBridgeHost
3+
import cf.wayzer.scriptAgent.events.ScriptStateChangeEvent
44
import cf.wayzer.scriptAgent.util.CASScriptPacker
55
import cf.wayzer.scriptAgent.util.DependencyManager
66
import cf.wayzer.scriptAgent.util.maven.Dependency
@@ -26,10 +26,24 @@ suspend fun compileOnlyLoad(script: ScriptInfo) {
2626
script.failReason = "编译失败: $msg"
2727
return
2828
}
29+
try {
30+
compiled.loadLibraries()
31+
} catch (e: Exception) {
32+
script.failReason = "依赖下载失败:$e"
33+
return
34+
}
2935
script.compiledScript = compiled
3036
script.stateUpdateForce(ScriptState.Loaded).join()
3137
}
3238

39+
//Replaced with compileOnlyLoad
40+
listenTo<ScriptStateChangeEvent.Cancellable> {
41+
if (next == ScriptState.Loading) {
42+
cancelled = true
43+
compileOnlyLoad(script)
44+
}
45+
}
46+
3347
onEnable {
3448
if (id != Config.mainScript)
3549
return@onEnable ScriptManager.disableScript(this, "仅可通过SAMAIN启用")
@@ -44,10 +58,7 @@ onEnable {
4458
else
4559
Config.args.forEach { add(it) }
4660

47-
LoaderBridgeHost.withScriptLoader {
48-
forEach { compileOnlyLoad(it) }
49-
}
50-
61+
load()
5162
}
5263
val fail = ScriptRegistry.allScripts { it.failReason != null }
5364
println("共加载${ScriptRegistry.allScripts { it.scriptState != ScriptState.Found }.size}个脚本,失败${fail.size}")

0 commit comments

Comments
 (0)