mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
now with watchdogs
This commit is contained in:
@@ -12,6 +12,7 @@ class EntryPoint : ModuleEntryPoint() {
|
||||
|
||||
override fun invoke() {
|
||||
ModMgr.GameItemLoader.invoke(moduleName)
|
||||
ModMgr.GameWatchdogLoader.register(moduleName, NetFrameWatchdog())
|
||||
println("[${moduleName[0].toUpperCase()}${moduleName.substring(1)}] Dirtboard(tm) go drrrrr")
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.torvald.terrarum.modulecomputers
|
||||
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumWorldWatchdog
|
||||
import net.torvald.terrarum.modulebasegame.gameworld.NetRunner
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2025-03-02.
|
||||
*/
|
||||
class NetFrameWatchdog : TerrarumWorldWatchdog(App.TICK_SPEED * 60) {
|
||||
override fun invoke(world: GameWorld) {
|
||||
(world.extraFields["tokenring"] as NetRunner).let {
|
||||
it.purgeDeadFrames()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,11 +40,18 @@ class FixtureRingBusExerciser : Electric {
|
||||
|
||||
init {
|
||||
setEmitterAndSink()
|
||||
|
||||
if (!INGAME.world.extraFields.containsKey("tokenring")) {
|
||||
INGAME.world.extraFields["tokenring"] = NetRunner()
|
||||
}
|
||||
}
|
||||
|
||||
override fun reload() {
|
||||
super.reload()
|
||||
setEmitterAndSink()
|
||||
if (!INGAME.world.extraFields.containsKey("tokenring")) {
|
||||
INGAME.world.extraFields["tokenring"] = NetRunner()
|
||||
}
|
||||
}
|
||||
|
||||
private val msgQueue = Queue<Pair<Int, String>>()
|
||||
|
||||
Reference in New Issue
Block a user