mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
removed unnecessary class Light10B, minor fixes for LightmapRenderer
Former-commit-id: 4cddfb080cc689738d9bf308f7d08852f4c78a8b Former-commit-id: 2354b2483f30e70862a327c1b9688a19bd1b2f66
This commit is contained in:
@@ -38,6 +38,8 @@ object CommandDict {
|
||||
Pair("help", Help()),
|
||||
Pair("version", Version()),
|
||||
Pair("seed", Seed()),
|
||||
Pair("testgetlight", TestGetLight()),
|
||||
Pair("println", EchoConsole()),
|
||||
|
||||
// Test codes
|
||||
Pair("bulletintest", SetBulletin()),
|
||||
|
||||
33
src/net/torvald/terrarum/console/EchoConsole.kt
Normal file
33
src/net/torvald/terrarum/console/EchoConsole.kt
Normal file
@@ -0,0 +1,33 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-09-07.
|
||||
*/
|
||||
class EchoConsole : ConsoleCommand {
|
||||
/**
|
||||
* Args 0: command given
|
||||
* Args 1: first argument
|
||||
*
|
||||
* e.g. in ```setav mass 74```, zeroth args will be ```setav```.
|
||||
*/
|
||||
override fun execute(args: Array<String>) {
|
||||
val argsWoHeader = Array<String>(args.size - 1, {it -> args[it + 1]})
|
||||
argsWoHeader.forEach { execute(it) }
|
||||
}
|
||||
|
||||
fun execute(single_line: String) {
|
||||
val sb = StringBuilder()
|
||||
for (ch in single_line) {
|
||||
if (ch == '\n') {
|
||||
println(sb.toString())
|
||||
sb.delete(0, sb.length - 1)
|
||||
}
|
||||
else
|
||||
sb.append(ch)
|
||||
}
|
||||
println(sb.toString())
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
}
|
||||
}
|
||||
24
src/net/torvald/terrarum/console/TestGetLight.kt
Normal file
24
src/net/torvald/terrarum/console/TestGetLight.kt
Normal file
@@ -0,0 +1,24 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.mapdrawer.LightmapRenderer
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-09-07.
|
||||
*/
|
||||
class TestGetLight : ConsoleCommand {
|
||||
/**
|
||||
* Args 0: command given
|
||||
* Args 1: first argument
|
||||
*
|
||||
* e.g. in ```setav mass 74```, zeroth args will be ```setav```.
|
||||
*/
|
||||
override fun execute(args: Array<String>) {
|
||||
val x = args[1].toInt()
|
||||
val y = args[2].toInt()
|
||||
val l = LightmapRenderer.getLightRawPos(16, 16)
|
||||
EchoConsole().execute(l.toString())
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user