mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 19:44:05 +09:00
Former-commit-id: 71daf44209f700b8702f2b73294583edefda49c9 Former-commit-id: 3ab76c6509086490ba6ea9501b1ba08e444a7e53
46 lines
1.3 KiB
Kotlin
46 lines
1.3 KiB
Kotlin
package net.torvald.terrarum.console
|
|
|
|
import net.torvald.terrarum.Terrarum
|
|
import net.torvald.terrarum.debuggerapp.ActorValueTracker
|
|
import java.util.*
|
|
|
|
/**
|
|
* Created by SKYHi14 on 2016-12-29.
|
|
*/
|
|
object AVTracker : ConsoleCommand {
|
|
private val jPanelInstances = ArrayList<ActorValueTracker>()
|
|
|
|
override fun execute(args: Array<String>) {
|
|
if (args.size < 2) {
|
|
jPanelInstances.add(ActorValueTracker(Terrarum.ingame.player))
|
|
}
|
|
else {
|
|
try {
|
|
val actorID = args[1].toInt()
|
|
|
|
if (Terrarum.ingame.hasActor(actorID)) {
|
|
jPanelInstances.add(ActorValueTracker(Terrarum.ingame.getActorByID(actorID)))
|
|
}
|
|
else {
|
|
throw IllegalArgumentException()
|
|
}
|
|
}
|
|
catch (e: NumberFormatException) {
|
|
EchoError("Illegal actor ID input")
|
|
return
|
|
}
|
|
catch (e1: IllegalArgumentException) {
|
|
EchoError("No such actor with specified ID")
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
override fun printUsage() {
|
|
Echo("Pops up new window that provides real-time information about the actor's actor value")
|
|
}
|
|
|
|
fun update() {
|
|
jPanelInstances.forEach { it.update() }
|
|
}
|
|
} |