mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 11:04:05 +09:00
sprites can be rendered across the world seam
This commit is contained in:
@@ -2,7 +2,7 @@ package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.console.EchoError
|
||||
@@ -22,7 +22,7 @@ internal object ExportMap : ConsoleCommand {
|
||||
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
val world = (Terrarum.ingame!!.world)
|
||||
val world = (INGAME.world)
|
||||
|
||||
if (args.size == 2) {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ internal object GetFaction : ConsoleCommand {
|
||||
val error = Error()
|
||||
|
||||
fun printOutFactioning(id: Int) {
|
||||
val a = Terrarum.ingame!!.getActorByID(id)
|
||||
val a = INGAME.getActorByID(id)
|
||||
if (a is Factionable) {
|
||||
Echo("$ccW== Faction assignment for $ccY${if (id == Terrarum.PLAYER_REF_ID) "player" else id.toString()} $ccW==")
|
||||
println("[GetFactioning] == Faction assignment for '${if (id == Terrarum.PLAYER_REF_ID) "player" else id.toString()}' ==")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.torvald.terrarum.console.Echo
|
||||
internal object GetTime : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
|
||||
val worldTime = (Terrarum.ingame!!.world).worldTime
|
||||
val worldTime = (INGAME.world).worldTime
|
||||
Echo(worldTime.getFormattedTime())
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ object ImportLayerData : ConsoleCommand {
|
||||
val layerData = ReadLayerDataZip(file)
|
||||
|
||||
|
||||
Terrarum.ingame!!.world = GameWorldExtension(1, layerData, 0, 0, 0) // FIXME null TIME_T for the (partial) test to pass
|
||||
Terrarum.ingame!!.actorNowPlaying?.setPosition(
|
||||
(Terrarum.ingame!!.world).spawnY * TILE_SIZED,
|
||||
(Terrarum.ingame!!.world).spawnX * TILE_SIZED
|
||||
INGAME.world = GameWorldExtension(1, layerData, 0, 0, 0) // FIXME null TIME_T for the (partial) test to pass
|
||||
INGAME.actorNowPlaying?.setPosition(
|
||||
(INGAME.world).spawnY * TILE_SIZED,
|
||||
(INGAME.world).spawnX * TILE_SIZED
|
||||
)
|
||||
|
||||
Echo("Successfully loaded ${args[1]}")*/
|
||||
|
||||
@@ -49,7 +49,7 @@ internal object Inventory : ConsoleCommand {
|
||||
}
|
||||
|
||||
private fun setTarget(actorRefId: Int = Terrarum.PLAYER_REF_ID) {
|
||||
val actor = Terrarum.ingame!!.getActorByID(actorRefId)
|
||||
val actor = INGAME.getActorByID(actorRefId)
|
||||
if (actor !is Pocketed) {
|
||||
EchoError("Cannot edit inventory of incompatible actor: $actor")
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.console.ConsoleAlias
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
@@ -16,7 +16,7 @@ internal object KillActor : ConsoleCommand {
|
||||
if (args.size == 2) {
|
||||
try {
|
||||
val actorid = args[1].toInt()
|
||||
Terrarum.ingame!!.removeActor(actorid)
|
||||
INGAME.removeActor(actorid)
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
EchoError("Wrong number input.")
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.ccG
|
||||
import net.torvald.terrarum.ccO
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.gameworld.BlockAddress
|
||||
import kotlin.reflect.full.memberProperties
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2021-08-26.
|
||||
@@ -14,7 +12,7 @@ import kotlin.reflect.full.memberProperties
|
||||
object PrintWorld : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
val w = Terrarum.ingame!!.world
|
||||
val w = INGAME.world
|
||||
|
||||
val field = w::class.java.getDeclaredField(args[1])
|
||||
val fieldAccessibility = field.isAccessible
|
||||
|
||||
@@ -11,8 +11,8 @@ import net.torvald.terrarum.console.Echo
|
||||
internal object Seed : ConsoleCommand {
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
Echo("Map$ccW: $ccG${(Terrarum.ingame!!.world).generatorSeed}")
|
||||
println("[seed] Map$ccW: $ccG${(Terrarum.ingame!!.world).generatorSeed}")
|
||||
Echo("Map$ccW: $ccG${(INGAME.world).generatorSeed}")
|
||||
println("[seed] Map$ccW: $ccG${(INGAME.world).generatorSeed}")
|
||||
// TODO display randomiser seed
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ internal object SetAV : ConsoleCommand {
|
||||
try {
|
||||
val id = args[1].toInt()
|
||||
val newValue = parseAVInput(args[3])
|
||||
val actor = Terrarum.ingame!!.getActorByID(id)
|
||||
val actor = INGAME.getActorByID(id)
|
||||
|
||||
// check if av is number
|
||||
if (args[2].isNum()) {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.console.EchoError
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2017-01-20.
|
||||
@@ -22,7 +23,7 @@ internal object SetScale : ConsoleCommand {
|
||||
val targetID = if (args.size == 3) args[1].toInt() else player.referenceID
|
||||
val scale = args[if (args.size == 3) 2 else 1].toDouble()
|
||||
|
||||
val target = Terrarum.ingame!!.getActorByID(targetID!!)
|
||||
val target = INGAME.getActorByID(targetID)
|
||||
|
||||
if (target !is ActorWithBody) {
|
||||
EchoError("Target is not ActorWBMovable")
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.PhysTestBall
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.PhysTestBall
|
||||
import org.dyn4j.geometry.Vector2
|
||||
|
||||
/**
|
||||
@@ -26,7 +27,7 @@ internal object SpawnPhysTestBall : ConsoleCommand {
|
||||
ball.elasticity = elasticity
|
||||
ball.applyForce(Vector2(xvel, yvel))
|
||||
|
||||
Terrarum.ingame!!.addNewActor(ball)
|
||||
INGAME.addNewActor(ball)
|
||||
}
|
||||
else if (args.size == 2) {
|
||||
val elasticity = args[1].toDouble()
|
||||
@@ -35,7 +36,7 @@ internal object SpawnPhysTestBall : ConsoleCommand {
|
||||
ball.setPosition(mouseX, mouseY)
|
||||
ball.elasticity = elasticity
|
||||
|
||||
Terrarum.ingame!!.addNewActor(ball)
|
||||
INGAME.addNewActor(ball)
|
||||
}
|
||||
else {
|
||||
printUsage()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
@@ -16,7 +17,7 @@ internal object SpawnPhysTestLunarLander : ConsoleCommand {
|
||||
|
||||
lander.setPosition(mouseX, mouseY)
|
||||
|
||||
Terrarum.ingame!!.addNewActor(lander)
|
||||
INGAME.addNewActor(lander)
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.DecodeTapestry
|
||||
@@ -17,7 +17,7 @@ internal object SpawnTapestry : ConsoleCommand {
|
||||
}
|
||||
|
||||
val tapestry = DecodeTapestry(File(args[1]))
|
||||
Terrarum.ingame!!.addNewActor(tapestry)
|
||||
INGAME.addNewActor(tapestry)
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.INGAME
|
||||
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
|
||||
|
||||
/**
|
||||
@@ -16,7 +16,7 @@ internal object SpawnTikiTorch : ConsoleCommand {
|
||||
val torch = FixtureTikiTorch()
|
||||
torch.setPosition(Terrarum.mouseX, Terrarum.mouseY)
|
||||
|
||||
Terrarum.ingame!!.addNewActor(torch)
|
||||
INGAME.addNewActor(torch)
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.INGAME
|
||||
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
|
||||
@@ -56,13 +56,13 @@ internal object Teleport : ConsoleCommand {
|
||||
// if from == target, ignore the action
|
||||
if (fromActorID == targetActorID) return
|
||||
|
||||
if (Terrarum.ingame!!.getActorByID(fromActorID) !is ActorWithBody ||
|
||||
Terrarum.ingame!!.getActorByID(targetActorID) !is ActorWithBody) {
|
||||
if (INGAME.getActorByID(fromActorID) !is ActorWithBody ||
|
||||
INGAME.getActorByID(targetActorID) !is ActorWithBody) {
|
||||
throw IllegalArgumentException()
|
||||
}
|
||||
else {
|
||||
fromActor = Terrarum.ingame!!.getActorByID(fromActorID) as ActorWithBody
|
||||
targetActor = Terrarum.ingame!!.getActorByID(targetActorID) as ActorWithBody
|
||||
fromActor = INGAME.getActorByID(fromActorID) as ActorWithBody
|
||||
targetActor = INGAME.getActorByID(targetActorID) as ActorWithBody
|
||||
}
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
@@ -93,11 +93,11 @@ internal object Teleport : ConsoleCommand {
|
||||
y = args[4].toInt() * TILE_SIZE + TILE_SIZE / 2
|
||||
val actorID = args[1].toInt()
|
||||
|
||||
if (Terrarum.ingame!!.getActorByID(actorID) !is ActorWithBody) {
|
||||
if (INGAME.getActorByID(actorID) !is ActorWithBody) {
|
||||
throw IllegalArgumentException()
|
||||
}
|
||||
else {
|
||||
actor = Terrarum.ingame!!.getActorByID(actorID) as ActorWithBody
|
||||
actor = INGAME.getActorByID(actorID) as ActorWithBody
|
||||
}
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
|
||||
@@ -20,14 +20,14 @@ internal object Zoom : ConsoleCommand {
|
||||
return
|
||||
}
|
||||
|
||||
if (zoom < Terrarum.ingame!!.ZOOM_MINIMUM) {
|
||||
zoom = Terrarum.ingame!!.ZOOM_MINIMUM
|
||||
if (zoom < INGAME.ZOOM_MINIMUM) {
|
||||
zoom = INGAME.ZOOM_MINIMUM
|
||||
}
|
||||
else if (zoom > Terrarum.ingame!!.ZOOM_MAXIMUM) {
|
||||
zoom = Terrarum.ingame!!.ZOOM_MAXIMUM
|
||||
else if (zoom > INGAME.ZOOM_MAXIMUM) {
|
||||
zoom = INGAME.ZOOM_MAXIMUM
|
||||
}
|
||||
|
||||
Terrarum.ingame!!.screenZoom = zoom
|
||||
INGAME.screenZoom = zoom
|
||||
|
||||
System.gc()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user