mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
console command dictionary is now automatically filled using reflection
This commit is contained in:
@@ -7,6 +7,10 @@ description=The base game
|
||||
# Author of the module
|
||||
author=Terrarum
|
||||
|
||||
# Root package name for the module
|
||||
# The game will look for certain classes base on this package string, so don't mess up!
|
||||
package=net.torvald.terrarum.modulebasegame
|
||||
|
||||
# Name of the entry script
|
||||
# Entry script must inherit net.torvald.terrarum.ModuleEntryPoint
|
||||
entrypoint=net.torvald.terrarum.modulebasegame.EntryPoint
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
propername=Dwarven Techs
|
||||
description=Dwarven technicians are emerged from their hiding
|
||||
author=Terrarum
|
||||
package=net.torvald.terrarum.modulecomputers
|
||||
entrypoint=net.torvald.terrarum.modulecomputers.EntryPoint
|
||||
releasedate=2017-07-14
|
||||
version=0.2.0
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.github.strikerx3.jxinput.XInputDevice;
|
||||
import net.torvald.gdx.graphics.PixmapIO2;
|
||||
import net.torvald.getcpuname.GetCpuName;
|
||||
import net.torvald.terrarum.concurrent.ThreadExecutor;
|
||||
import net.torvald.terrarum.console.ConsoleCommand;
|
||||
import net.torvald.terrarum.controller.GdxControllerAdapter;
|
||||
import net.torvald.terrarum.controller.TerrarumController;
|
||||
import net.torvald.terrarum.controller.XinputControllerAdapter;
|
||||
@@ -28,6 +29,7 @@ import net.torvald.terrarum.imagefont.TinyAlphNum;
|
||||
import net.torvald.terrarum.langpack.Lang;
|
||||
import net.torvald.terrarum.modulebasegame.IngameRenderer;
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame;
|
||||
import net.torvald.terrarum.modulebasegame.console.ToggleNoClip;
|
||||
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory;
|
||||
import net.torvald.terrarum.utils.JsonFetcher;
|
||||
import net.torvald.terrarum.utils.JsonWriter;
|
||||
@@ -1138,20 +1140,29 @@ public class AppLoader implements ApplicationListener {
|
||||
public static void printdbg(Object obj, Object message) {
|
||||
if (IS_DEVELOPMENT_BUILD) {
|
||||
String out = (obj instanceof String) ? (String) obj : obj.getClass().getSimpleName();
|
||||
System.out.println("[" + out + "] " + message.toString());
|
||||
if (message == null)
|
||||
System.out.println("[" + out + "] null");
|
||||
else
|
||||
System.out.println("[" + out + "] " + message.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void printdbgerr(Object obj, Object message) {
|
||||
if (IS_DEVELOPMENT_BUILD) {
|
||||
String out = (obj instanceof String) ? (String) obj : obj.getClass().getSimpleName();
|
||||
System.err.println("[" + out + "] " + message.toString());
|
||||
if (message == null)
|
||||
System.err.println("[" + out + "] null");
|
||||
else
|
||||
System.err.println("[" + out + "] " + message.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void printmsg(Object obj, Object message) {
|
||||
String out = (obj instanceof String) ? (String) obj : obj.getClass().getSimpleName();
|
||||
System.out.println("[" + out + "] " + message.toString());
|
||||
if (message == null)
|
||||
System.out.println("[" + out + "] null");
|
||||
else
|
||||
System.out.println("[" + out + "] " + message.toString());
|
||||
}
|
||||
|
||||
public static ShaderProgram loadShaderFromFile(String vert, String frag) {
|
||||
|
||||
@@ -43,6 +43,7 @@ object ModMgr {
|
||||
val properName: String,
|
||||
val description: String,
|
||||
val author: String,
|
||||
val packageName: String,
|
||||
val entryPoint: String,
|
||||
val releaseDate: String,
|
||||
val version: String,
|
||||
@@ -96,13 +97,14 @@ object ModMgr {
|
||||
val properName = modMetadata.getProperty("propername")
|
||||
val description = modMetadata.getProperty("description")
|
||||
val author = modMetadata.getProperty("author")
|
||||
val packageName = modMetadata.getProperty("package")
|
||||
val entryPoint = modMetadata.getProperty("entrypoint")
|
||||
val releaseDate = modMetadata.getProperty("releasedate")
|
||||
val version = modMetadata.getProperty("version")
|
||||
val libs = modMetadata.getProperty("libraries").split(Regex(""";[ ]*""")).toTypedArray()
|
||||
val dependency = modMetadata.getProperty("dependency").split(Regex(""";[ ]*""")).toTypedArray()
|
||||
val isDir = FileSystems.getDefault().getPath("$modDir/$moduleName").toFile().isDirectory
|
||||
moduleInfo[moduleName] = ModuleMetadata(index, isDir, properName, description, author, entryPoint, releaseDate, version, libs, dependency)
|
||||
moduleInfo[moduleName] = ModuleMetadata(index, isDir, properName, description, author, packageName, entryPoint, releaseDate, version, libs, dependency)
|
||||
|
||||
printdbg(this, moduleInfo[moduleName])
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.torvald.terrarum.AppLoader.printdbgerr
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.console.CommandDict
|
||||
import net.torvald.terrarum.gameactors.*
|
||||
import net.torvald.terrarum.gameactors.ai.ActorAI
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
@@ -155,6 +156,10 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
uiContainer.add(uiMenu)
|
||||
|
||||
CommandDict // invoke
|
||||
// TODO add console here
|
||||
|
||||
|
||||
//loadDone = true
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.apache.commons.codec.digest.DigestUtils
|
||||
*
|
||||
* Created by minjaesong on 2016-02-19.
|
||||
*/
|
||||
@ConsoleAlias("auth")
|
||||
internal object Authenticator : ConsoleCommand {
|
||||
|
||||
private var a = false
|
||||
|
||||
@@ -1,79 +1,73 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.AppLoader.printdbgerr
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.ModMgr.loadOrder
|
||||
import net.torvald.terrarum.modulebasegame.console.*
|
||||
import java.io.BufferedReader
|
||||
import java.io.InputStreamReader
|
||||
import java.util.*
|
||||
import kotlin.streams.toList
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-01-15.
|
||||
*/
|
||||
object CommandDict {
|
||||
|
||||
// todo replace with reflection?
|
||||
internal val dict: HashMap<String, ConsoleCommand> = hashMapOf(
|
||||
"echo" to Echo,
|
||||
"error" to EchoError,
|
||||
"setav" to SetAV,
|
||||
"qqq" to QuitApp,
|
||||
"codex" to CodexEdictis,
|
||||
"export" to ExportMap,
|
||||
"gc" to ForceGC,
|
||||
"getav" to GetAV,
|
||||
"getlocale" to GetLocale,
|
||||
"togglenoclip" to ToggleNoClip,
|
||||
"nc" to ToggleNoClip,
|
||||
"setlocale" to SetLocale,
|
||||
"teleport" to Teleport,
|
||||
"tp" to Teleport,
|
||||
"cat" to CatStdout,
|
||||
"setgl" to SetGlobalLightOverride,
|
||||
"getfaction" to GetFactioning,
|
||||
"auth" to Authenticator,
|
||||
"batch" to Batch,
|
||||
"settime" to SetTime,
|
||||
"gettime" to GetTime,
|
||||
"settimedelta" to SetTimeDelta,
|
||||
"help" to Help,
|
||||
"version" to Version,
|
||||
"seed" to Seed,
|
||||
"println" to EchoConsole,
|
||||
"inventory" to Inventory,
|
||||
"avtracker" to AVTracker,
|
||||
"actorslist" to ActorsList,
|
||||
"setscale" to SetScale,
|
||||
"kill" to KillActor,
|
||||
"screenshot" to TakeScreenshot,
|
||||
"resize" to ResizeScreen,
|
||||
"possess" to Possess,
|
||||
internal val dict = hashMapOf<String, ConsoleCommand>()
|
||||
|
||||
// Test codes
|
||||
"money" to MoneyDisp,
|
||||
"bulletintest" to SetBulletin,
|
||||
"tips" to PrintRandomTips,
|
||||
"langtest" to LangTest,
|
||||
"spawnball" to SpawnPhysTestBall,
|
||||
"spawntorch" to SpawnTikiTorch,
|
||||
"musictest" to MusicTest,
|
||||
"spawntapestry" to SpawnTapestry,
|
||||
"imtest" to JavaIMTest,
|
||||
"cheatmotherfuckernootnoot" to CheatWarnTest,
|
||||
"spawnlunarlander" to SpawnPhysTestLunarLander,
|
||||
"savetest" to SavegameWriterTest,
|
||||
init {
|
||||
printdbg(this, ModMgr.loadOrder.reversed())
|
||||
printdbg(this, ModMgr.loadOrder.reversed().map { ModMgr.moduleInfo[it]?.packageName })
|
||||
|
||||
"exportav" to ExportAV,
|
||||
/* !! */"exportmeta" to ExportMeta,
|
||||
/* !! */"exportworld" to ExportWorld,
|
||||
/* !! */"exportactor" to ExportActor,
|
||||
/* !! */"importworld" to ImportWorld,
|
||||
/* !! */"importactor" to ImportActor,
|
||||
/* !! */"exportfborgb" to ExportRendererFboRGB,
|
||||
/* !! */"printworld" to PrintWorld
|
||||
)
|
||||
(listOf("net.torvald.terrarum") + ModMgr.loadOrder.reversed().map { ModMgr.moduleInfo[it]?.packageName }.filter { it != null }).forEach{ packageRoot ->
|
||||
printdbg(this, packageRoot)
|
||||
val packageConsole = "$packageRoot.console"
|
||||
val stream = ClassLoader.getSystemClassLoader().getResourceAsStream(packageConsole.replace('.','/'))
|
||||
val reader = BufferedReader(InputStreamReader(stream))
|
||||
|
||||
reader.lines()
|
||||
.filter{ it.endsWith(".class") && !it.contains('$') }
|
||||
.map { Class.forName("$packageConsole.${it.substring(0, it.lastIndexOf('.'))}") }
|
||||
.forEach {
|
||||
|
||||
printdbg(this, "> Trying to instantiate ${it.canonicalName}")
|
||||
|
||||
try {
|
||||
val instance = it.kotlin.objectInstance ?: it.kotlin.java.newInstance()
|
||||
|
||||
val aliases = instance.javaClass.getAnnotation(ConsoleAlias::class.java)?.aliasesCSV?.split(',')?.map { it.trim() }
|
||||
val noexport = instance.javaClass.getAnnotation(ConsoleNoExport::class.java)
|
||||
|
||||
if (noexport == null) {
|
||||
|
||||
dict[instance.javaClass.simpleName.lowercase()] = instance as ConsoleCommand
|
||||
aliases?.forEach {
|
||||
dict[it] = instance as ConsoleCommand
|
||||
}
|
||||
|
||||
printdbg(this, "Class instantiated: ${instance.javaClass.simpleName}")
|
||||
if (aliases != null)
|
||||
printdbg(this, " Annotations: $aliases")
|
||||
}
|
||||
}
|
||||
catch (e: ClassCastException) {
|
||||
printdbgerr(this, "${it.canonicalName} is not a ConsoleCommand")
|
||||
}
|
||||
catch (e: InstantiationException) {
|
||||
printdbgerr(this, "Could not instantiate ${it.canonicalName}")
|
||||
e.printStackTrace(System.err)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
operator fun get(commandName: String): ConsoleCommand {
|
||||
return dict[commandName]!!
|
||||
}
|
||||
|
||||
fun add(name: String, obj: ConsoleCommand) {
|
||||
dict[name] = obj
|
||||
return dict[commandName.lowercase()]!!
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,14 +16,15 @@ internal object CommandInterpreter {
|
||||
private val commandsNoAuth = arrayOf(
|
||||
"auth",
|
||||
"qqq",
|
||||
"zoom",
|
||||
"setlocale",
|
||||
"getlocale",
|
||||
"help",
|
||||
"version",
|
||||
"tips",
|
||||
"screenshot",
|
||||
"resize"
|
||||
"resize",
|
||||
"echo",
|
||||
"error"
|
||||
)
|
||||
|
||||
internal fun execute(command: String) {
|
||||
@@ -38,7 +39,7 @@ internal object CommandInterpreter {
|
||||
var commandObj: ConsoleCommand? = null
|
||||
try {
|
||||
if (single_command.name.toLowerCase().startsWith("qqq")) {
|
||||
commandObj = CommandDict["qqq"]
|
||||
commandObj = CommandDict["QuitApp"]
|
||||
}
|
||||
else if (commandsNoAuth.contains(single_command.name.toLowerCase())) {
|
||||
commandObj = CommandDict[single_command.name.toLowerCase()]
|
||||
|
||||
@@ -15,4 +15,7 @@ interface ConsoleCommand {
|
||||
|
||||
fun printUsage()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
annotation class ConsoleAlias(val aliasesCSV: String)
|
||||
annotation class ConsoleNoExport()
|
||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.console
|
||||
/**
|
||||
* Created by minjaesong on 2016-09-07.
|
||||
*/
|
||||
@ConsoleAlias("println")
|
||||
internal object EchoConsole : ConsoleCommand {
|
||||
/**
|
||||
* Args 0: command given
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.torvald.terrarum.ui.ConsoleWindow
|
||||
/**
|
||||
* Created by minjaesong on 2016-04-25.
|
||||
*/
|
||||
@ConsoleAlias("error")
|
||||
internal object EchoError : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
val argsWoHeader = Array(args.size - 1) { args[it + 1] }
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.Gdx
|
||||
/**
|
||||
* Created by minjaesong on 2016-01-15.
|
||||
*/
|
||||
@ConsoleAlias("qqq")
|
||||
internal object QuitApp : ConsoleCommand {
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.console
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.TerrarumScreenSize
|
||||
|
||||
@ConsoleAlias("resize")
|
||||
object ResizeScreen: ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 3) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.torvald.terrarum.weather.WeatherMixer
|
||||
/**
|
||||
* Created by minjaesong on 2016-02-17.
|
||||
*/
|
||||
@ConsoleAlias("setgl")
|
||||
internal object SetGlobalLightOverride : ConsoleCommand {
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
|
||||
@ConsoleNoExport
|
||||
object TakeScreenshot: ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
AppLoader.requestScreenshot()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.console.ConsoleAlias
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import java.io.IOException
|
||||
@@ -9,6 +10,7 @@ import java.nio.file.Files
|
||||
/**
|
||||
* Created by minjaesong on 2016-02-10.
|
||||
*/
|
||||
@ConsoleAlias("cat")
|
||||
internal object CatStdout : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.ccO
|
||||
import net.torvald.terrarum.console.CommandDict
|
||||
import net.torvald.terrarum.console.ConsoleAlias
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
@@ -11,6 +12,7 @@ import java.util.Formatter
|
||||
/**
|
||||
* Created by minjaesong on 2016-01-16.
|
||||
*/
|
||||
@ConsoleAlias("codex")
|
||||
internal object CodexEdictis : ConsoleCommand {
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.console.ConsoleAlias
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-01-18.
|
||||
*/
|
||||
@ConsoleAlias("gc")
|
||||
internal object ForceGC : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
System.gc()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.console.EchoError
|
||||
@@ -12,12 +12,7 @@ import net.torvald.terrarumsansbitmap.gdx.GameFontBase
|
||||
/**
|
||||
* Created by minjaesong on 2016-02-17.
|
||||
*/
|
||||
internal object GetFactioning : ConsoleCommand {
|
||||
val ccW = GameFontBase.toColorCode(0xFFFF)
|
||||
val ccY = GameFontBase.toColorCode(0xFE8F)
|
||||
val ccM = GameFontBase.toColorCode(0xEAFF)
|
||||
val ccG = GameFontBase.toColorCode(0x8F8F)
|
||||
val ccK = GameFontBase.toColorCode(0x888F)
|
||||
internal object GetFaction : ConsoleCommand {
|
||||
|
||||
private val PRINT_INDENTATION = "$ccK --> $ccW"
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
|
||||
*/
|
||||
internal object Inventory : ConsoleCommand {
|
||||
|
||||
private var target: Pocketed? = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying
|
||||
private var target: Pocketed? = null
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 1) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.Input
|
||||
import net.torvald.terrarum.console.ConsoleAlias
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
//import net.torvald.terrarum.swingapp.IMStringReader
|
||||
@@ -10,6 +11,7 @@ import net.torvald.terrarum.console.Echo
|
||||
* Created by minjaesong on 2017-02-05.
|
||||
*/
|
||||
|
||||
@ConsoleAlias("imtest")
|
||||
internal object JavaIMTest : ConsoleCommand {
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleAlias
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.console.EchoError
|
||||
@@ -9,6 +10,7 @@ import net.torvald.terrarum.langpack.Lang
|
||||
/**
|
||||
* Created by minjaesong on 2017-01-31.
|
||||
*/
|
||||
@ConsoleAlias("kill")
|
||||
internal object KillActor : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
|
||||
@@ -2,9 +2,11 @@ package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.EMDASH
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.console.ConsoleAlias
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
|
||||
@ConsoleAlias("money")
|
||||
object MoneyDisp : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.console.ConsoleAlias
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-07-04.
|
||||
*/
|
||||
@ConsoleAlias("tips")
|
||||
internal object PrintRandomTips : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
Echo("Nope.")
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.ConsoleNoExport
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.FixtureTikiTorch
|
||||
@@ -9,6 +10,7 @@ import net.torvald.terrarum.modulebasegame.gameactors.FixtureTikiTorch
|
||||
/**
|
||||
* Created by minjaesong on 2016-12-17.
|
||||
*/
|
||||
@ConsoleNoExport
|
||||
internal object SpawnTikiTorch : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
val torch = FixtureTikiTorch { "Tiki Torch" }
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.modulebasegame.console
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.console.ConsoleAlias
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.console.EchoError
|
||||
@@ -12,6 +13,7 @@ import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
/**
|
||||
* Created by minjaesong on 2016-01-24.
|
||||
*/
|
||||
@ConsoleAlias("tp,goto")
|
||||
internal object Teleport : ConsoleCommand {
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleAlias
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
@@ -8,6 +9,7 @@ import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
/**
|
||||
* Created by minjaesong on 2016-01-19.
|
||||
*/
|
||||
@ConsoleAlias("nc,noclip")
|
||||
internal object ToggleNoClip : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying
|
||||
|
||||
@@ -34,24 +34,24 @@ The fields are auto-generated by GDX's JSON serialiser.
|
||||
{
|
||||
worldName: "New World",
|
||||
worldIndex: 1,
|
||||
width: 8192,
|
||||
height: 2048,
|
||||
spawnX: 4096,
|
||||
width: 9000,
|
||||
height: 2250,
|
||||
spawnX: 4500,
|
||||
spawnY: 248,
|
||||
creationTime: 1629857065,
|
||||
lastPlayTime: 1629857065,
|
||||
totalPlayTime: 0,
|
||||
layerTerrain: {
|
||||
h: "a441b15fe9a3cf56661190a0b93b9dec7d04127288cc87250967cf3b52894d11",
|
||||
h: <SHA-256 hash of 'b'>,
|
||||
b: <Ascii85-encoded gzipped terrain layerdata>,
|
||||
x: 8192,
|
||||
y: 2048
|
||||
x: 9000,
|
||||
y: 2250
|
||||
},
|
||||
layerWall: {
|
||||
h: <SHA-256 hash of 'b'>,
|
||||
b: <Ascii85-encoded gzipped wall layerdata>,
|
||||
x: 8192,
|
||||
y: 2048
|
||||
x: 9000,
|
||||
y: 2250
|
||||
},
|
||||
wallDamages:{},
|
||||
terrainDamages: {},
|
||||
@@ -69,7 +69,10 @@ The fields are auto-generated by GDX's JSON serialiser.
|
||||
averageTemperature: 288,
|
||||
generatorSeed: 0,
|
||||
worldTime: 27874,
|
||||
tileNumberToNameMap: {}
|
||||
tileNumberToNameMap: {},
|
||||
extraFields: {},
|
||||
genver: 4
|
||||
comp: 1
|
||||
}
|
||||
```
|
||||
|
||||
@@ -78,8 +81,14 @@ The fields are auto-generated by GDX's JSON serialiser.
|
||||
The fields are auto-generated by GDX's JSON serialiser.
|
||||
|
||||
```
|
||||
{
|
||||
<actor id>: { actor serialised in JSON },
|
||||
[
|
||||
{ /* actor serialised in JSON *
|
||||
class: "net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer", /* depends on the actor */
|
||||
referenceID: 1342111743,
|
||||
actorValue: { /* actorValue serialised in JSON */ },
|
||||
hitbox: ...,
|
||||
...
|
||||
},
|
||||
...
|
||||
}
|
||||
]
|
||||
```
|
||||
Reference in New Issue
Block a user