mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-17 00:56:07 +09:00
player is now nullable; wtf is calling Ingame 5 times?
This commit is contained in:
Binary file not shown.
@@ -13,6 +13,7 @@ import com.badlogic.gdx.graphics.glutils.ShaderProgram;
|
|||||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase;
|
import net.torvald.terrarumsansbitmap.gdx.GameFontBase;
|
||||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack;
|
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@@ -271,6 +272,11 @@ public class AppLoader implements ApplicationListener {
|
|||||||
@Override
|
@Override
|
||||||
public void dispose () {
|
public void dispose () {
|
||||||
if (screen != null) screen.hide();
|
if (screen != null) screen.hide();
|
||||||
|
|
||||||
|
System.out.println("Goodbye !");
|
||||||
|
|
||||||
|
// delete temp files
|
||||||
|
new File("./tmp_wenquanyi.tga").delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -726,10 +726,12 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
|
|||||||
/** The actor the game is currently allowing you to control.
|
/** The actor the game is currently allowing you to control.
|
||||||
*
|
*
|
||||||
* Most of the time it'd be the "player", but think about the case where you have possessed
|
* Most of the time it'd be the "player", but think about the case where you have possessed
|
||||||
* some random actor of the game. Now that actor is now playableActor, the actual gamer's avatar
|
* some random actor of the game. Now that actor is now actorNowPlaying, the actual gamer's avatar
|
||||||
* (reference ID of 0x91A7E2) (must) stay in the actorContainer, but it's not a playableActor.
|
* (reference ID of 0x91A7E2) (must) stay in the actorContainer, but it's not a actorNowPlaying.
|
||||||
|
*
|
||||||
|
* Nullability of this property is believed to be unavoidable (trust me!). I'm sorry for the inconvenience.
|
||||||
*/
|
*/
|
||||||
open lateinit var playableActor: ActorHumanoid
|
open var actorNowPlaying: ActorHumanoid? = null
|
||||||
|
|
||||||
val ACTORCONTAINER_INITIAL_SIZE = 64
|
val ACTORCONTAINER_INITIAL_SIZE = 64
|
||||||
val actorContainer = ArrayList<Actor>(ACTORCONTAINER_INITIAL_SIZE)
|
val actorContainer = ArrayList<Actor>(ACTORCONTAINER_INITIAL_SIZE)
|
||||||
@@ -810,7 +812,9 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
|
|||||||
* Any values behind the index will be automatically pushed to front.
|
* Any values behind the index will be automatically pushed to front.
|
||||||
* This is how remove function of [java.util.ArrayList] is defined.
|
* This is how remove function of [java.util.ArrayList] is defined.
|
||||||
*/
|
*/
|
||||||
open fun removeActor(actor: Actor) {
|
open fun removeActor(actor: Actor?) {
|
||||||
|
if (actor == null) return
|
||||||
|
|
||||||
val indexToDelete = actorContainer.binarySearch(actor.referenceID!!)
|
val indexToDelete = actorContainer.binarySearch(actor.referenceID!!)
|
||||||
if (indexToDelete >= 0) {
|
if (indexToDelete >= 0) {
|
||||||
actorContainer.removeAt(indexToDelete)
|
actorContainer.removeAt(indexToDelete)
|
||||||
@@ -820,7 +824,9 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
|
|||||||
/**
|
/**
|
||||||
* Check for duplicates, append actor and sort the list
|
* Check for duplicates, append actor and sort the list
|
||||||
*/
|
*/
|
||||||
open fun addNewActor(actor: Actor) {
|
open fun addNewActor(actor: Actor?) {
|
||||||
|
if (actor == null) return
|
||||||
|
|
||||||
if (theGameHasActor(actor.referenceID!!)) {
|
if (theGameHasActor(actor.referenceID!!)) {
|
||||||
throw Error("The actor $actor already exists in the game")
|
throw Error("The actor $actor already exists in the game")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,7 +137,11 @@ class UIItemInventoryElem(
|
|||||||
|
|
||||||
override fun keyDown(keycode: Int): Boolean {
|
override fun keyDown(keycode: Int): Boolean {
|
||||||
if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_1..Input.Keys.NUM_0) {
|
if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_1..Input.Keys.NUM_0) {
|
||||||
val inventory = (Terrarum.ingame!! as Ingame).playableActor.inventory
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
|
||||||
|
if (player == null) return false
|
||||||
|
|
||||||
|
val inventory = player.inventory
|
||||||
val slot = if (keycode == Input.Keys.NUM_0) 9 else keycode - Input.Keys.NUM_1
|
val slot = if (keycode == Input.Keys.NUM_0) 9 else keycode - Input.Keys.NUM_1
|
||||||
val currentSlotItem = inventory?.getQuickBar(slot)
|
val currentSlotItem = inventory?.getQuickBar(slot)
|
||||||
|
|
||||||
@@ -167,7 +171,9 @@ class UIItemInventoryElem(
|
|||||||
|
|
||||||
// equip da shit
|
// equip da shit
|
||||||
val itemEquipSlot = item!!.equipPosition
|
val itemEquipSlot = item!!.equipPosition
|
||||||
val player = (Terrarum.ingame!! as Ingame).playableActor
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
|
||||||
|
if (player == null) return false
|
||||||
|
|
||||||
if (item != player.inventory.itemEquipped.get(itemEquipSlot)) { // if this item is unequipped, equip it
|
if (item != player.inventory.itemEquipped.get(itemEquipSlot)) { // if this item is unequipped, equip it
|
||||||
player.equipItem(item!!)
|
player.equipItem(item!!)
|
||||||
|
|||||||
@@ -124,8 +124,10 @@ class UIItemInventoryElemSimple(
|
|||||||
if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_1..Input.Keys.NUM_0) {
|
if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_1..Input.Keys.NUM_0) {
|
||||||
println("keydown elemgrid")
|
println("keydown elemgrid")
|
||||||
|
|
||||||
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) return false
|
||||||
|
|
||||||
val inventory = (Terrarum.ingame!! as Ingame).playableActor.inventory
|
val inventory = player.inventory
|
||||||
val slot = if (keycode == Input.Keys.NUM_0) 9 else keycode - Input.Keys.NUM_1
|
val slot = if (keycode == Input.Keys.NUM_0) 9 else keycode - Input.Keys.NUM_1
|
||||||
val currentSlotItem = inventory.getQuickBar(slot)
|
val currentSlotItem = inventory.getQuickBar(slot)
|
||||||
|
|
||||||
@@ -157,7 +159,8 @@ class UIItemInventoryElemSimple(
|
|||||||
|
|
||||||
// equip da shit
|
// equip da shit
|
||||||
val itemEquipSlot = item!!.equipPosition
|
val itemEquipSlot = item!!.equipPosition
|
||||||
val player = (Terrarum.ingame!! as Ingame).playableActor
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) return false
|
||||||
|
|
||||||
if (item != player.inventory.itemEquipped.get(itemEquipSlot)) { // if this item is unequipped, equip it
|
if (item != player.inventory.itemEquipped.get(itemEquipSlot)) { // if this item is unequipped, equip it
|
||||||
player.equipItem(item!!)
|
player.equipItem(item!!)
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ object BlockStats {
|
|||||||
// Get stats on no-zoomed screen area. In other words, will behave as if screen zoom were 1.0
|
// 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.
|
// no matter how the screen is zoomed.
|
||||||
val map = (Terrarum.ingame!!.world)
|
val map = (Terrarum.ingame!!.world)
|
||||||
val player = (Terrarum.ingame!! as Ingame).playableActor
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) return
|
||||||
|
|
||||||
val renderWidth = FastMath.ceil(Terrarum.WIDTH.toFloat())
|
val renderWidth = FastMath.ceil(Terrarum.WIDTH.toFloat())
|
||||||
val renderHeight = FastMath.ceil(Terrarum.HEIGHT.toFloat())
|
val renderHeight = FastMath.ceil(Terrarum.HEIGHT.toFloat())
|
||||||
|
|||||||
@@ -39,7 +39,11 @@ abstract class Actor(val renderOrder: RenderOrder) : Comparable<Actor>, Runnable
|
|||||||
var actorValue = ActorValue(this)
|
var actorValue = ActorValue(this)
|
||||||
@Volatile var flagDespawn = false
|
@Volatile var flagDespawn = false
|
||||||
|
|
||||||
override fun equals(other: Any?) = referenceID == (other as Actor).referenceID
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (other == null) return false
|
||||||
|
|
||||||
|
return referenceID == (other as Actor).referenceID
|
||||||
|
}
|
||||||
override fun hashCode() = referenceID!!
|
override fun hashCode() = referenceID!!
|
||||||
override fun toString() =
|
override fun toString() =
|
||||||
if (actorValue.getAsString("name").isNullOrEmpty())
|
if (actorValue.getAsString("name").isNullOrEmpty())
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ open class ActorWBMovable(val world: GameWorld, renderOrder: RenderOrder, val im
|
|||||||
if (spriteGlow != null) spriteGlow!!.update(delta)
|
if (spriteGlow != null) spriteGlow!!.update(delta)
|
||||||
|
|
||||||
// make NoClip work for player
|
// make NoClip work for player
|
||||||
if (true) {//this == Terrarum.ingame!!.playableActor) {
|
if (true) {//this == Terrarum.ingame!!.actorNowPlaying) {
|
||||||
isNoSubjectToGrav = isNoClip || COLLISION_TEST_MODE
|
isNoSubjectToGrav = isNoClip || COLLISION_TEST_MODE
|
||||||
isNoCollideWorld = isNoClip
|
isNoCollideWorld = isNoClip
|
||||||
isNoSubjectToFluidResistance = isNoClip
|
isNoSubjectToFluidResistance = isNoClip
|
||||||
|
|||||||
@@ -41,14 +41,17 @@ class IngameController(val ingame: Ingame) : InputAdapter() {
|
|||||||
// Use item: assuming the player has only one effective grip (EquipPosition.HAND_GRIP)
|
// Use item: assuming the player has only one effective grip (EquipPosition.HAND_GRIP)
|
||||||
if (ingame.canPlayerControl) {
|
if (ingame.canPlayerControl) {
|
||||||
if (Gdx.input.isButtonPressed(Terrarum.getConfigInt("mouseprimary")) || Gdx.input.isButtonPressed(Terrarum.getConfigInt("mousesecondary"))) {
|
if (Gdx.input.isButtonPressed(Terrarum.getConfigInt("mouseprimary")) || Gdx.input.isButtonPressed(Terrarum.getConfigInt("mousesecondary"))) {
|
||||||
val itemOnGrip = ingame.playableActor.inventory.itemEquipped[GameItem.EquipPosition.HAND_GRIP]
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) return
|
||||||
|
|
||||||
|
val itemOnGrip = player.inventory.itemEquipped[GameItem.EquipPosition.HAND_GRIP]
|
||||||
|
|
||||||
itemOnGrip?.let {
|
itemOnGrip?.let {
|
||||||
if (Gdx.input.isButtonPressed(Terrarum.getConfigInt("mouseprimary"))) {
|
if (Gdx.input.isButtonPressed(Terrarum.getConfigInt("mouseprimary"))) {
|
||||||
ingame.playableActor.consumePrimary(it)
|
player.consumePrimary(it)
|
||||||
}
|
}
|
||||||
if (Gdx.input.isButtonPressed(Terrarum.getConfigInt("mousesecondary"))) {
|
if (Gdx.input.isButtonPressed(Terrarum.getConfigInt("mousesecondary"))) {
|
||||||
ingame.playableActor.consumeSecondary(it)
|
player.consumeSecondary(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,7 +66,7 @@ class IngameController(val ingame: Ingame) : InputAdapter() {
|
|||||||
override fun keyDown(keycode: Int): Boolean {
|
override fun keyDown(keycode: Int): Boolean {
|
||||||
|
|
||||||
if (ingame.canPlayerControl) {
|
if (ingame.canPlayerControl) {
|
||||||
ingame.playableActor.keyDown(keycode)
|
ingame.actorNowPlaying?.keyDown(keycode)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Terrarum.getConfigIntArray("keyquickselalt").contains(keycode)
|
if (Terrarum.getConfigIntArray("keyquickselalt").contains(keycode)
|
||||||
@@ -112,7 +115,7 @@ class IngameController(val ingame: Ingame) : InputAdapter() {
|
|||||||
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||||
// don't separate Player from this! Physics will break, esp. airborne manoeuvre
|
// don't separate Player from this! Physics will break, esp. airborne manoeuvre
|
||||||
if (ingame.canPlayerControl) {
|
if (ingame.canPlayerControl) {
|
||||||
val itemOnGrip = ingame.playableActor.inventory.itemEquipped[GameItem.EquipPosition.HAND_GRIP]
|
val itemOnGrip = ingame.actorNowPlaying?.inventory?.itemEquipped?.get(GameItem.EquipPosition.HAND_GRIP) ?: null
|
||||||
|
|
||||||
if (itemOnGrip != null) {
|
if (itemOnGrip != null) {
|
||||||
if (button == Terrarum.getConfigInt("mouseprimary")) {
|
if (button == Terrarum.getConfigInt("mouseprimary")) {
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ object ItemCodex {
|
|||||||
|
|
||||||
override fun primaryUse(delta: Float): Boolean {
|
override fun primaryUse(delta: Float): Boolean {
|
||||||
val mousePoint = Point2d(Terrarum.mouseTileX.toDouble(), Terrarum.mouseTileY.toDouble())
|
val mousePoint = Point2d(Terrarum.mouseTileX.toDouble(), Terrarum.mouseTileY.toDouble())
|
||||||
val actorvalue = ingame.playableActor.actorValue
|
val actorvalue = ingame.actorNowPlaying.actorValue
|
||||||
|
|
||||||
|
|
||||||
using = true
|
using = true
|
||||||
@@ -155,7 +155,7 @@ object ItemCodex {
|
|||||||
ingame.world.inflictTerrainDamage(
|
ingame.world.inflictTerrainDamage(
|
||||||
Terrarum.mouseTileX,
|
Terrarum.mouseTileX,
|
||||||
Terrarum.mouseTileY,
|
Terrarum.mouseTileY,
|
||||||
Calculate.pickaxePower(ingame.playableActor, material) * swingDmgToFrameDmg
|
Calculate.pickaxePower(ingame.actorNowPlaying, material) * swingDmgToFrameDmg
|
||||||
)
|
)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ object ItemCodex {
|
|||||||
override fun endPrimaryUse(delta: Float): Boolean {
|
override fun endPrimaryUse(delta: Float): Boolean {
|
||||||
using = false
|
using = false
|
||||||
// reset action timer to zero
|
// reset action timer to zero
|
||||||
ingame.playableActor.actorValue[AVKey.__ACTION_TIMER] = 0.0
|
ingame.actorNowPlaying.actorValue[AVKey.__ACTION_TIMER] = 0.0
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|||||||
@@ -2,12 +2,9 @@ package net.torvald.terrarum.modulebasegame
|
|||||||
|
|
||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.Texture
|
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
|
||||||
import net.torvald.terrarum.AppLoader
|
import net.torvald.terrarum.AppLoader
|
||||||
import net.torvald.terrarum.IngameInstance
|
import net.torvald.terrarum.IngameInstance
|
||||||
import net.torvald.terrarum.ModMgr
|
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
import net.torvald.terrarum.blockproperties.Block
|
import net.torvald.terrarum.blockproperties.Block
|
||||||
import net.torvald.terrarum.gameactors.*
|
import net.torvald.terrarum.gameactors.*
|
||||||
@@ -49,7 +46,7 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override var playableActor: ActorHumanoid = MovableWorldCamera(world)
|
override var actorNowPlaying: ActorHumanoid? = MovableWorldCamera(world)
|
||||||
|
|
||||||
val uiToolbox = UIBuildingMakerToolbox()
|
val uiToolbox = UIBuildingMakerToolbox()
|
||||||
val notifier = Notification()
|
val notifier = Notification()
|
||||||
@@ -104,7 +101,7 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
(Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height)
|
(Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height)
|
||||||
|
|
||||||
|
|
||||||
playableActor.setPosition(512 * 16.0, 149 * 16.0)
|
actorNowPlaying?.setPosition(512 * 16.0, 149 * 16.0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -153,10 +150,10 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
private fun updateGame(delta: Float) {
|
private fun updateGame(delta: Float) {
|
||||||
blockPointingCursor.update(delta)
|
blockPointingCursor.update(delta)
|
||||||
playableActor.update(delta)
|
actorNowPlaying?.update(delta)
|
||||||
uiContainer.forEach { it.update(delta) }
|
uiContainer.forEach { it.update(delta) }
|
||||||
|
|
||||||
WorldCamera.update(world, playableActor)
|
WorldCamera.update(world, actorNowPlaying)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderGame() {
|
private fun renderGame() {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import net.torvald.terrarum.gamecontroller.KeyToggler
|
|||||||
import net.torvald.terrarum.gameworld.GameWorld
|
import net.torvald.terrarum.gameworld.GameWorld
|
||||||
import net.torvald.terrarum.modulebasegame.gameworld.WorldSimulator
|
import net.torvald.terrarum.modulebasegame.gameworld.WorldSimulator
|
||||||
import net.torvald.terrarum.modulebasegame.weather.WeatherMixer
|
import net.torvald.terrarum.modulebasegame.weather.WeatherMixer
|
||||||
import net.torvald.terrarum.worlddrawer.BlocksDrawer
|
|
||||||
import net.torvald.terrarum.worlddrawer.FeaturesDrawer
|
import net.torvald.terrarum.worlddrawer.FeaturesDrawer
|
||||||
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
||||||
import net.torvald.terrarum.worlddrawer.WorldCamera
|
import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||||
@@ -24,14 +23,12 @@ import net.torvald.terrarum.worlddrawer.WorldCamera
|
|||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import java.util.concurrent.locks.ReentrantLock
|
import java.util.concurrent.locks.ReentrantLock
|
||||||
|
|
||||||
import net.torvald.random.HQRNG
|
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.AppLoader.printdbg
|
import net.torvald.terrarum.AppLoader.printdbg
|
||||||
import net.torvald.terrarum.modulebasegame.console.AVTracker
|
import net.torvald.terrarum.modulebasegame.console.AVTracker
|
||||||
import net.torvald.terrarum.modulebasegame.console.ActorsList
|
import net.torvald.terrarum.modulebasegame.console.ActorsList
|
||||||
import net.torvald.terrarum.console.Authenticator
|
import net.torvald.terrarum.console.Authenticator
|
||||||
import net.torvald.terrarum.console.SetGlobalLightOverride
|
import net.torvald.terrarum.console.SetGlobalLightOverride
|
||||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.*
|
import net.torvald.terrarum.modulebasegame.gameactors.*
|
||||||
import net.torvald.terrarum.modulebasegame.gameworld.GameWorldExtension
|
import net.torvald.terrarum.modulebasegame.gameworld.GameWorldExtension
|
||||||
import net.torvald.terrarum.modulebasegame.imagefont.Watch7SegMain
|
import net.torvald.terrarum.modulebasegame.imagefont.Watch7SegMain
|
||||||
@@ -53,9 +50,6 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
lateinit var historicalFigureIDBucket: ArrayList<Int>
|
lateinit var historicalFigureIDBucket: ArrayList<Int>
|
||||||
|
|
||||||
lateinit var gameworld: GameWorldExtension
|
|
||||||
|
|
||||||
lateinit var theRealGamer: IngamePlayer
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list of Actors that is sorted by Actors' referenceID
|
* list of Actors that is sorted by Actors' referenceID
|
||||||
@@ -150,6 +144,8 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
lateinit var gameLoadMode: GameLoadMode
|
lateinit var gameLoadMode: GameLoadMode
|
||||||
lateinit var gameLoadInfoPayload: Any
|
lateinit var gameLoadInfoPayload: Any
|
||||||
|
lateinit var gameworld: GameWorldExtension
|
||||||
|
lateinit var theRealGamer: IngamePlayer
|
||||||
|
|
||||||
enum class GameLoadMode {
|
enum class GameLoadMode {
|
||||||
CREATE_NEW, LOAD_FROM
|
CREATE_NEW, LOAD_FROM
|
||||||
@@ -189,6 +185,12 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// other worldgen options
|
// other worldgen options
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private fun setTheRealGamerFirstTime(actor: IngamePlayer) {
|
||||||
|
actorNowPlaying = actor
|
||||||
|
theRealGamer = actor
|
||||||
|
addNewActor(actorNowPlaying)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init instance by loading saved world
|
* Init instance by loading saved world
|
||||||
*/
|
*/
|
||||||
@@ -203,17 +205,12 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
gameworld = gameSaveData.world
|
gameworld = gameSaveData.world
|
||||||
world = gameworld
|
world = gameworld
|
||||||
historicalFigureIDBucket = gameSaveData.historicalFigureIDBucket
|
historicalFigureIDBucket = gameSaveData.historicalFigureIDBucket
|
||||||
theRealGamer = gameSaveData.realGamePlayer
|
setTheRealGamerFirstTime(gameSaveData.realGamePlayer)
|
||||||
playableActor = gameSaveData.realGamePlayer
|
|
||||||
addNewActor(playableActor)
|
|
||||||
|
|
||||||
|
|
||||||
// set the randomisers right
|
// set the randomisers right
|
||||||
RoguelikeRandomiser.loadFromSave(gameSaveData.rogueS0, gameSaveData.rogueS1)
|
RoguelikeRandomiser.loadFromSave(gameSaveData.rogueS0, gameSaveData.rogueS1)
|
||||||
WeatherMixer.loadFromSave(gameSaveData.weatherS0, gameSaveData.weatherS1)
|
WeatherMixer.loadFromSave(gameSaveData.weatherS0, gameSaveData.weatherS1)
|
||||||
|
|
||||||
|
|
||||||
//initGame()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,6 +218,11 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
* Init instance by creating new world
|
* Init instance by creating new world
|
||||||
*/
|
*/
|
||||||
private fun enter(worldParams: NewWorldParameters) {
|
private fun enter(worldParams: NewWorldParameters) {
|
||||||
|
printdbg(this, "Ingame called")
|
||||||
|
Thread.currentThread().getStackTrace().forEach {
|
||||||
|
printdbg(this, "-> $it")
|
||||||
|
}
|
||||||
|
|
||||||
if (gameInitialised) {
|
if (gameInitialised) {
|
||||||
printdbg(this, "loaded successfully.")
|
printdbg(this, "loaded successfully.")
|
||||||
}
|
}
|
||||||
@@ -252,8 +254,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// test actor
|
// test actor
|
||||||
//addNewActor(PlayerBuilderCynthia())
|
//addNewActor(PlayerBuilderCynthia())
|
||||||
|
|
||||||
|
setTheRealGamerFirstTime(PlayerBuilderSigrid())
|
||||||
//initGame()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,7 +304,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
-uiInventoryPlayer.width,
|
-uiInventoryPlayer.width,
|
||||||
70
|
70
|
||||||
)*/
|
)*/
|
||||||
uiInventoryPlayer = UIInventoryFull(playableActor,
|
uiInventoryPlayer = UIInventoryFull(actorNowPlaying,
|
||||||
toggleKeyLiteral = Terrarum.getConfigInt("keyinventory")
|
toggleKeyLiteral = Terrarum.getConfigInt("keyinventory")
|
||||||
)
|
)
|
||||||
uiInventoryPlayer.setPosition(0, 0)
|
uiInventoryPlayer.setPosition(0, 0)
|
||||||
@@ -329,11 +330,11 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
//uiVitalItem.setAsAlwaysVisible()
|
//uiVitalItem.setAsAlwaysVisible()
|
||||||
|
|
||||||
// basic watch-style notification bar (temperature, new mail)
|
// basic watch-style notification bar (temperature, new mail)
|
||||||
uiWatchBasic = UIBasicNotifier(playableActor)
|
uiWatchBasic = UIBasicNotifier(actorNowPlaying)
|
||||||
uiWatchBasic.setAsAlwaysVisible()
|
uiWatchBasic.setAsAlwaysVisible()
|
||||||
uiWatchBasic.setPosition(Terrarum.WIDTH - uiWatchBasic.width, 0)
|
uiWatchBasic.setPosition(Terrarum.WIDTH - uiWatchBasic.width, 0)
|
||||||
|
|
||||||
uiWatchTierOne = UITierOneWatch(playableActor)
|
uiWatchTierOne = UITierOneWatch(actorNowPlaying)
|
||||||
uiWatchTierOne.setAsAlwaysVisible()
|
uiWatchTierOne.setAsAlwaysVisible()
|
||||||
uiWatchTierOne.setPosition(Terrarum.WIDTH - uiWatchTierOne.width, uiWatchBasic.height - 2)
|
uiWatchTierOne.setPosition(Terrarum.WIDTH - uiWatchTierOne.width, uiWatchBasic.height - 2)
|
||||||
|
|
||||||
@@ -421,15 +422,15 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
if (!gameFullyLoaded) {
|
if (!gameFullyLoaded) {
|
||||||
|
|
||||||
if (gameLoadMode == GameLoadMode.CREATE_NEW) {
|
if (gameLoadMode == GameLoadMode.CREATE_NEW) {
|
||||||
playableActor = PlayerBuilderSigrid()
|
actorNowPlaying = PlayerBuilderSigrid()
|
||||||
|
|
||||||
// go to spawn position
|
// go to spawn position
|
||||||
playableActor.setPosition(
|
actorNowPlaying?.setPosition(
|
||||||
world.spawnX * FeaturesDrawer.TILE_SIZE.toDouble(),
|
world.spawnX * FeaturesDrawer.TILE_SIZE.toDouble(),
|
||||||
world.spawnY * FeaturesDrawer.TILE_SIZE.toDouble()
|
world.spawnY * FeaturesDrawer.TILE_SIZE.toDouble()
|
||||||
)
|
)
|
||||||
|
|
||||||
addNewActor(playableActor)
|
addNewActor(actorNowPlaying)
|
||||||
}
|
}
|
||||||
|
|
||||||
postInit()
|
postInit()
|
||||||
@@ -505,7 +506,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
BlockPropUtil.dynamicLumFuncTickClock()
|
BlockPropUtil.dynamicLumFuncTickClock()
|
||||||
world.updateWorldTime(delta)
|
world.updateWorldTime(delta)
|
||||||
//WorldSimulator(player, delta)
|
//WorldSimulator(player, delta)
|
||||||
WeatherMixer.update(delta, playableActor)
|
WeatherMixer.update(delta, actorNowPlaying)
|
||||||
BlockStats.update()
|
BlockStats.update()
|
||||||
if (!(CommandDict["setgl"] as SetGlobalLightOverride).lightOverride)
|
if (!(CommandDict["setgl"] as SetGlobalLightOverride).lightOverride)
|
||||||
gameworld.globalLight = WeatherMixer.globalLightNow
|
gameworld.globalLight = WeatherMixer.globalLightNow
|
||||||
@@ -515,7 +516,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// camera-related updates //
|
// camera-related updates //
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
FeaturesDrawer.update(delta)
|
FeaturesDrawer.update(delta)
|
||||||
WorldCamera.update(gameworld, playableActor)
|
WorldCamera.update(gameworld, actorNowPlaying)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -558,7 +559,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
actorsRenderMidTop,
|
actorsRenderMidTop,
|
||||||
actorsRenderFront,
|
actorsRenderFront,
|
||||||
particlesContainer,
|
particlesContainer,
|
||||||
playableActor,
|
actorNowPlaying,
|
||||||
uiContainer
|
uiContainer
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -566,7 +567,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
private fun repossessActor() {
|
private fun repossessActor() {
|
||||||
// check if currently pocessed actor is removed from game
|
// check if currently pocessed actor is removed from game
|
||||||
if (!theGameHasActor(playableActor)) {
|
if (!theGameHasActor(actorNowPlaying)) {
|
||||||
// re-possess canonical player
|
// re-possess canonical player
|
||||||
if (theGameHasActor(Terrarum.PLAYER_REF_ID))
|
if (theGameHasActor(Terrarum.PLAYER_REF_ID))
|
||||||
changePossession(Terrarum.PLAYER_REF_ID)
|
changePossession(Terrarum.PLAYER_REF_ID)
|
||||||
@@ -576,12 +577,12 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun changePossession(newActor: ActorHumanoid) {
|
private fun changePossession(newActor: ActorHumanoid) {
|
||||||
if (!theGameHasActor(playableActor)) {
|
if (!theGameHasActor(actorNowPlaying)) {
|
||||||
throw IllegalArgumentException("No such actor in the game: $newActor")
|
throw IllegalArgumentException("No such actor in the game: $newActor")
|
||||||
}
|
}
|
||||||
|
|
||||||
playableActor = newActor
|
actorNowPlaying = newActor
|
||||||
WorldSimulator(playableActor, Terrarum.deltaTime)
|
WorldSimulator(actorNowPlaying, Terrarum.deltaTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun changePossession(refid: Int) {
|
private fun changePossession(refid: Int) {
|
||||||
@@ -665,11 +666,11 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
ThreadParallel.startAll()
|
ThreadParallel.startAll()
|
||||||
|
|
||||||
playableActor.update(delta)
|
actorNowPlaying?.update(delta)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
actorContainer.forEach {
|
actorContainer.forEach {
|
||||||
if (it != playableActor) {
|
if (it != actorNowPlaying) {
|
||||||
it.update(delta)
|
it.update(delta)
|
||||||
|
|
||||||
if (it is Pocketed) {
|
if (it is Pocketed) {
|
||||||
@@ -682,7 +683,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
playableActor.update(delta)
|
actorNowPlaying?.update(delta)
|
||||||
//AmmoMeterProxy(player, uiVitalItem.UI as UIVitalMetre)
|
//AmmoMeterProxy(player, uiVitalItem.UI as UIVitalMetre)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -734,7 +735,9 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
* Any values behind the index will be automatically pushed to front.
|
* Any values behind the index will be automatically pushed to front.
|
||||||
* This is how remove function of [java.util.ArrayList] is defined.
|
* This is how remove function of [java.util.ArrayList] is defined.
|
||||||
*/
|
*/
|
||||||
override fun removeActor(actor: Actor) {
|
override fun removeActor(actor: Actor?) {
|
||||||
|
if (actor == null) return
|
||||||
|
|
||||||
if (actor.referenceID == theRealGamer.referenceID || actor.referenceID == 0x51621D) // do not delete this magic
|
if (actor.referenceID == theRealGamer.referenceID || actor.referenceID == 0x51621D) // do not delete this magic
|
||||||
throw RuntimeException("Attempted to remove player.")
|
throw RuntimeException("Attempted to remove player.")
|
||||||
val indexToDelete = actorContainer.binarySearch(actor.referenceID!!)
|
val indexToDelete = actorContainer.binarySearch(actor.referenceID!!)
|
||||||
@@ -769,7 +772,9 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
/**
|
/**
|
||||||
* Check for duplicates, append actor and sort the list
|
* Check for duplicates, append actor and sort the list
|
||||||
*/
|
*/
|
||||||
override fun addNewActor(actor: Actor) {
|
override fun addNewActor(actor: Actor?) {
|
||||||
|
if (actor == null) return
|
||||||
|
|
||||||
if (theGameHasActor(actor.referenceID!!)) {
|
if (theGameHasActor(actor.referenceID!!)) {
|
||||||
throw Error("The actor $actor already exists in the game")
|
throw Error("The actor $actor already exists in the game")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ internal object AVTracker : ConsoleCommand {
|
|||||||
|
|
||||||
override fun execute(args: Array<String>) {
|
override fun execute(args: Array<String>) {
|
||||||
if (args.size < 2) {
|
if (args.size < 2) {
|
||||||
jPanelInstances.add(ActorValueTracker((Terrarum.ingame!! as Ingame).playableActor))
|
jPanelInstances.add(ActorValueTracker((Terrarum.ingame!! as Ingame).actorNowPlaying))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -15,8 +15,11 @@ internal object ExportAV : ConsoleCommand {
|
|||||||
override fun execute(args: Array<String>) {
|
override fun execute(args: Array<String>) {
|
||||||
if (args.size == 2) {
|
if (args.size == 2) {
|
||||||
try {
|
try {
|
||||||
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) return
|
||||||
|
|
||||||
JsonWriter.writeToFile(
|
JsonWriter.writeToFile(
|
||||||
(Terrarum.ingame!! as Ingame).playableActor.actorValue,
|
player.actorValue,
|
||||||
Terrarum.defaultDir + "/Exports/" + args[1] + ".json")
|
Terrarum.defaultDir + "/Exports/" + args[1] + ".json")
|
||||||
|
|
||||||
Echo("ExportAV: exported to " + args[1] + ".json")
|
Echo("ExportAV: exported to " + args[1] + ".json")
|
||||||
|
|||||||
@@ -15,11 +15,13 @@ internal object GetAV : ConsoleCommand {
|
|||||||
override fun execute(args: Array<String>) {
|
override fun execute(args: Array<String>) {
|
||||||
try {
|
try {
|
||||||
val ingame = Terrarum.ingame!! as Ingame
|
val ingame = Terrarum.ingame!! as Ingame
|
||||||
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) return
|
||||||
|
|
||||||
|
|
||||||
if (args.size == 1 && ingame.playableActor != null) {
|
if (args.size == 1 && player != null) {
|
||||||
// print all actorvalue of player
|
// print all actorvalue of player
|
||||||
val av = ingame.playableActor.actorValue
|
val av = player.actorValue
|
||||||
val keyset = av.keySet
|
val keyset = av.keySet
|
||||||
|
|
||||||
Echo("$ccW== ActorValue list for ${ccY}player $ccW==")
|
Echo("$ccW== ActorValue list for ${ccY}player $ccW==")
|
||||||
@@ -36,15 +38,15 @@ internal object GetAV : ConsoleCommand {
|
|||||||
// check if args[1] is number or not
|
// check if args[1] is number or not
|
||||||
if (!args[1].isNum()) { // args[1] is ActorValue name
|
if (!args[1].isNum()) { // args[1] is ActorValue name
|
||||||
Echo("${ccW}player.$ccM${args[1]} $ccW= " +
|
Echo("${ccW}player.$ccM${args[1]} $ccW= " +
|
||||||
ccG +
|
ccG +
|
||||||
ingame.playableActor.actorValue[args[1]] +
|
player.actorValue[args[1]] +
|
||||||
" $ccO" +
|
" $ccO" +
|
||||||
ingame.playableActor.actorValue[args[1]]!!.javaClass.simpleName
|
player.actorValue[args[1]]!!.javaClass.simpleName
|
||||||
)
|
)
|
||||||
println("[GetAV] player.${args[1]} = " +
|
println("[GetAV] player.${args[1]} = " +
|
||||||
ingame.playableActor.actorValue[args[1]] +
|
player.actorValue[args[1]] +
|
||||||
" " +
|
" " +
|
||||||
ingame.playableActor.actorValue[args[1]]!!.javaClass.simpleName
|
player.actorValue[args[1]]!!.javaClass.simpleName
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import java.io.IOException
|
|||||||
internal object GsonTest : ConsoleCommand {
|
internal object GsonTest : ConsoleCommand {
|
||||||
override fun execute(args: Array<String>) {
|
override fun execute(args: Array<String>) {
|
||||||
if (args.size == 2) {
|
if (args.size == 2) {
|
||||||
val avelem = Gson().toJsonTree((Terrarum.ingame!! as Ingame).playableActor)
|
val avelem = Gson().toJsonTree((Terrarum.ingame!! as Ingame).actorNowPlaying)
|
||||||
|
|
||||||
val jsonString = avelem.toString()
|
val jsonString = avelem.toString()
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ object ImportLayerData : ConsoleCommand {
|
|||||||
//val fis = GZIPInputStream(FileInputStream(args[1])) // this gzip is kaput
|
//val fis = GZIPInputStream(FileInputStream(args[1])) // this gzip is kaput
|
||||||
val fis = FileInputStream(args[1])
|
val fis = FileInputStream(args[1])
|
||||||
(Terrarum.ingame!!.world) = ReadLayerData(fis)
|
(Terrarum.ingame!!.world) = ReadLayerData(fis)
|
||||||
(Terrarum.ingame!! as Ingame).playableActor.setPosition(
|
(Terrarum.ingame!! as Ingame).actorNowPlaying?.setPosition(
|
||||||
(Terrarum.ingame!!.world).spawnY * FeaturesDrawer.TILE_SIZE.toDouble(),
|
(Terrarum.ingame!!.world).spawnY * FeaturesDrawer.TILE_SIZE.toDouble(),
|
||||||
(Terrarum.ingame!!.world).spawnX * FeaturesDrawer.TILE_SIZE.toDouble()
|
(Terrarum.ingame!!.world).spawnX * FeaturesDrawer.TILE_SIZE.toDouble()
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import net.torvald.terrarum.Terrarum
|
|||||||
import net.torvald.terrarum.console.ConsoleCommand
|
import net.torvald.terrarum.console.ConsoleCommand
|
||||||
import net.torvald.terrarum.console.Echo
|
import net.torvald.terrarum.console.Echo
|
||||||
import net.torvald.terrarum.console.EchoError
|
import net.torvald.terrarum.console.EchoError
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer
|
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
|
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
|
||||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||||
import net.torvald.terrarum.modulebasegame.Ingame
|
import net.torvald.terrarum.modulebasegame.Ingame
|
||||||
@@ -14,7 +13,7 @@ import net.torvald.terrarum.modulebasegame.Ingame
|
|||||||
*/
|
*/
|
||||||
internal object Inventory : ConsoleCommand {
|
internal object Inventory : ConsoleCommand {
|
||||||
|
|
||||||
private var target: Pocketed? = (Terrarum.ingame!! as Ingame).playableActor
|
private var target: Pocketed? = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
|
||||||
override fun execute(args: Array<String>) {
|
override fun execute(args: Array<String>) {
|
||||||
if (args.size == 1) {
|
if (args.size == 1) {
|
||||||
|
|||||||
@@ -63,9 +63,16 @@ internal object SetAV : ConsoleCommand {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
(Terrarum.ingame!! as Ingame).playableActor.actorValue[args[1]] = newValue
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
Echo("${ccW}Set $ccM${args[1]} ${ccW}for ${ccY}player ${ccW}to $ccG$newValue")
|
if (player == null) {
|
||||||
println("[SetAV] set ActorValue '${args[1]}' for player to '$newValue'.")
|
EchoError("Player does not exist")
|
||||||
|
println("[SetAV] Player does not exist")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
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'.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (args.size == 4) {
|
else if (args.size == 4) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ internal object SetScale : ConsoleCommand {
|
|||||||
override fun execute(args: Array<String>) {
|
override fun execute(args: Array<String>) {
|
||||||
if (args.size == 2 || args.size == 3) {
|
if (args.size == 2 || args.size == 3) {
|
||||||
try {
|
try {
|
||||||
val targetID = if (args.size == 3) args[1].toInt() else (Terrarum.ingame!! as Ingame).playableActor.referenceID
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) return
|
||||||
|
|
||||||
|
|
||||||
|
val targetID = if (args.size == 3) args[1].toInt() else player.referenceID
|
||||||
val scale = args[if (args.size == 3) 2 else 1].toDouble()
|
val scale = args[if (args.size == 3) 2 else 1].toDouble()
|
||||||
|
|
||||||
val target = Terrarum.ingame!!.getActorByID(targetID!!)
|
val target = Terrarum.ingame!!.getActorByID(targetID!!)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ internal object Teleport : ConsoleCommand {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
(Terrarum.ingame!! as Ingame).playableActor.setPosition(x.toDouble(), y.toDouble())
|
(Terrarum.ingame!! as Ingame).actorNowPlaying?.setPosition(x.toDouble(), y.toDouble())
|
||||||
}
|
}
|
||||||
else if (args.size == 4) {
|
else if (args.size == 4) {
|
||||||
if (args[2].toLowerCase() != "to") {
|
if (args[2].toLowerCase() != "to") {
|
||||||
@@ -38,8 +38,15 @@ internal object Teleport : ConsoleCommand {
|
|||||||
val targetActor: ActorWBMovable
|
val targetActor: ActorWBMovable
|
||||||
try {
|
try {
|
||||||
val fromActorID = args[1].toInt()
|
val fromActorID = args[1].toInt()
|
||||||
val targetActorID = if (args[3].toLowerCase() == "player")
|
val targetActorID = if (args[3].toLowerCase() == "player") {
|
||||||
(Terrarum.ingame!! as Ingame).playableActor.referenceID!!
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) {
|
||||||
|
EchoError("Player does not exist")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
else
|
||||||
|
player.referenceID!!
|
||||||
|
}
|
||||||
else
|
else
|
||||||
args[3].toInt()
|
args[3].toInt()
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,13 @@ import net.torvald.terrarum.modulebasegame.Ingame
|
|||||||
*/
|
*/
|
||||||
internal object ToggleNoClip : ConsoleCommand {
|
internal object ToggleNoClip : ConsoleCommand {
|
||||||
override fun execute(args: Array<String>) {
|
override fun execute(args: Array<String>) {
|
||||||
val status = (Terrarum.ingame!! as Ingame).playableActor.isNoClip
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) return
|
||||||
|
|
||||||
(Terrarum.ingame!! as Ingame).playableActor.isNoClip = !status
|
|
||||||
|
val status = player.isNoClip
|
||||||
|
|
||||||
|
player.isNoClip = !status
|
||||||
Echo("Set no-clip status to " + (!status).toString())
|
Echo("Set no-clip status to " + (!status).toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class ActorValueTracker constructor() : JFrame() {
|
|||||||
buttonChangeActor.addMouseListener(object : MouseAdapter() {
|
buttonChangeActor.addMouseListener(object : MouseAdapter() {
|
||||||
override fun mousePressed(e: MouseEvent?) {
|
override fun mousePressed(e: MouseEvent?) {
|
||||||
if (actorIDField.text.toLowerCase() == "player") {
|
if (actorIDField.text.toLowerCase() == "player") {
|
||||||
actor = (Terrarum.ingame!! as Ingame).playableActor
|
actor = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
actorValue = actor!!.actorValue
|
actorValue = actor!!.actorValue
|
||||||
}
|
}
|
||||||
else if (actorIDField.text.isNotBlank()) {
|
else if (actorIDField.text.isNotBlank()) {
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ open class ActorHumanoid(
|
|||||||
protected var isRightDown = false
|
protected var isRightDown = false
|
||||||
protected var isJumpDown = false
|
protected var isJumpDown = false
|
||||||
protected inline val isGamer: Boolean
|
protected inline val isGamer: Boolean
|
||||||
get() = if (Terrarum.ingame == null) false else this == Terrarum.ingame!!.playableActor
|
get() = if (Terrarum.ingame == null) false else this == Terrarum.ingame!!.actorNowPlaying
|
||||||
|
|
||||||
|
|
||||||
private val nullItem = object : GameItem() {
|
private val nullItem = object : GameItem() {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class ActorInventory(val actor: Pocketed, var maxCapacity: Int, var capacityMode
|
|||||||
if (item.originalID == Terrarum.PLAYER_REF_ID || item.originalID == 0x51621D) // do not delete this magic
|
if (item.originalID == Terrarum.PLAYER_REF_ID || item.originalID == 0x51621D) // do not delete this magic
|
||||||
throw IllegalArgumentException("Attempted to put human player into the inventory.")
|
throw IllegalArgumentException("Attempted to put human player into the inventory.")
|
||||||
if (((Terrarum.ingame as? Ingame)?.gameFullyLoaded ?: false) &&
|
if (((Terrarum.ingame as? Ingame)?.gameFullyLoaded ?: false) &&
|
||||||
(item.originalID == (Terrarum.ingame as? Ingame)?.playableActor?.referenceID))
|
(item.originalID == (Terrarum.ingame as? Ingame)?.actorNowPlaying?.referenceID))
|
||||||
throw IllegalArgumentException("Attempted to put active player into the inventory.")
|
throw IllegalArgumentException("Attempted to put active player into the inventory.")
|
||||||
if ((!item.stackable || item.dynamicID in ITEM_DYNAMIC) && count > 1)
|
if ((!item.stackable || item.dynamicID in ITEM_DYNAMIC) && count > 1)
|
||||||
throw IllegalArgumentException("Attempting to adding stack of item but the item is not stackable; item: $item, count: $count")
|
throw IllegalArgumentException("Attempting to adding stack of item but the item is not stackable; item: $item, count: $count")
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ import net.torvald.terrarum.gameactors.Controllable
|
|||||||
* @param actor : here you 'attach' the actor you wish to control
|
* @param actor : here you 'attach' the actor you wish to control
|
||||||
* Created by minjaesong on 2016-10-23.
|
* Created by minjaesong on 2016-10-23.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated("The ingame should discriminate 'theRealGamer' and 'actorNowPlaying'")
|
||||||
class PlayableActorDelegate(val actor: ActorHumanoid) {
|
class PlayableActorDelegate(val actor: ActorHumanoid) {
|
||||||
|
|
||||||
init {
|
/*init {
|
||||||
if (actor !is Controllable)
|
if (actor !is Controllable)
|
||||||
throw IllegalArgumentException("Player must be 'Controllable'!")
|
throw IllegalArgumentException("Player must be 'Controllable'!")
|
||||||
}
|
}
|
||||||
@@ -27,5 +28,5 @@ class PlayableActorDelegate(val actor: ActorHumanoid) {
|
|||||||
// LightmapRenderer.fireRecalculateEvent()
|
// LightmapRenderer.fireRecalculateEvent()
|
||||||
//}
|
//}
|
||||||
// not going to work: think about stationery tiki torches, global lights, etc
|
// not going to work: think about stationery tiki torches, global lights, etc
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,10 @@ class SmarterSlimes : ActorAI {
|
|||||||
|
|
||||||
|
|
||||||
// TEST: just target player
|
// TEST: just target player
|
||||||
val playerXPos = (Terrarum.ingame!! as Ingame).playableActor.centrePosPoint.x
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) return
|
||||||
|
|
||||||
|
val playerXPos = player.centrePosPoint.x
|
||||||
val thisXPos = actor.centrePosPoint.x
|
val thisXPos = actor.centrePosPoint.x
|
||||||
val xDiff = thisXPos - playerXPos
|
val xDiff = thisXPos - playerXPos
|
||||||
|
|
||||||
|
|||||||
@@ -34,11 +34,14 @@ class PickaxeGeneric(override val originalID: ItemID) : GameItem() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun primaryUse(delta: Float): Boolean {
|
override fun primaryUse(delta: Float): Boolean {
|
||||||
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) return false
|
||||||
|
|
||||||
val mouseTileX = Terrarum.mouseTileX
|
val mouseTileX = Terrarum.mouseTileX
|
||||||
val mouseTileY = Terrarum.mouseTileY
|
val mouseTileY = Terrarum.mouseTileY
|
||||||
|
|
||||||
val mousePoint = Point2d(mouseTileX.toDouble(), mouseTileY.toDouble())
|
val mousePoint = Point2d(mouseTileX.toDouble(), mouseTileY.toDouble())
|
||||||
val actorvalue = (Terrarum.ingame!! as Ingame).playableActor.actorValue
|
val actorvalue = player.actorValue
|
||||||
|
|
||||||
using = true
|
using = true
|
||||||
|
|
||||||
@@ -58,16 +61,19 @@ class PickaxeGeneric(override val originalID: ItemID) : GameItem() {
|
|||||||
|
|
||||||
(Terrarum.ingame!!.world).inflictTerrainDamage(
|
(Terrarum.ingame!!.world).inflictTerrainDamage(
|
||||||
mouseTileX, mouseTileY,
|
mouseTileX, mouseTileY,
|
||||||
Calculate.pickaxePower((Terrarum.ingame!! as Ingame).playableActor, material) * swingDmgToFrameDmg
|
Calculate.pickaxePower(player, material) * swingDmgToFrameDmg
|
||||||
)
|
)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun endPrimaryUse(delta: Float): Boolean {
|
override fun endPrimaryUse(delta: Float): Boolean {
|
||||||
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) return false
|
||||||
|
|
||||||
using = false
|
using = false
|
||||||
// reset action timer to zero
|
// reset action timer to zero
|
||||||
(Terrarum.ingame!! as Ingame).playableActor.actorValue.set(AVKey.__ACTION_TIMER, 0.0)
|
player.actorValue.set(AVKey.__ACTION_TIMER, 0.0)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,8 +38,8 @@ class UIPieMenu : UICanvas() {
|
|||||||
var selection: Int = -1
|
var selection: Int = -1
|
||||||
|
|
||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
if (selection >= 0)
|
if (selection >= 0 && (Terrarum.ingame!! as Ingame).actorNowPlaying != null)
|
||||||
(Terrarum.ingame!! as Ingame).playableActor.actorValue[AVKey.__PLAYER_QUICKSLOTSEL] =
|
(Terrarum.ingame!! as Ingame).actorNowPlaying!!.actorValue[AVKey.__PLAYER_QUICKSLOTSEL] =
|
||||||
selection % slotCount
|
selection % slotCount
|
||||||
|
|
||||||
|
|
||||||
@@ -83,7 +83,11 @@ class UIPieMenu : UICanvas() {
|
|||||||
|
|
||||||
|
|
||||||
// draw item
|
// draw item
|
||||||
val itemPair = (Terrarum.ingame!! as Ingame).playableActor.inventory.getQuickBar(i)
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) return // don't draw actual items
|
||||||
|
|
||||||
|
|
||||||
|
val itemPair = player.inventory.getQuickBar(i)
|
||||||
|
|
||||||
if (itemPair != null) {
|
if (itemPair != null) {
|
||||||
val itemImage = ItemCodex.getItemImage(itemPair.item)
|
val itemImage = ItemCodex.getItemImage(itemPair.item)
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ class UIQuickBar : UICanvas() {
|
|||||||
private val startPointY = ItemSlotImageBuilder.slotImage.tileH / 2
|
private val startPointY = ItemSlotImageBuilder.slotImage.tileH / 2
|
||||||
|
|
||||||
private var selection: Int
|
private var selection: Int
|
||||||
get() = (Terrarum.ingame!! as Ingame).playableActor.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL) ?: 0
|
get() = (Terrarum.ingame!! as Ingame).actorNowPlaying?.actorValue?.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL) ?: 0
|
||||||
set(value) { (Terrarum.ingame!! as Ingame).playableActor.actorValue.set(AVKey.__PLAYER_QUICKSLOTSEL, value.fmod(SLOT_COUNT)) }
|
set(value) { (Terrarum.ingame!! as Ingame).actorNowPlaying?.actorValue?.set(AVKey.__PLAYER_QUICKSLOTSEL, value.fmod(SLOT_COUNT)) }
|
||||||
|
|
||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,11 @@ class UIQuickBar : UICanvas() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// draw item
|
// draw item
|
||||||
val itemPair = (Terrarum.ingame!! as Ingame).playableActor.inventory.getQuickBar(i)
|
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||||
|
if (player == null) return // if player is null, don't draw actual items
|
||||||
|
|
||||||
|
|
||||||
|
val itemPair = player.inventory.getQuickBar(i)
|
||||||
|
|
||||||
if (itemPair != null) {
|
if (itemPair != null) {
|
||||||
val itemImage = ItemCodex.getItemImage(itemPair.item)
|
val itemImage = ItemCodex.getItemImage(itemPair.item)
|
||||||
|
|||||||
@@ -5,10 +5,14 @@ import com.badlogic.gdx.Input
|
|||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import net.torvald.random.HQRNG
|
||||||
import net.torvald.terrarum.AppLoader.printdbg
|
import net.torvald.terrarum.AppLoader.printdbg
|
||||||
import net.torvald.terrarum.AppLoader.printdbgerr
|
import net.torvald.terrarum.AppLoader.printdbgerr
|
||||||
|
import net.torvald.terrarum.LoadScreen
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
|
import net.torvald.terrarum.modulebasegame.Ingame
|
||||||
|
import net.torvald.terrarum.modulebasegame.gameactors.PlayerBuilderSigrid
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
import net.torvald.terrarum.ui.UIItemTextButton
|
import net.torvald.terrarum.ui.UIItemTextButton
|
||||||
import net.torvald.terrarum.ui.UIItemTextButtonList
|
import net.torvald.terrarum.ui.UIItemTextButtonList
|
||||||
@@ -100,6 +104,22 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
|
|||||||
throw NullPointerException("No parent node to return")
|
throw NullPointerException("No parent node to return")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (it.labelText.contains("Start New Random Game")) {
|
||||||
|
|
||||||
|
printdbg(this, 1)
|
||||||
|
|
||||||
|
val ingame = Ingame(Terrarum.batch)
|
||||||
|
ingame.gameLoadInfoPayload = Ingame.NewWorldParameters(2400, 800, HQRNG().nextLong())
|
||||||
|
ingame.gameLoadMode = Ingame.GameLoadMode.CREATE_NEW
|
||||||
|
|
||||||
|
printdbg(this, 2)
|
||||||
|
|
||||||
|
Terrarum.ingame = ingame
|
||||||
|
LoadScreen.screenToLoad = ingame
|
||||||
|
Terrarum.setScreen(LoadScreen)
|
||||||
|
|
||||||
|
printdbg(this, 3)
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
// check if target exists
|
// check if target exists
|
||||||
//println("current node: ${currentRemoConContents.data}")
|
//println("current node: ${currentRemoConContents.data}")
|
||||||
|
|||||||
@@ -84,7 +84,9 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
/**
|
/**
|
||||||
* Part of Ingame update
|
* Part of Ingame update
|
||||||
*/
|
*/
|
||||||
fun update(delta: Float, player: ActorWithBody) {
|
fun update(delta: Float, player: ActorWithBody?) {
|
||||||
|
if (player == null) return
|
||||||
|
|
||||||
currentWeather = weatherList[WEATHER_GENERIC]!![0]
|
currentWeather = weatherList[WEATHER_GENERIC]!![0]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,14 +32,16 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
private val world = ingame.world as GameWorldExtension
|
private val world = ingame.world as GameWorldExtension
|
||||||
|
|
||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
val player = ingame.playableActor
|
val player = ingame.actorNowPlaying
|
||||||
val hitbox = player.hitbox
|
val hitbox = player?.hitbox
|
||||||
|
|
||||||
xdelta = hitbox.canonicalX - prevPlayerX
|
if (hitbox != null) {
|
||||||
ydelta = hitbox.canonicalY - prevPlayerY
|
xdelta = hitbox.canonicalX - prevPlayerX
|
||||||
|
ydelta = hitbox.canonicalY - prevPlayerY
|
||||||
|
|
||||||
prevPlayerX = hitbox.canonicalX
|
prevPlayerX = hitbox.canonicalX
|
||||||
prevPlayerY = hitbox.canonicalY
|
prevPlayerY = hitbox.canonicalY
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||||
@@ -47,58 +49,61 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
fun Int.rawG() = this % LightmapRenderer.MUL_2 / LightmapRenderer.MUL
|
fun Int.rawG() = this % LightmapRenderer.MUL_2 / LightmapRenderer.MUL
|
||||||
fun Int.rawB() = this % LightmapRenderer.MUL
|
fun Int.rawB() = this % LightmapRenderer.MUL
|
||||||
|
|
||||||
val player = ingame.playableActor
|
val player = ingame.actorNowPlaying
|
||||||
|
|
||||||
batch.color = Color(0xFFEE88FF.toInt())
|
batch.color = Color(0xFFEE88FF.toInt())
|
||||||
|
|
||||||
val hitbox = player.hitbox
|
val hitbox = player?.hitbox
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First column
|
* First column
|
||||||
*/
|
*/
|
||||||
|
|
||||||
printLineColumn(batch, 1, 1, "startX "
|
if (player != null) {
|
||||||
+ ccG
|
|
||||||
+ "${hitbox?.startX}"
|
|
||||||
+ " ("
|
|
||||||
+ "${(hitbox?.startX?.div(FeaturesDrawer.TILE_SIZE))?.toInt()}"
|
|
||||||
+ ")")
|
|
||||||
printLineColumn(batch, 2, 1, "endX "
|
|
||||||
+ ccG
|
|
||||||
+ "${hitbox?.endX}"
|
|
||||||
+ " ("
|
|
||||||
+ "${(hitbox?.endX?.div(FeaturesDrawer.TILE_SIZE))?.toInt()}"
|
|
||||||
+ ")")
|
|
||||||
printLineColumn(batch, 1, 2, "startY "
|
|
||||||
+ ccG
|
|
||||||
+ "${hitbox?.startY}"
|
|
||||||
+ " ("
|
|
||||||
+ "${(hitbox?.startY?.div(FeaturesDrawer.TILE_SIZE))?.toInt()}"
|
|
||||||
+ ")")
|
|
||||||
printLineColumn(batch, 2, 2, "endY "
|
|
||||||
+ ccG
|
|
||||||
+ "${hitbox?.endY}"
|
|
||||||
+ " ("
|
|
||||||
+ "${(hitbox?.endY?.div(FeaturesDrawer.TILE_SIZE))?.toInt()}"
|
|
||||||
+ ")")
|
|
||||||
|
|
||||||
printLine(batch, 3, "veloX reported $ccG${player.externalForce?.x}")
|
printLineColumn(batch, 1, 1, "startX "
|
||||||
printLine(batch, 4, "veloY reported $ccG${player.externalForce?.y}")
|
+ ccG
|
||||||
|
+ "${hitbox?.startX}"
|
||||||
|
+ " ("
|
||||||
|
+ "${(hitbox?.startX?.div(FeaturesDrawer.TILE_SIZE))?.toInt()}"
|
||||||
|
+ ")")
|
||||||
|
printLineColumn(batch, 2, 1, "endX "
|
||||||
|
+ ccG
|
||||||
|
+ "${hitbox?.endX}"
|
||||||
|
+ " ("
|
||||||
|
+ "${(hitbox?.endX?.div(FeaturesDrawer.TILE_SIZE))?.toInt()}"
|
||||||
|
+ ")")
|
||||||
|
printLineColumn(batch, 1, 2, "startY "
|
||||||
|
+ ccG
|
||||||
|
+ "${hitbox?.startY}"
|
||||||
|
+ " ("
|
||||||
|
+ "${(hitbox?.startY?.div(FeaturesDrawer.TILE_SIZE))?.toInt()}"
|
||||||
|
+ ")")
|
||||||
|
printLineColumn(batch, 2, 2, "endY "
|
||||||
|
+ ccG
|
||||||
|
+ "${hitbox?.endY}"
|
||||||
|
+ " ("
|
||||||
|
+ "${(hitbox?.endY?.div(FeaturesDrawer.TILE_SIZE))?.toInt()}"
|
||||||
|
+ ")")
|
||||||
|
|
||||||
printLine(batch, 5, "p_WalkX $ccG${player.controllerMoveDelta?.x}")
|
printLine(batch, 3, "veloX reported $ccG${player.externalForce?.x}")
|
||||||
printLine(batch, 6, "p_WalkY $ccG${player.controllerMoveDelta?.y}")
|
printLine(batch, 4, "veloY reported $ccG${player.externalForce?.y}")
|
||||||
|
|
||||||
printLineColumn(batch, 2, 3, "veloX measured $ccG${xdelta}")
|
printLine(batch, 5, "p_WalkX $ccG${player.controllerMoveDelta?.x}")
|
||||||
printLineColumn(batch, 2, 4, "veloY measured $ccG${ydelta}")
|
printLine(batch, 6, "p_WalkY $ccG${player.controllerMoveDelta?.y}")
|
||||||
|
|
||||||
printLineColumn(batch, 1, 7,
|
printLineColumn(batch, 2, 3, "veloX measured $ccG${xdelta}")
|
||||||
"walled " +
|
printLineColumn(batch, 2, 4, "veloY measured $ccG${ydelta}")
|
||||||
"${if (player.walledLeft) "$ccR" else "$ccG"}L" +
|
|
||||||
"${if (player.walledBottom) "$ccR" else "$ccG"}${0x1F.toChar()}" +
|
printLineColumn(batch, 1, 7,
|
||||||
"${if (player.walledTop) "$ccR" else "$ccG"}${0x1E.toChar()}" +
|
"walled " +
|
||||||
"${if (player.walledRight) "$ccR" else "$ccG"}R" +
|
"${if (player.walledLeft) "$ccR" else "$ccG"}L" +
|
||||||
"${if (player.colliding) "$ccR" else "$ccG"}${0x08.toChar()}"
|
"${if (player.walledBottom) "$ccR" else "$ccG"}${0x1F.toChar()}" +
|
||||||
)
|
"${if (player.walledTop) "$ccR" else "$ccG"}${0x1E.toChar()}" +
|
||||||
|
"${if (player.walledRight) "$ccR" else "$ccG"}R" +
|
||||||
|
"${if (player.colliding) "$ccR" else "$ccG"}${0x08.toChar()}"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -138,10 +143,12 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
|
|
||||||
printLineColumn(batch, 2, 5, "Time $ccG${world.time.todaySeconds.toString().padStart(5, '0')}" +
|
printLineColumn(batch, 2, 5, "Time $ccG${world.time.todaySeconds.toString().padStart(5, '0')}" +
|
||||||
" (${world.time.getFormattedTime()})")
|
" (${world.time.getFormattedTime()})")
|
||||||
printLineColumn(batch, 2, 6, "Mass $ccG${player.mass}")
|
|
||||||
|
|
||||||
printLineColumn(batch, 2, 7, "noClip $ccG${player.isNoClip}")
|
if (player != null) {
|
||||||
|
printLineColumn(batch, 2, 6, "Mass $ccG${player.mass}")
|
||||||
|
|
||||||
|
printLineColumn(batch, 2, 7, "noClip $ccG${player.isNoClip}")
|
||||||
|
}
|
||||||
|
|
||||||
drawHistogram(batch, LightmapRenderer.histogram,
|
drawHistogram(batch, LightmapRenderer.histogram,
|
||||||
Terrarum.WIDTH - histogramW - 30,
|
Terrarum.WIDTH - histogramW - 30,
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ object WorldCamera {
|
|||||||
inline val yCentre: Int
|
inline val yCentre: Int
|
||||||
get() = y + height.ushr(1)
|
get() = y + height.ushr(1)
|
||||||
|
|
||||||
fun update(world: GameWorld, player: ActorWBMovable) {
|
fun update(world: GameWorld, player: ActorWBMovable?) {
|
||||||
|
if (player == null) return
|
||||||
|
|
||||||
width = FastMath.ceil(Terrarum.WIDTH / (Terrarum.ingame?.screenZoom ?: 1f)) // div, not mul
|
width = FastMath.ceil(Terrarum.WIDTH / (Terrarum.ingame?.screenZoom ?: 1f)) // div, not mul
|
||||||
height = FastMath.ceil(Terrarum.HEIGHT / (Terrarum.ingame?.screenZoom ?: 1f))
|
height = FastMath.ceil(Terrarum.HEIGHT / (Terrarum.ingame?.screenZoom ?: 1f))
|
||||||
|
|||||||
BIN
tmp_wenquanyi.tga
LFS
BIN
tmp_wenquanyi.tga
LFS
Binary file not shown.
Reference in New Issue
Block a user