Files
Terrarum/src/net/torvald/terrarum/console/SetTimeDelta.kt
Song Minjae f1151977d9 UI testing env and working text buttons
Former-commit-id: b8fd27c7f71f9bc8da259ae132badcbc9ce117ac
2017-03-13 21:40:50 +09:00

31 lines
843 B
Kotlin

package net.torvald.terrarum.console
import net.torvald.terrarum.Terrarum
/**
* Created by minjaesong on 16-03-20.
*/
internal object SetTimeDelta : ConsoleCommand {
val HARD_LIMIT = 60
override fun execute(args: Array<String>) {
if (args.size == 2) {
if (args[1].toInt() > HARD_LIMIT)
EchoError("Delta too large -- acceptable delta is 0-60.")
Terrarum.ingame!!.world.time.setTimeDelta(args[1].toInt())
if (Terrarum.ingame!!.world.time.timeDelta == 0)
Echo("時間よ止まれ!ザ・ワルド!!")
else
Echo("Set time delta to ${Terrarum.ingame!!.world.time.timeDelta}")
}
else {
printUsage()
}
}
override fun printUsage() {
Echo("usage: settimedelta <int>")
}
}