mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 11:34: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()
|
||||
|
||||
|
||||
@@ -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))
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user