Files
Terrarum/src/net/torvald/terrarum/console/CodexEdictis.kt
Song Minjae 5e7a95a3b9 walking is now normal, no more sticking to the walls (the Q&D soluction was used), noclip movement is also normal now
Former-commit-id: 5a8de3e31e1f39e1591a5a60abc9d0dd37c3f87e
Former-commit-id: 9c685d31d6f8c75b512f41e467fac8586a22bc59
2016-07-31 17:51:06 +09:00

51 lines
1.3 KiB
Kotlin

package net.torvald.terrarum.console
import net.torvald.imagefont.GameFontBase
import net.torvald.terrarum.langpack.Lang
import java.util.Formatter
/**
* Created by minjaesong on 16-01-16.
*/
class CodexEdictis : ConsoleCommand {
val ccW = GameFontBase.colToCode["o"]
override fun execute(args: Array<String>) {
if (args.size == 1) {
printList()
}
else {
try {
val commandObj = CommandDict.get(args[1].toLowerCase())
commandObj.printUsage()
}
catch (e: NullPointerException) {
val sb = StringBuilder()
val formatter = Formatter(sb)
Echo().execute("Codex: " + formatter.format(Lang["DEV_MESSAGE_CONSOLE_COMMAND_UNKNOWN"], args[1]).toString())
}
}
}
override fun printUsage() {
val echo = Echo()
echo.execute("Usage: codex (command)")
echo.execute("shows how to use 'command'")
echo.execute("leave blank to get list of available commands")
}
private fun printList() {
val echo = Echo()
echo.execute(Lang["DEV_MESSAGE_CONSOLE_AVAILABLE_COMMANDS"])
CommandDict.dict.forEach { name, cmd ->
echo.execute("$ccW" + name)
cmd.printUsage()
}
}
}