mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 03:54:06 +09:00
asynch update and render (aka frameskip)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.debuggerapp.ActorValueTracker
|
||||
import java.util.*
|
||||
|
||||
@@ -12,14 +12,14 @@ internal object AVTracker : ConsoleCommand {
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size < 2) {
|
||||
jPanelInstances.add(ActorValueTracker(TerrarumGDX.ingame!!.player))
|
||||
jPanelInstances.add(ActorValueTracker(Terrarum.ingame!!.player))
|
||||
}
|
||||
else {
|
||||
try {
|
||||
val actorID = args[1].toInt()
|
||||
|
||||
if (TerrarumGDX.ingame!!.theGameHasActor(actorID)) {
|
||||
jPanelInstances.add(ActorValueTracker(TerrarumGDX.ingame!!.getActorByID(actorID)))
|
||||
if (Terrarum.ingame!!.theGameHasActor(actorID)) {
|
||||
jPanelInstances.add(ActorValueTracker(Terrarum.ingame!!.getActorByID(actorID)))
|
||||
}
|
||||
else {
|
||||
throw IllegalArgumentException()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.debuggerapp.ActorsLister
|
||||
import java.util.*
|
||||
|
||||
@@ -12,8 +12,8 @@ internal object ActorsList : ConsoleCommand {
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
jPanelInstances.add(ActorsLister(
|
||||
TerrarumGDX.ingame!!.actorContainer,
|
||||
TerrarumGDX.ingame!!.actorContainerInactive)
|
||||
Terrarum.ingame!!.actorContainer,
|
||||
Terrarum.ingame!!.actorContainerInactive)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.ui.ConsoleWindow
|
||||
import org.apache.commons.codec.digest.DigestUtils
|
||||
|
||||
@@ -39,7 +39,7 @@ internal object Authenticator : ConsoleCommand {
|
||||
Echo(msg)
|
||||
println("[Authenticator] " + msg)
|
||||
a = !a
|
||||
(TerrarumGDX.ingame!!.consoleHandler.UI as ConsoleWindow).reset()
|
||||
(Terrarum.ingame!!.consoleHandler.UI as ConsoleWindow).reset()
|
||||
}
|
||||
else {
|
||||
printUsage() // thou shalt not pass!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.ui.ConsoleWindow
|
||||
|
||||
/**
|
||||
@@ -16,13 +16,13 @@ internal object Echo : ConsoleCommand {
|
||||
val sb = StringBuilder()
|
||||
for (ch in single_line) {
|
||||
if (ch == '\n') {
|
||||
(TerrarumGDX.ingame!!.consoleHandler.UI as ConsoleWindow).sendMessage(sb.toString())
|
||||
(Terrarum.ingame!!.consoleHandler.UI as ConsoleWindow).sendMessage(sb.toString())
|
||||
sb.delete(0, sb.length - 1)
|
||||
}
|
||||
else
|
||||
sb.append(ch)
|
||||
}
|
||||
(TerrarumGDX.ingame!!.consoleHandler.UI as ConsoleWindow).sendMessage(sb.toString())
|
||||
(Terrarum.ingame!!.consoleHandler.UI as ConsoleWindow).sendMessage(sb.toString())
|
||||
}
|
||||
|
||||
operator fun invoke(args: Array<String>) = execute(args)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.ui.ConsoleWindow
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@ internal object EchoError : ConsoleCommand {
|
||||
}
|
||||
|
||||
fun execute(single_line: String) {
|
||||
(TerrarumGDX.ingame!!.consoleHandler.UI as ConsoleWindow).sendMessage(single_line)
|
||||
(Terrarum.ingame!!.consoleHandler.UI as ConsoleWindow).sendMessage(single_line)
|
||||
}
|
||||
|
||||
operator fun invoke(args: Array<String>) = execute(args)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.utils.JsonWriter
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
import java.io.IOException
|
||||
|
||||
@@ -13,8 +13,8 @@ internal object ExportAV : ConsoleCommand {
|
||||
if (args.size == 2) {
|
||||
try {
|
||||
JsonWriter.writeToFile(
|
||||
TerrarumGDX.ingame!!.player!!.actorValue,
|
||||
TerrarumGDX.defaultDir + "/Exports/" + args[1] + ".json")
|
||||
Terrarum.ingame!!.player!!.actorValue,
|
||||
Terrarum.defaultDir + "/Exports/" + args[1] + ".json")
|
||||
|
||||
Echo("ExportAV: exported to " + args[1] + ".json")
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.colourutil.Col4096
|
||||
import net.torvald.terrarum.utils.RasterWriter
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
|
||||
import java.io.*
|
||||
@@ -60,10 +60,10 @@ internal object ExportMap : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
|
||||
var mapData = ByteArray(TerrarumGDX.ingame!!.world.width * TerrarumGDX.ingame!!.world.height * 3)
|
||||
var mapData = ByteArray(Terrarum.ingame!!.world.width * Terrarum.ingame!!.world.height * 3)
|
||||
var mapDataPointer = 0
|
||||
|
||||
for (tile in TerrarumGDX.ingame!!.world.terrainIterator()) {
|
||||
for (tile in Terrarum.ingame!!.world.terrainIterator()) {
|
||||
val colArray = (colorTable as Map<Int, Col4096>)
|
||||
.getOrElse(tile, { Col4096(0xFFF) }).toByteArray()
|
||||
|
||||
@@ -74,7 +74,7 @@ internal object ExportMap : ConsoleCommand {
|
||||
mapDataPointer += 3
|
||||
}
|
||||
|
||||
val dir = TerrarumGDX.defaultDir + "/Exports/"
|
||||
val dir = Terrarum.defaultDir + "/Exports/"
|
||||
val dirAsFile = File(dir)
|
||||
if (!dirAsFile.exists()) {
|
||||
dirAsFile.mkdir()
|
||||
@@ -82,7 +82,7 @@ internal object ExportMap : ConsoleCommand {
|
||||
|
||||
try {
|
||||
RasterWriter.writePNG_RGB(
|
||||
TerrarumGDX.ingame!!.world.width, TerrarumGDX.ingame!!.world.height, mapData, dir + args[1] + ".png")
|
||||
Terrarum.ingame!!.world.width, Terrarum.ingame!!.world.height, mapData, dir + args[1] + ".png")
|
||||
Echo("ExportMap: exported to " + args[1] + ".png")
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-19.
|
||||
@@ -10,9 +10,9 @@ internal object GetAV : ConsoleCommand {
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
try {
|
||||
if (args.size == 1 && TerrarumGDX.ingame!!.player != null) {
|
||||
if (args.size == 1 && Terrarum.ingame!!.player != null) {
|
||||
// print all actorvalue of player
|
||||
val av = TerrarumGDX.ingame!!.player!!.actorValue
|
||||
val av = Terrarum.ingame!!.player!!.actorValue
|
||||
val keyset = av.keySet
|
||||
|
||||
Echo("$ccW== ActorValue list for ${ccY}player $ccW==")
|
||||
@@ -29,20 +29,20 @@ internal object GetAV : ConsoleCommand {
|
||||
// check if args[1] is number or not
|
||||
if (!args[1].isNum()) { // args[1] is ActorValue name
|
||||
Echo("${ccW}player.$ccM${args[1]} $ccW= " +
|
||||
ccG +
|
||||
TerrarumGDX.ingame!!.player!!.actorValue[args[1]] +
|
||||
" $ccO" +
|
||||
TerrarumGDX.ingame!!.player!!.actorValue[args[1]]!!.javaClass.simpleName
|
||||
ccG +
|
||||
Terrarum.ingame!!.player!!.actorValue[args[1]] +
|
||||
" $ccO" +
|
||||
Terrarum.ingame!!.player!!.actorValue[args[1]]!!.javaClass.simpleName
|
||||
)
|
||||
println("[GetAV] player.${args[1]} = " +
|
||||
TerrarumGDX.ingame!!.player!!.actorValue[args[1]] +
|
||||
Terrarum.ingame!!.player!!.actorValue[args[1]] +
|
||||
" " +
|
||||
TerrarumGDX.ingame!!.player!!.actorValue[args[1]]!!.javaClass.simpleName
|
||||
Terrarum.ingame!!.player!!.actorValue[args[1]]!!.javaClass.simpleName
|
||||
)
|
||||
}
|
||||
else {
|
||||
// args[1] is actor ID
|
||||
val actor = TerrarumGDX.ingame!!.getActorByID(args[1].toInt())
|
||||
val actor = Terrarum.ingame!!.getActorByID(args[1].toInt())
|
||||
val av = actor.actorValue
|
||||
val keyset = av.keySet
|
||||
|
||||
@@ -64,14 +64,14 @@ internal object GetAV : ConsoleCommand {
|
||||
val id = args[1].toInt()
|
||||
val av = args[2]
|
||||
Echo("$ccW$id.$ccM$av $ccW= $ccG" +
|
||||
TerrarumGDX.ingame!!.getActorByID(id).actorValue[av] +
|
||||
" $ccO" +
|
||||
TerrarumGDX.ingame!!.getActorByID(id).actorValue[av]!!.javaClass.simpleName
|
||||
Terrarum.ingame!!.getActorByID(id).actorValue[av] +
|
||||
" $ccO" +
|
||||
Terrarum.ingame!!.getActorByID(id).actorValue[av]!!.javaClass.simpleName
|
||||
)
|
||||
println("$id.$av = " +
|
||||
TerrarumGDX.ingame!!.getActorByID(id).actorValue[av] +
|
||||
Terrarum.ingame!!.getActorByID(id).actorValue[av] +
|
||||
" " +
|
||||
TerrarumGDX.ingame!!.getActorByID(id).actorValue[av]!!.javaClass.simpleName
|
||||
Terrarum.ingame!!.getActorByID(id).actorValue[av]!!.javaClass.simpleName
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.Factionable
|
||||
import net.torvald.terrarum.gameactors.Player
|
||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase
|
||||
@@ -23,7 +23,7 @@ internal object GetFactioning : ConsoleCommand {
|
||||
val error = Error()
|
||||
|
||||
fun printOutFactioning(id: Int) {
|
||||
val a = TerrarumGDX.ingame!!.getActorByID(id)
|
||||
val a = Terrarum.ingame!!.getActorByID(id)
|
||||
if (a is Factionable) {
|
||||
Echo("$ccW== Faction assignment for $ccY${if (id == Player.PLAYER_REF_ID) "player" else id.toString()} $ccW==")
|
||||
println("[GetFactioning] == Faction assignment for '${if (id == Player.PLAYER_REF_ID) "player" else id.toString()}' ==")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-22.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-20.
|
||||
@@ -8,7 +8,7 @@ import net.torvald.terrarum.TerrarumGDX
|
||||
internal object GetTime : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
|
||||
val worldTime = TerrarumGDX.ingame!!.world.time
|
||||
val worldTime = Terrarum.ingame!!.world.time
|
||||
Echo(worldTime.getFormattedTime())
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonElement
|
||||
|
||||
import java.io.BufferedWriter
|
||||
import java.io.FileWriter
|
||||
@@ -14,14 +13,14 @@ import java.io.IOException
|
||||
internal object GsonTest : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
val avelem = Gson().toJsonTree(TerrarumGDX.ingame!!.player)
|
||||
val avelem = Gson().toJsonTree(Terrarum.ingame!!.player)
|
||||
|
||||
val jsonString = avelem.toString()
|
||||
|
||||
val bufferedWriter: BufferedWriter
|
||||
val writer: FileWriter
|
||||
try {
|
||||
writer = FileWriter(TerrarumGDX.defaultDir + "/Exports/" + args[1] + ".json")
|
||||
writer = FileWriter(Terrarum.defaultDir + "/Exports/" + args[1] + ".json")
|
||||
bufferedWriter = BufferedWriter(writer)
|
||||
|
||||
bufferedWriter.write(jsonString)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.gameactors.ActorInventory
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.Player
|
||||
import net.torvald.terrarum.gameactors.Pocketed
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
@@ -11,7 +10,7 @@ import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
*/
|
||||
internal object Inventory : ConsoleCommand {
|
||||
|
||||
private var target: Pocketed? = TerrarumGDX.ingame!!.player
|
||||
private var target: Pocketed? = Terrarum.ingame!!.player
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 1) {
|
||||
@@ -46,7 +45,7 @@ internal object Inventory : ConsoleCommand {
|
||||
}
|
||||
|
||||
private fun setTarget(actorRefId: Int = Player.PLAYER_REF_ID) {
|
||||
val actor = TerrarumGDX.ingame!!.getActorByID(actorRefId)
|
||||
val actor = Terrarum.ingame!!.getActorByID(actorRefId)
|
||||
if (actor !is Pocketed) {
|
||||
EchoError("Cannot edit inventory of incompatible actor: $actor")
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
|
||||
/**
|
||||
@@ -11,7 +11,7 @@ internal object KillActor : ConsoleCommand {
|
||||
if (args.size == 2) {
|
||||
try {
|
||||
val actorid = args[1].toInt()
|
||||
TerrarumGDX.ingame!!.removeActor(actorid)
|
||||
Terrarum.ingame!!.removeActor(actorid)
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
EchoError("Wrong number input.")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-06-16.
|
||||
@@ -9,8 +9,8 @@ import net.torvald.terrarum.TerrarumGDX
|
||||
internal object Seed : ConsoleCommand {
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
Echo("Map$ccW: $ccG${TerrarumGDX.ingame!!.world.generatorSeed}")
|
||||
println("[seed] Map$ccW: $ccG${TerrarumGDX.ingame!!.world.generatorSeed}")
|
||||
Echo("Map$ccW: $ccG${Terrarum.ingame!!.world.generatorSeed}")
|
||||
println("[seed] Map$ccW: $ccG${Terrarum.ingame!!.world.generatorSeed}")
|
||||
// TODO display randomiser seed
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-15.
|
||||
@@ -59,7 +59,7 @@ internal object SetAV : ConsoleCommand {
|
||||
return
|
||||
}
|
||||
|
||||
TerrarumGDX.ingame!!.player!!.actorValue[args[1]] = newValue
|
||||
Terrarum.ingame!!.player!!.actorValue[args[1]] = newValue
|
||||
Echo("${ccW}Set $ccM${args[1]} ${ccW}for ${ccY}player ${ccW}to $ccG$newValue")
|
||||
println("[SetAV] set ActorValue '${args[1]}' for player to '$newValue'.")
|
||||
}
|
||||
@@ -67,7 +67,7 @@ internal object SetAV : ConsoleCommand {
|
||||
try {
|
||||
val id = args[1].toInt()
|
||||
val newValue = parseAVInput(args[3])
|
||||
val actor = TerrarumGDX.ingame!!.getActorByID(id)
|
||||
val actor = Terrarum.ingame!!.getActorByID(id)
|
||||
|
||||
// check if av is number
|
||||
if (args[2].isNum()) {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.ui.Notification
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-23.
|
||||
@@ -25,7 +24,7 @@ internal object SetBulletin : ConsoleCommand {
|
||||
* @param message real message
|
||||
*/
|
||||
fun send(message: Array<String>) {
|
||||
TerrarumGDX.ingame!!.sendNotification(message)
|
||||
Terrarum.ingame!!.sendNotification(message)
|
||||
println("sent notifinator")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-02-17.
|
||||
@@ -20,7 +20,7 @@ internal object SetGlobalLightOverride : ConsoleCommand {
|
||||
val GL = LightmapRenderer.constructRGBFromInt(r, g, b)
|
||||
|
||||
lightOverride = true
|
||||
TerrarumGDX.ingame!!.world.globalLight = GL
|
||||
Terrarum.ingame!!.world.globalLight = GL
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
Echo("Wrong number input.")
|
||||
@@ -38,7 +38,7 @@ internal object SetGlobalLightOverride : ConsoleCommand {
|
||||
Echo("Range: 0-" + (LightmapRenderer.COLOUR_RANGE_SIZE - 1))
|
||||
}
|
||||
else {
|
||||
TerrarumGDX.ingame!!.world.globalLight = GL
|
||||
Terrarum.ingame!!.world.globalLight = GL
|
||||
}
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
import java.io.IOException
|
||||
|
||||
@@ -11,14 +11,14 @@ import java.io.IOException
|
||||
internal object SetLocale : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
val prevLocale = TerrarumGDX.gameLocale
|
||||
TerrarumGDX.gameLocale = args[1]
|
||||
val prevLocale = Terrarum.gameLocale
|
||||
Terrarum.gameLocale = args[1]
|
||||
try {
|
||||
Echo("Set locale to '" + TerrarumGDX.gameLocale + "'.")
|
||||
Echo("Set locale to '" + Terrarum.gameLocale + "'.")
|
||||
}
|
||||
catch (e: IOException) {
|
||||
Echo("could not read lang file.")
|
||||
TerrarumGDX.gameLocale = prevLocale
|
||||
Terrarum.gameLocale = prevLocale
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.ActorWithPhysics
|
||||
|
||||
/**
|
||||
@@ -10,10 +10,10 @@ internal object SetScale : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2 || args.size == 3) {
|
||||
try {
|
||||
val targetID = if (args.size == 3) args[1].toInt() else TerrarumGDX.ingame!!.player!!.referenceID
|
||||
val targetID = if (args.size == 3) args[1].toInt() else Terrarum.ingame!!.player!!.referenceID
|
||||
val scale = args[if (args.size == 3) 2 else 1].toDouble()
|
||||
|
||||
val target = TerrarumGDX.ingame!!.getActorByID(targetID)
|
||||
val target = Terrarum.ingame!!.getActorByID(targetID)
|
||||
|
||||
if (target !is ActorWithPhysics) {
|
||||
EchoError("Target is not ActorWithPhysics")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.gameworld.WorldTime
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-20.
|
||||
@@ -11,10 +11,10 @@ internal object SetTime : ConsoleCommand {
|
||||
if (args.size == 2) {
|
||||
val timeToSet = WorldTime.parseTime(args[1])
|
||||
|
||||
TerrarumGDX.ingame!!.world.time.setTimeOfToday(timeToSet)
|
||||
Terrarum.ingame!!.world.time.setTimeOfToday(timeToSet)
|
||||
|
||||
Echo("Set time to ${TerrarumGDX.ingame!!.world.time.todaySeconds} " +
|
||||
"(${TerrarumGDX.ingame!!.world.time.hours}h${formatMin(TerrarumGDX.ingame!!.world.time.minutes)})")
|
||||
Echo("Set time to ${Terrarum.ingame!!.world.time.todaySeconds} " +
|
||||
"(${Terrarum.ingame!!.world.time.hours}h${formatMin(Terrarum.ingame!!.world.time.minutes)})")
|
||||
}
|
||||
else {
|
||||
printUsage()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-20.
|
||||
@@ -11,11 +11,11 @@ internal object SetTimeDelta : ConsoleCommand {
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
TerrarumGDX.ingame!!.world.time.timeDelta = args[1].toInt()
|
||||
if (TerrarumGDX.ingame!!.world.time.timeDelta == 0)
|
||||
Terrarum.ingame!!.world.time.timeDelta = args[1].toInt()
|
||||
if (Terrarum.ingame!!.world.time.timeDelta == 0)
|
||||
Echo("時間よ止まれ!ザ・ワルド!!")
|
||||
else
|
||||
Echo("Set time delta to ${TerrarumGDX.ingame!!.world.time.timeDelta}")
|
||||
Echo("Set time delta to ${Terrarum.ingame!!.world.time.timeDelta}")
|
||||
}
|
||||
else {
|
||||
printUsage()
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import net.torvald.terrarum.gameactors.PhysTestBall
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||
import org.dyn4j.geometry.Vector2
|
||||
|
||||
@@ -12,8 +11,8 @@ import org.dyn4j.geometry.Vector2
|
||||
internal object SpawnPhysTestBall : ConsoleCommand {
|
||||
@Throws(Exception::class)
|
||||
override fun execute(args: Array<String>) {
|
||||
val mouseX = TerrarumGDX.mouseX
|
||||
val mouseY = TerrarumGDX.mouseY
|
||||
val mouseX = Terrarum.mouseX
|
||||
val mouseY = Terrarum.mouseY
|
||||
|
||||
if (args.size >= 3) {
|
||||
val elasticity = args[1].toDouble()
|
||||
@@ -29,7 +28,7 @@ internal object SpawnPhysTestBall : ConsoleCommand {
|
||||
ball.elasticity = elasticity
|
||||
ball.applyForce(Vector2(xvel, yvel))
|
||||
|
||||
TerrarumGDX.ingame!!.addNewActor(ball)
|
||||
Terrarum.ingame!!.addNewActor(ball)
|
||||
}
|
||||
else if (args.size == 2) {
|
||||
val elasticity = args[1].toDouble()
|
||||
@@ -41,7 +40,7 @@ internal object SpawnPhysTestBall : ConsoleCommand {
|
||||
)
|
||||
ball.elasticity = elasticity
|
||||
|
||||
TerrarumGDX.ingame!!.addNewActor(ball)
|
||||
Terrarum.ingame!!.addNewActor(ball)
|
||||
}
|
||||
else {
|
||||
printUsage()
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.DecodeTapestry
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2017-01-14.
|
||||
@@ -16,7 +15,7 @@ internal object SpawnTapestry : ConsoleCommand {
|
||||
}
|
||||
|
||||
val tapestry = DecodeTapestry(File(args[1]))
|
||||
TerrarumGDX.ingame!!.addNewActor(tapestry)
|
||||
Terrarum.ingame!!.addNewActor(tapestry)
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.FixtureTikiTorch
|
||||
|
||||
/**
|
||||
@@ -9,9 +9,9 @@ import net.torvald.terrarum.gameactors.FixtureTikiTorch
|
||||
internal object SpawnTikiTorch : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
val torch = FixtureTikiTorch()
|
||||
torch.setPosition(TerrarumGDX.mouseX, TerrarumGDX.mouseY)
|
||||
torch.setPosition(Terrarum.mouseX, Terrarum.mouseY)
|
||||
|
||||
TerrarumGDX.ingame!!.addNewActor(torch)
|
||||
Terrarum.ingame!!.addNewActor(torch)
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.worlddrawer.FeaturesDrawer
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.ActorWithPhysics
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ internal object Teleport : ConsoleCommand {
|
||||
return
|
||||
}
|
||||
|
||||
TerrarumGDX.ingame!!.player!!.setPosition(x.toDouble(), y.toDouble())
|
||||
Terrarum.ingame!!.player!!.setPosition(x.toDouble(), y.toDouble())
|
||||
}
|
||||
else if (args.size == 4) {
|
||||
if (args[2].toLowerCase() != "to") {
|
||||
@@ -35,20 +35,20 @@ internal object Teleport : ConsoleCommand {
|
||||
try {
|
||||
val fromActorID = args[1].toInt()
|
||||
val targetActorID = if (args[3].toLowerCase() == "player")
|
||||
TerrarumGDX.ingame!!.player!!.referenceID
|
||||
Terrarum.ingame!!.player!!.referenceID
|
||||
else
|
||||
args[3].toInt()
|
||||
|
||||
// if from == target, ignore the action
|
||||
if (fromActorID == targetActorID) return
|
||||
|
||||
if (TerrarumGDX.ingame!!.getActorByID(fromActorID) !is ActorWithPhysics ||
|
||||
TerrarumGDX.ingame!!.getActorByID(targetActorID) !is ActorWithPhysics) {
|
||||
if (Terrarum.ingame!!.getActorByID(fromActorID) !is ActorWithPhysics ||
|
||||
Terrarum.ingame!!.getActorByID(targetActorID) !is ActorWithPhysics) {
|
||||
throw IllegalArgumentException()
|
||||
}
|
||||
else {
|
||||
fromActor = TerrarumGDX.ingame!!.getActorByID(fromActorID) as ActorWithPhysics
|
||||
targetActor = TerrarumGDX.ingame!!.getActorByID(targetActorID) as ActorWithPhysics
|
||||
fromActor = Terrarum.ingame!!.getActorByID(fromActorID) as ActorWithPhysics
|
||||
targetActor = Terrarum.ingame!!.getActorByID(targetActorID) as ActorWithPhysics
|
||||
}
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
@@ -79,11 +79,11 @@ internal object Teleport : ConsoleCommand {
|
||||
y = args[4].toInt() * FeaturesDrawer.TILE_SIZE + FeaturesDrawer.TILE_SIZE / 2
|
||||
val actorID = args[1].toInt()
|
||||
|
||||
if (TerrarumGDX.ingame!!.getActorByID(actorID) !is ActorWithPhysics) {
|
||||
if (Terrarum.ingame!!.getActorByID(actorID) !is ActorWithPhysics) {
|
||||
throw IllegalArgumentException()
|
||||
}
|
||||
else {
|
||||
actor = TerrarumGDX.ingame!!.getActorByID(actorID) as ActorWithPhysics
|
||||
actor = Terrarum.ingame!!.getActorByID(actorID) as ActorWithPhysics
|
||||
}
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-19.
|
||||
*/
|
||||
internal object ToggleNoClip : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
val status = TerrarumGDX.ingame!!.player!!.isNoClip()
|
||||
val status = Terrarum.ingame!!.player!!.isNoClip()
|
||||
|
||||
TerrarumGDX.ingame!!.player!!.setNoClip(!status)
|
||||
Terrarum.ingame!!.player!!.setNoClip(!status)
|
||||
Echo("Set no-clip status to " + (!status).toString())
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
|
||||
/**
|
||||
@@ -9,7 +9,7 @@ import net.torvald.terrarum.langpack.Lang
|
||||
internal object Version : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
|
||||
Echo("${TerrarumGDX.NAME} ${TerrarumGDX.VERSION_STRING}")
|
||||
Echo("${Terrarum.NAME} ${Terrarum.VERSION_STRING}")
|
||||
Echo("Polyglot language pack version ${Lang.POLYGLOT_VERSION}")
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-25.
|
||||
@@ -18,14 +18,14 @@ internal object Zoom : ConsoleCommand {
|
||||
return
|
||||
}
|
||||
|
||||
if (zoom < TerrarumGDX.ingame!!.ZOOM_MINIMUM) {
|
||||
zoom = TerrarumGDX.ingame!!.ZOOM_MINIMUM
|
||||
if (zoom < Terrarum.ingame!!.ZOOM_MINIMUM) {
|
||||
zoom = Terrarum.ingame!!.ZOOM_MINIMUM
|
||||
}
|
||||
else if (zoom > TerrarumGDX.ingame!!.ZOOM_MAXIMUM) {
|
||||
zoom = TerrarumGDX.ingame!!.ZOOM_MAXIMUM
|
||||
else if (zoom > Terrarum.ingame!!.ZOOM_MAXIMUM) {
|
||||
zoom = Terrarum.ingame!!.ZOOM_MAXIMUM
|
||||
}
|
||||
|
||||
TerrarumGDX.ingame!!.screenZoom = zoom
|
||||
Terrarum.ingame!!.screenZoom = zoom
|
||||
|
||||
System.gc()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user