mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
sprites can be rendered across the world seam
This commit is contained in:
@@ -128,7 +128,7 @@ class SpriteAnimation(@Transient val parentActor: ActorWithBody) {
|
||||
|
||||
if (visible) {
|
||||
val region = textureRegion.get(currentFrame, currentRow)
|
||||
// batch.color = colorFilter
|
||||
batch.color = colorFilter
|
||||
|
||||
//val scale = parentActor.scale.toFloat() // wtf?
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
fun generateUniqueReferenceID(renderOrder: Actor.RenderOrder): ActorID {
|
||||
fun hasCollision(value: ActorID) =
|
||||
try {
|
||||
Terrarum.ingame!!.theGameHasActor(value) ||
|
||||
INGAME.theGameHasActor(value) ||
|
||||
value < ItemCodex.ACTORID_MIN ||
|
||||
value !in when (renderOrder) {
|
||||
Actor.RenderOrder.BEHIND -> Actor.RANGE_BEHIND
|
||||
|
||||
@@ -107,8 +107,8 @@ object BlockPropUtil {
|
||||
private fun getDynamicLumFunc(prop: BlockProp): Cvec {
|
||||
return when (prop.dynamicLuminosityFunction) {
|
||||
1 -> getTorchFlicker(prop)
|
||||
2 -> (Terrarum.ingame!!.world).globalLight.cpy() // current global light
|
||||
3 -> WeatherMixer.getGlobalLightOfTime(Terrarum.ingame!!.world, WorldTime.DAY_LENGTH / 2).cpy() // daylight at noon
|
||||
2 -> (INGAME.world).globalLight.cpy() // current global light
|
||||
3 -> WeatherMixer.getGlobalLightOfTime(INGAME.world, WorldTime.DAY_LENGTH / 2).cpy() // daylight at noon
|
||||
4 -> getSlowBreath(prop)
|
||||
5 -> getPulsate(prop)
|
||||
else -> prop.baseLumCol
|
||||
@@ -121,8 +121,8 @@ object BlockPropUtil {
|
||||
/*private fun getDynamicLumFuncByChan(baseLum: Float, type: Int, chan: Int): Float {
|
||||
return when (type) {
|
||||
1 -> getTorchFlicker(baseLum)
|
||||
2 -> (Terrarum.ingame!!.world).globalLight.cpy().mul(LightmapRenderer.DIV_FLOAT).getElem(chan) // current global light
|
||||
3 -> WeatherMixer.getGlobalLightOfTime(Terrarum.ingame!!.world, WorldTime.DAY_LENGTH / 2).cpy().mul(LightmapRenderer.DIV_FLOAT).getElem(chan) // daylight at noon
|
||||
2 -> (INGAME.world).globalLight.cpy().mul(LightmapRenderer.DIV_FLOAT).getElem(chan) // current global light
|
||||
3 -> WeatherMixer.getGlobalLightOfTime(INGAME.world, WorldTime.DAY_LENGTH / 2).cpy().mul(LightmapRenderer.DIV_FLOAT).getElem(chan) // daylight at noon
|
||||
4 -> getSlowBreath(baseLum)
|
||||
5 -> getPulsate(baseLum)
|
||||
else -> baseLum
|
||||
|
||||
@@ -2,13 +2,13 @@ package net.torvald.terrarum.blockstats
|
||||
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
||||
import net.torvald.terrarum.gameitem.ItemID
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.worlddrawer.BlocksDrawer
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-02-01.
|
||||
@@ -25,7 +25,7 @@ object BlockStats {
|
||||
|
||||
// Get stats on no-zoomed screen area. In other words, will behave as if screen zoom were 1.0
|
||||
// no matter how the screen is zoomed.
|
||||
val map = (Terrarum.ingame!!.world)
|
||||
val map = (INGAME.world)
|
||||
val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying
|
||||
if (player == null) return
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.debuggerapp.ActorValueTracker
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-12-29.
|
||||
@@ -19,8 +19,8 @@ internal object AVTracker : ConsoleCommand {
|
||||
try {
|
||||
val actorID = args[1].toInt()
|
||||
|
||||
if (Terrarum.ingame!!.theGameHasActor(actorID)) {
|
||||
jPanelInstances.add(ActorValueTracker(Terrarum.ingame!!.getActorByID(actorID)))
|
||||
if (INGAME.theGameHasActor(actorID)) {
|
||||
jPanelInstances.add(ActorValueTracker(INGAME.getActorByID(actorID)))
|
||||
}
|
||||
else {
|
||||
throw IllegalArgumentException()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.ui.ConsoleWindow
|
||||
import net.torvald.terrarum.INGAME
|
||||
import org.apache.commons.codec.digest.DigestUtils
|
||||
|
||||
/**
|
||||
@@ -40,7 +39,7 @@ internal object Authenticator : ConsoleCommand {
|
||||
Echo(msg)
|
||||
println("[Authenticator] " + msg)
|
||||
a = !a
|
||||
Terrarum.ingame!!.consoleHandler.reset()
|
||||
INGAME.consoleHandler.reset()
|
||||
}
|
||||
else {
|
||||
printUsage() // thou shalt not pass!
|
||||
|
||||
@@ -18,14 +18,14 @@ internal object Echo : ConsoleCommand {
|
||||
val sb = StringBuilder()
|
||||
for (ch in single_line) {
|
||||
if (ch == '\n') {
|
||||
Terrarum.ingame!!.consoleHandler.sendMessage(sb.toString())
|
||||
INGAME.consoleHandler.sendMessage(sb.toString())
|
||||
println("[Echo] $csiG$sb$csi0")
|
||||
sb.delete(0, sb.length - 1)
|
||||
}
|
||||
else
|
||||
sb.append(ch)
|
||||
}
|
||||
Terrarum.ingame!!.consoleHandler.sendMessage(sb.toString())
|
||||
INGAME.consoleHandler.sendMessage(sb.toString())
|
||||
println("[Echo] $csiG$sb$csi0")
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.ccR
|
||||
import net.torvald.terrarum.ui.ConsoleWindow
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-04-25.
|
||||
@@ -15,7 +14,7 @@ internal object EchoError : ConsoleCommand {
|
||||
}
|
||||
|
||||
fun execute(single_line: String) {
|
||||
(Terrarum.ingame!!.consoleHandler).sendMessage("$ccR$single_line")
|
||||
(INGAME.consoleHandler).sendMessage("$ccR$single_line")
|
||||
}
|
||||
|
||||
operator fun invoke(args: Array<String>) = execute(args)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.weather.WeatherMixer
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ internal object SetGlobalLightOverride : ConsoleCommand {
|
||||
val GL = Cvec(r, g, b, a)
|
||||
|
||||
WeatherMixer.globalLightOverridden = true
|
||||
(Terrarum.ingame!!.world).globalLight = GL
|
||||
(INGAME.world).globalLight = GL
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
Echo("Wrong number input.")
|
||||
|
||||
@@ -405,7 +405,7 @@ open class ActorWithBody : Actor {
|
||||
if (spriteGlow != null) spriteGlow!!.update(delta)
|
||||
|
||||
// make NoClip work for player
|
||||
if (true) {//this == Terrarum.ingame!!.actorNowPlaying) {
|
||||
if (true) {//this == INGAME.actorNowPlaying) {
|
||||
isNoSubjectToGrav = isNoClip || COLLISION_TEST_MODE
|
||||
isNoCollideWorld = isNoClip
|
||||
isNoSubjectToFluidResistance = isNoClip
|
||||
@@ -1616,62 +1616,29 @@ open class ActorWithBody : Actor {
|
||||
protected fun drawSpriteInGoodPosition(sprite: SpriteAnimation, batch: SpriteBatch) {
|
||||
if (world == null) return
|
||||
|
||||
//val offendingPad = world!!.width.times(TILE_SIZE) - WorldCamera.width - 1
|
||||
|
||||
val leftsidePadding = world!!.width.times(TILE_SIZE) - WorldCamera.width.ushr(1)
|
||||
val rightsidePadding = WorldCamera.width.ushr(1)
|
||||
val offsetX = (hitboxTranslateX * scale).toFloat()
|
||||
val offsetY = (sprite.cellHeight * scale - hitbox.height - hitboxTranslateY * scale - 1).toFloat()
|
||||
|
||||
val offendingPad = world!!.width.times(TILE_SIZE) - WorldCamera.width.ushr(1)
|
||||
drawBodyInGoodPosition(hitbox.startX.toFloat(), hitbox.startY.toFloat()) { x, y ->
|
||||
sprite.render(batch, x - offsetX, y - offsetY, scale.toFloat())
|
||||
}
|
||||
|
||||
val offsetX = hitboxTranslateX * scale
|
||||
val offsetY = sprite.cellHeight * scale - hitbox.height - hitboxTranslateY * scale - 1
|
||||
|
||||
// it would be great if you can eliminate the try-catch because it may hurt the performance when there's too many actors on screen to draw
|
||||
// try {
|
||||
/*if (Math.abs(WorldCamera.x - hitbox.startX) > App.scr.halfw) {
|
||||
sprite.render(batch,
|
||||
(hitbox.startX - offsetX).toFloat() + world!!.width * TILE_SIZEF,
|
||||
(hitbox.startY - offsetY).toFloat(),
|
||||
(scale).toFloat()
|
||||
)
|
||||
}
|
||||
else {
|
||||
sprite.render(batch,
|
||||
(hitbox.startX - offsetX).toFloat(),
|
||||
(hitbox.startY - offsetY).toFloat(),
|
||||
(scale).toFloat()
|
||||
)
|
||||
}*/
|
||||
batch.color = Color.WHITE
|
||||
sprite.render(batch,
|
||||
(hitbox.startX - offsetX).toFloat(),
|
||||
(hitbox.startY - offsetY).toFloat(),
|
||||
(scale).toFloat()
|
||||
)
|
||||
|
||||
batch.color = Color.BLUE
|
||||
sprite.render(batch,
|
||||
(hitbox.startX - offsetX).toFloat() - world!!.width * TILE_SIZEF,
|
||||
(hitbox.startY - offsetY).toFloat(),
|
||||
(scale).toFloat()
|
||||
)
|
||||
|
||||
batch.color = Color.GREEN
|
||||
sprite.render(batch,
|
||||
(hitbox.startX - offsetX).toFloat() + world!!.width * TILE_SIZEF,
|
||||
(hitbox.startY - offsetY).toFloat(),
|
||||
(scale).toFloat()
|
||||
)
|
||||
|
||||
|
||||
|
||||
// }
|
||||
// catch (e: UninitializedPropertyAccessException) {
|
||||
// printdbgerr(this, this.javaClass.simpleName)
|
||||
// printdbgerr(this, actorValue.getAsString(AVKey.NAME))
|
||||
// printdbgerr(this, if (this is HasAssembledSprite) this.animDescPath else "(not HasAssembledSprite)")
|
||||
// printdbgerr(this, e)
|
||||
// throw e
|
||||
// }
|
||||
/*if (WorldCamera.x >= offendingPad && hitbox.startX < WorldCamera.width) {
|
||||
sprite.render(batch,
|
||||
(hitbox.startX - offsetX).toFloat() + world!!.width * TILE_SIZEF,
|
||||
(hitbox.startY - offsetY).toFloat(),
|
||||
(scale).toFloat()
|
||||
)
|
||||
}
|
||||
else {
|
||||
sprite.render(batch,
|
||||
(hitbox.startX - offsetX).toFloat(),
|
||||
(hitbox.startY - offsetY).toFloat(),
|
||||
(scale).toFloat()
|
||||
)
|
||||
}*/
|
||||
}
|
||||
|
||||
override fun onActorValueChange(key: String, value: Any?) {
|
||||
@@ -1881,8 +1848,8 @@ open class ActorWithBody : Actor {
|
||||
private fun div16TruncateToMapWidth(x: Int): Int {
|
||||
if (x < 0)
|
||||
return 0
|
||||
else if (x >= Terrarum.ingame!!.world.width shl 4)
|
||||
return Terrarum.ingame!!.world.width - 1
|
||||
else if (x >= INGAME.world.width shl 4)
|
||||
return INGAME.world.width - 1
|
||||
else
|
||||
return x and 0x7FFFFFFF shr 4
|
||||
}
|
||||
@@ -1890,8 +1857,8 @@ open class ActorWithBody : Actor {
|
||||
private fun div16TruncateToMapHeight(y: Int): Int {
|
||||
if (y < 0)
|
||||
return 0
|
||||
else if (y >= Terrarum.ingame!!.world.height shl 4)
|
||||
return Terrarum.ingame!!.world.height - 1
|
||||
else if (y >= INGAME.world.height shl 4)
|
||||
return INGAME.world.height - 1
|
||||
else
|
||||
return y and 0x7FFFFFFF shr 4
|
||||
}
|
||||
@@ -1954,3 +1921,13 @@ open class ActorWithBody : Actor {
|
||||
}
|
||||
}
|
||||
|
||||
inline fun drawBodyInGoodPosition(startX: Float, startY: Float, drawFun: (x: Float, y: Float) -> Unit) {
|
||||
val offendingPad = INGAME.world.width.times(TerrarumAppConfiguration.TILE_SIZE) - WorldCamera.width - 1
|
||||
|
||||
if (WorldCamera.x >= offendingPad && startX < WorldCamera.width) {
|
||||
drawFun(startX + INGAME.world.width * TILE_SIZEF, startY)
|
||||
}
|
||||
else {
|
||||
drawFun(startX , startY)
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.gameactors.Actor
|
||||
import net.torvald.terrarum.gameactors.Hitbox
|
||||
import net.torvald.terrarum.gameactors.drawBodyInGoodPosition
|
||||
import org.dyn4j.geometry.Vector2
|
||||
|
||||
/**
|
||||
@@ -44,11 +45,11 @@ open class ParticleBase(renderOrder: Actor.RenderOrder, val despawnUponCollision
|
||||
lifetimeCounter += delta
|
||||
if (velocity.isZero ||
|
||||
// simple stuck check
|
||||
BlockCodex[(Terrarum.ingame!!.world).getTileFromTerrain(
|
||||
BlockCodex[(INGAME.world).getTileFromTerrain(
|
||||
hitbox.centeredX.div(TerrarumAppConfiguration.TILE_SIZE).floorInt(),
|
||||
hitbox.startY.div(TerrarumAppConfiguration.TILE_SIZE).floorInt()
|
||||
)].isSolid ||
|
||||
BlockCodex[(Terrarum.ingame!!.world).getTileFromTerrain(
|
||||
BlockCodex[(INGAME.world).getTileFromTerrain(
|
||||
hitbox.centeredX.div(TerrarumAppConfiguration.TILE_SIZE).floorInt(),
|
||||
hitbox.endY.div(TerrarumAppConfiguration.TILE_SIZE).floorInt()
|
||||
)].isSolid) {
|
||||
@@ -64,7 +65,7 @@ open class ParticleBase(renderOrder: Actor.RenderOrder, val despawnUponCollision
|
||||
|
||||
// gravity, winds, etc. (external forces)
|
||||
if (!isNoSubjectToGrav) {
|
||||
velocity.plusAssign((Terrarum.ingame!!.world).gravitation / dragCoefficient)
|
||||
velocity.plusAssign((INGAME.world).gravitation / dragCoefficient)
|
||||
}
|
||||
|
||||
|
||||
@@ -76,14 +77,18 @@ open class ParticleBase(renderOrder: Actor.RenderOrder, val despawnUponCollision
|
||||
open fun drawBody(batch: SpriteBatch) {
|
||||
if (!flagDespawn) {
|
||||
batch.color = drawColour
|
||||
batch.draw(body, hitbox.startX.toFloat(), hitbox.startY.toFloat(), hitbox.width.toFloat(), hitbox.height.toFloat())
|
||||
drawBodyInGoodPosition(hitbox.startX.toFloat(), hitbox.startY.toFloat()) { x, y ->
|
||||
batch.draw(body, x, y, hitbox.width.toFloat(), hitbox.height.toFloat())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open fun drawGlow(batch: SpriteBatch) {
|
||||
if (!flagDespawn && glow != null) {
|
||||
batch.color = drawColour
|
||||
batch.draw(glow, hitbox.startX.toFloat(), hitbox.startY.toFloat(), hitbox.width.toFloat(), hitbox.height.toFloat())
|
||||
drawBodyInGoodPosition(hitbox.startX.toFloat(), hitbox.startY.toFloat()) { x, y ->
|
||||
batch.draw(glow, x, y, hitbox.width.toFloat(), hitbox.height.toFloat())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ package net.torvald.terrarum.gameparticles
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.spriteanimation.SpriteAnimation
|
||||
import net.torvald.terrarum.gameactors.Actor
|
||||
import net.torvald.terrarum.gameactors.drawBodyInGoodPosition
|
||||
import net.torvald.terrarum.imagefont.TinyAlphNum
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
@@ -58,7 +58,9 @@ class ParticleVanishingText(val text: String, x: Double, y: Double, noCollision:
|
||||
if (!flagDespawn) {
|
||||
batch.color = drawColour
|
||||
lines.forEachIndexed { index, line ->
|
||||
TinyAlphNum.draw(batch, line, hitbox.startX.toFloat(), hitbox.startY.toFloat() + TinyAlphNum.H * index)
|
||||
drawBodyInGoodPosition(hitbox.startX.toFloat(), hitbox.startY.toFloat() + TinyAlphNum.H * index) { x, y ->
|
||||
TinyAlphNum.draw(batch, line, x, y )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,7 +103,9 @@ open class ParticleVanishingSprite(val sprite: TextureRegionPack, val delay: Flo
|
||||
override fun drawBody(batch: SpriteBatch) {
|
||||
if (!flagDespawn) {
|
||||
batch.color = drawColour
|
||||
batch.draw(sprite.get(frame, row), hitbox.startX.toFloat(), hitbox.startY.toFloat())
|
||||
drawBodyInGoodPosition(hitbox.startX.toFloat(), hitbox.startY.toFloat()) { x, y ->
|
||||
batch.draw(sprite.get(frame, row), x, y)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -438,7 +438,7 @@ object WorldSimulator {
|
||||
* @return List of FixtureBases, safe to cast into Electric
|
||||
*/
|
||||
private fun wiresimGetSourceBlocks(): List<FixtureBase> =
|
||||
Terrarum.ingame!!.actorContainerActive.filter {
|
||||
INGAME.actorContainerActive.filter {
|
||||
it is FixtureBase && it is Electric && it.inUpdateRange(world) && it.wireEmitterTypes.isNotEmpty()
|
||||
} as List<FixtureBase>
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class ActorValueTracker constructor() : JFrame() {
|
||||
actorValue = actor!!.actorValue
|
||||
}
|
||||
else if (actorIDField.text.isNotBlank()) {
|
||||
actor = Terrarum.ingame!!.getActorByID(actorIDField.text.toInt()) as ActorWithBody
|
||||
actor = INGAME.getActorByID(actorIDField.text.toInt()) as ActorWithBody
|
||||
actorValue = actor!!.actorValue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
||||
var isJumpDown = false; protected set
|
||||
var isJumpJustDown = false; protected set // TODO if jump key is held in current update frame
|
||||
protected inline val isGamer: Boolean
|
||||
get() = if (Terrarum.ingame == null) false else this == Terrarum.ingame!!.actorNowPlaying
|
||||
get() = if (Terrarum.ingame == null) false else this == INGAME.actorNowPlaying
|
||||
|
||||
private var jumpJustPressedLatched = false
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ open class FixtureBase : ActorWithBody, CuedByTerrainChange {
|
||||
this.hitbox.setFromWidthHeight(posX * TILE_SIZED, posY * TILE_SIZED, blockBox.width * TILE_SIZED, blockBox.height * TILE_SIZED)
|
||||
|
||||
// actually add this actor into the world
|
||||
Terrarum.ingame!!.addNewActor(this)
|
||||
INGAME.addNewActor(this)
|
||||
|
||||
|
||||
return true
|
||||
|
||||
@@ -81,7 +81,7 @@ internal class UIStorageChest : UICanvas(
|
||||
|
||||
override fun getNegotiator() = negotiator
|
||||
override fun getFixtureInventory(): FixtureInventory = chestInventory
|
||||
override fun getPlayerInventory(): FixtureInventory = Terrarum.ingame!!.actorNowPlaying!!.inventory
|
||||
override fun getPlayerInventory(): FixtureInventory = INGAME.actorNowPlaying!!.inventory
|
||||
|
||||
private lateinit var catBar: UIItemInventoryCatBar
|
||||
private lateinit var itemListChest: UIItemInventoryItemGrid
|
||||
@@ -151,7 +151,7 @@ internal class UIStorageChest : UICanvas(
|
||||
itemListPlayer = UIItemInventoryItemGrid(
|
||||
this,
|
||||
catBar,
|
||||
{ Terrarum.ingame!!.actorNowPlaying!!.inventory }, // literally a player's inventory
|
||||
{ INGAME.actorNowPlaying!!.inventory }, // literally a player's inventory
|
||||
INVENTORY_CELLS_OFFSET_X - halfSlotOffset + (listGap + UIItemInventoryElem.height) * 7,
|
||||
INVENTORY_CELLS_OFFSET_Y,
|
||||
6, CELLS_VRT,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.AIControlled
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
@@ -52,7 +53,7 @@ open class HumanoidNPC : ActorHumanoid, AIControlled, CanBeAnItem {
|
||||
try {
|
||||
// place the actor to the world
|
||||
this@HumanoidNPC.setPosition(Terrarum.mouseX, Terrarum.mouseY)
|
||||
Terrarum.ingame!!.addNewActor(this@HumanoidNPC)
|
||||
INGAME.addNewActor(this@HumanoidNPC)
|
||||
// successful
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
@@ -33,13 +34,13 @@ class PhysTestBall : ActorWithBody(RenderOrder.MIDDLE, PhysProperties.PHYSICS_OB
|
||||
)
|
||||
|
||||
it.circle(
|
||||
hitbox.startX.toFloat() + (Terrarum.ingame!!.world).width * TILE_SIZE - 1f,
|
||||
hitbox.startX.toFloat() + (INGAME.world).width * TILE_SIZE - 1f,
|
||||
hitbox.startY.toFloat() - 1f,
|
||||
hitbox.width.toFloat()
|
||||
)
|
||||
|
||||
it.circle(
|
||||
hitbox.startX.toFloat() - (Terrarum.ingame!!.world).width * TILE_SIZE - 1f,
|
||||
hitbox.startX.toFloat() - (INGAME.world).width * TILE_SIZE - 1f,
|
||||
hitbox.startY.toFloat() - 1f,
|
||||
hitbox.width.toFloat()
|
||||
)
|
||||
|
||||
@@ -83,7 +83,7 @@ open class ProjectileSimple : ActorWithBody, Luminous, Projectile {
|
||||
lifetimeCounter += delta
|
||||
if (walledTop || walledBottom || walledRight || walledLeft || lifetimeCounter >= lifetimeMax ||
|
||||
// stuck check
|
||||
BlockCodex[(Terrarum.ingame!!.world).getTileFromTerrain(feetPosTile.x, feetPosTile.y) ?: Block.STONE].isSolid
|
||||
BlockCodex[(INGAME.world).getTileFromTerrain(feetPosTile.x, feetPosTile.y) ?: Block.STONE].isSolid
|
||||
) {
|
||||
flagDespawn()
|
||||
}
|
||||
@@ -103,13 +103,13 @@ open class ProjectileSimple : ActorWithBody, Luminous, Projectile {
|
||||
/*batch.end()
|
||||
Terrarum.inShapeRenderer {
|
||||
// draw trail of solid colour (Terraria style maybe?)
|
||||
it.lineWidth = 2f * Terrarum.ingame!!.screenZoom
|
||||
it.lineWidth = 2f * INGAME.screenZoom
|
||||
g.drawGradientLine(
|
||||
hitbox.centeredX.toFloat() * Terrarum.ingame!!.screenZoom,
|
||||
hitbox.centeredY.toFloat() * Terrarum.ingame!!.screenZoom,
|
||||
hitbox.centeredX.toFloat() * INGAME.screenZoom,
|
||||
hitbox.centeredY.toFloat() * INGAME.screenZoom,
|
||||
displayColour,
|
||||
posPre.x.toFloat() * Terrarum.ingame!!.screenZoom,
|
||||
posPre.y.toFloat() * Terrarum.ingame!!.screenZoom,
|
||||
posPre.x.toFloat() * INGAME.screenZoom,
|
||||
posPre.y.toFloat() * INGAME.screenZoom,
|
||||
colourTail
|
||||
)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import net.torvald.terrarum.*
|
||||
class ThreadActorUpdate(val startIndex: Int, val endIndex: Int) : Callable<Unit> {
|
||||
override fun call() {
|
||||
for (i in startIndex..endIndex) {
|
||||
val it = Terrarum.ingame!!.actorContainerActive[i]
|
||||
val it = INGAME.actorContainerActive[i]
|
||||
it.update(App.UPDATE_RATE)
|
||||
|
||||
if (it is Pocketed) {
|
||||
|
||||
@@ -38,26 +38,26 @@ object PickaxeCore {
|
||||
// return false if hitting actors
|
||||
// ** below is commented out -- don't make actors obstruct the way of digging **
|
||||
/*var ret1 = true
|
||||
Terrarum.ingame!!.actorContainerActive.forEach {
|
||||
INGAME.actorContainerActive.forEach {
|
||||
if (it is ActorWBMovable && it.hIntTilewiseHitbox.intersects(mousePoint))
|
||||
ret1 = false // return is not allowed here
|
||||
}
|
||||
if (!ret1) return ret1*/
|
||||
|
||||
// return false if here's no tile
|
||||
if (Block.AIR == (Terrarum.ingame!!.world).getTileFromTerrain(mouseTileX, mouseTileY))
|
||||
if (Block.AIR == (INGAME.world).getTileFromTerrain(mouseTileX, mouseTileY))
|
||||
return false
|
||||
|
||||
// filter passed, do the job
|
||||
val swingDmgToFrameDmg = delta.toDouble() / actorvalue.getAsDouble(AVKey.ACTION_INTERVAL)!!
|
||||
|
||||
(Terrarum.ingame!!.world).inflictTerrainDamage(
|
||||
(INGAME.world).inflictTerrainDamage(
|
||||
mouseTileX, mouseTileY,
|
||||
Calculate.pickaxePower(player, item.material) * swingDmgToFrameDmg
|
||||
)?.let { tileBroken ->
|
||||
val drop = BlockCodex[tileBroken].drop
|
||||
if (drop.isNotBlank()) {
|
||||
Terrarum.ingame!!.addNewActor(DroppedItem(drop, mouseTileX * TILE_SIZE, mouseTileY * TILE_SIZE))
|
||||
INGAME.addNewActor(DroppedItem(drop, mouseTileX * TILE_SIZE, mouseTileY * TILE_SIZE))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class WireGraphDebugger(originalID: ItemID) : GameItem(originalID) {
|
||||
|
||||
sb.clear()
|
||||
|
||||
Terrarum.ingame!!.world.getAllWiringGraph(mx, my)?.forEach { (itemID, simCell) ->
|
||||
INGAME.world.getAllWiringGraph(mx, my)?.forEach { (itemID, simCell) ->
|
||||
if (sb.isNotEmpty()) sb.append('\n')
|
||||
|
||||
val connexionIcon = (simCell.cnx + 0xE0A0).toChar()
|
||||
@@ -57,7 +57,7 @@ class WireGraphDebugger(originalID: ItemID) : GameItem(originalID) {
|
||||
sb.append("$connexionIcon $wireName")
|
||||
sb.append("\nE: $emit")
|
||||
recv.forEach {
|
||||
val src = Terrarum.ingame!!.world.getWireEmitStateOf(it.src.x, it.src.y, itemID)!!
|
||||
val src = INGAME.world.getWireEmitStateOf(it.src.x, it.src.y, itemID)!!
|
||||
sb.append("\nR: $src $EMDASH d ${it.dist}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,7 @@ import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.TitleScreen
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_UI_HEIGHT
|
||||
@@ -86,7 +83,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
||||
full.handler.lockToggle()
|
||||
full.lockTransition()
|
||||
// save the game
|
||||
WriteSavegame(Terrarum.ingame!!.savegameArchive, File(App.defaultSaveDir, "${App.getTIME_T()}"), Terrarum.ingame!! as TerrarumIngame) {
|
||||
WriteSavegame(INGAME.savegameArchive, File(App.defaultSaveDir, "${App.getTIME_T()}"), Terrarum.ingame!! as TerrarumIngame) {
|
||||
// callback:
|
||||
System.gc()
|
||||
screen = 0
|
||||
|
||||
@@ -27,7 +27,7 @@ class UIInventoryFull(
|
||||
) : UICanvas(toggleKeyLiteral, toggleButtonLiteral, customPositioning, doNotWarnConstant) {
|
||||
|
||||
val actor: ActorHumanoid
|
||||
get() = Terrarum.ingame!!.actorNowPlaying!!
|
||||
get() = INGAME.actorNowPlaying!!
|
||||
|
||||
override var width: Int = App.scr.width
|
||||
override var height: Int = App.scr.height
|
||||
|
||||
@@ -34,7 +34,7 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
||||
private val minimapRerenderInterval = .5f
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
MinimapComposer.setWorld(Terrarum.ingame!!.world)
|
||||
MinimapComposer.setWorld(INGAME.world)
|
||||
MinimapComposer.update()
|
||||
minimapRerenderTimer += Gdx.graphics.deltaTime
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class UIItemInventoryEquippedView(
|
||||
|
||||
|
||||
// sprite
|
||||
val sprite = Terrarum.ingame!!.actorNowPlaying?.sprite
|
||||
val sprite = INGAME.actorNowPlaying?.sprite
|
||||
sprite?.let {
|
||||
blendNormal(batch)
|
||||
|
||||
@@ -119,7 +119,7 @@ class UIItemInventoryEquippedView(
|
||||
internal fun rebuild() {
|
||||
rebuildList = false
|
||||
|
||||
Terrarum.ingame!!.actorNowPlaying?.inventory?.let {
|
||||
INGAME.actorNowPlaying?.inventory?.let {
|
||||
// sort by equip position
|
||||
|
||||
// fill the grid from fastest index, make no gap in-between of slots
|
||||
|
||||
@@ -37,7 +37,7 @@ class UITierOneWatch() : UICanvas() {
|
||||
//get() = if (ELon) lcdLitColELon else lcdLitColELoff
|
||||
|
||||
private val worldTime: WorldTime
|
||||
get() = Terrarum.ingame!!.world.worldTime
|
||||
get() = INGAME.world.worldTime
|
||||
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
|
||||
@@ -63,8 +63,8 @@ class UIVitalMetre(
|
||||
|
||||
/*if (vitalGetterVal() != null && vitalGetterMax() != null && player != null) {
|
||||
g.translate(
|
||||
Terrarum.ingame!!.screenZoom * (player.centrePosPoint.x.toFloat() - (WorldCamera.x)),
|
||||
Terrarum.ingame!!.screenZoom * (player.centrePosPoint.y.toFloat() - (WorldCamera.y))
|
||||
INGAME.screenZoom * (player.centrePosPoint.x.toFloat() - (WorldCamera.x)),
|
||||
INGAME.screenZoom * (player.centrePosPoint.y.toFloat() - (WorldCamera.y))
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package net.torvald.terrarum.realestate
|
||||
|
||||
import net.torvald.terrarum.FactionCodex
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.Point2i
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameworld.BlockAddress
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
|
||||
@@ -48,7 +48,7 @@ object LandUtil {
|
||||
*/
|
||||
fun resolveOwner(id: Int): Any =
|
||||
if (id >= 0)
|
||||
Terrarum.ingame!!.getActorByID(id)
|
||||
INGAME.getActorByID(id)
|
||||
else
|
||||
FactionCodex.getFactionByID(id)
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ internal object WeatherMixer : RNGConsumer {
|
||||
)
|
||||
(Terrarum.ingame!! as TerrarumIngame).addParticle(rainParticle)
|
||||
}
|
||||
//globalLightNow.set(getGlobalLightOfTime((Terrarum.ingame!!.world).time.todaySeconds).mul(0.3f, 0.3f, 0.3f, 0.58f))
|
||||
//globalLightNow.set(getGlobalLightOfTime((INGAME.world).time.todaySeconds).mul(0.3f, 0.3f, 0.3f, 0.58f))
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user