From 75c79d8ca2e87e4af423a290fc78600cc9205e83 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Sun, 26 May 2019 22:55:50 +0900 Subject: [PATCH] no secondary click; tiki torch kinda spawns? --- .idea/compiler.xml | 5 +- .idea/misc.xml | 2 +- assets/mods/basegame/blocks/blocks.csv | 5 ++ src/net/torvald/aa/KDHeapifiedTree.kt | 12 ++++- src/net/torvald/aa/KDTree.kt | 31 ++++++----- src/net/torvald/terrarum/IngameInstance.kt | 10 ++-- .../torvald/terrarum/UIItemInventoryElem.kt | 2 +- .../torvald/terrarum/blockproperties/Block.kt | 2 +- .../gamecontroller/IngameController.kt | 16 +++--- src/net/torvald/terrarum/gameitem/GameItem.kt | 12 ++++- .../torvald/terrarum/gameworld/GameWorld.kt | 52 ++++++++----------- .../torvald/terrarum/modulebasegame/Ingame.kt | 5 +- .../modulebasegame/gameactors/FixtureBase.kt | 7 +++ .../gameitems/TikiTorchTester.kt | 7 +++ .../gameworld/WorldSimulator.kt | 6 +-- terrarum.iml | 4 +- 16 files changed, 108 insertions(+), 70 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index f7461e78f..24ee1a052 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -4,10 +4,7 @@ - - - - + - + \ No newline at end of file diff --git a/assets/mods/basegame/blocks/blocks.csv b/assets/mods/basegame/blocks/blocks.csv index 2043da1e8..7c58d4c87 100644 --- a/assets/mods/basegame/blocks/blocks.csv +++ b/assets/mods/basegame/blocks/blocks.csv @@ -98,6 +98,11 @@ "256";"256";"BLOCK_LANTERN_IRON_REGULAR";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"FXTR";"0";"0";"0";"0";"0";"0";"16";"1.0000";"0.6372";"0.0000";"0.0000";"N/A";"N/A" "257";"257";"BLOCK_SUNSTONE";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"ROCK";"1";"0";"0";"0";"2";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" "258";"258";"BLOCK_DAYLIGHT_CAPACITOR";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"0";"0";"3";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" +"4091";"0";"ACTORBLOCK_NO_COLLISION";"0.0";"0.0";"0.0";"0.0";"1";"1";"NULL";"0";"0";"0";"0";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" +"4092";"0";"ACTORBLOCK_FULL_COLLISION";"0.0";"0.0";"0.0";"0.0";"1";"1";"NULL";"0";"0";"0";"0";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" +"4093";"0";"ACTORBLOCK_ALLOW_MOVE_DOWN";"0.0";"0.0";"0.0";"0.0";"1";"1";"NULL";"0";"1";"0";"0";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" +"4094";"0";"ACTORBLOCK_NO_PASS_RIGHT";"0.0";"0.0";"0.0";"0.0";"1";"1";"NULL";"0";"0";"0";"0";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" +"4095";"0";"ACTORBLOCK_NO_PASS_LEFT";"0.0";"0.0";"0.0";"0.0";"1";"1";"NULL";"0";"0";"0";"0";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" "4096";"0";"BLOCK_WATER";"0.1016";"0.0744";"0.0508";"0.0826";"100";"1000";"WATR";"0";"0";"0";"0";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"005599A6";"16" "4097";"0";"BLOCK_LAVA";"0.9696";"0.9696";"0.9696";"0.9696";"100";"2600";"ROCK";"0";"0";"0";"0";"0";"0";"16";"0.7664";"0.2032";"0.0000";"0.0000";"FF4600E6";"32" "-1";"0";"BLOCK_NULL";"4.0000";"4.0000";"4.0000";"4.0000";"-1";"2600";"NULL";"0";"0";"1";"0";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" diff --git a/src/net/torvald/aa/KDHeapifiedTree.kt b/src/net/torvald/aa/KDHeapifiedTree.kt index d9190e069..b5cb24fd2 100644 --- a/src/net/torvald/aa/KDHeapifiedTree.kt +++ b/src/net/torvald/aa/KDHeapifiedTree.kt @@ -32,7 +32,17 @@ class KDHeapifiedTree(actors: List) { private fun Int.getActor() = nodes[this] private fun Int.getLeft() = this * 2 + 1 private fun Int.getRight() = this * 2 + 2 - private fun Int.set(value: ActorWBMovable?) { nodes[this] = value } + private fun Int.set(value: ActorWBMovable?) { + try { + nodes[this] = value + } + catch (_: ArrayIndexOutOfBoundsException) { + // modification of the private fun expandArray() + val prevNodes = nodes.copyOf() + value + Array(prevNodes.size * 2, { null }) + create(prevNodes.toList(), 0, 0) + } + } private fun Int.setLeftChild(value: ActorWBMovable?) { nodes[this.getLeft()] = value } private fun Int.setRightChild(value: ActorWBMovable?) { nodes[this.getRight()] = value } diff --git a/src/net/torvald/aa/KDTree.kt b/src/net/torvald/aa/KDTree.kt index bd9372376..4f2140521 100644 --- a/src/net/torvald/aa/KDTree.kt +++ b/src/net/torvald/aa/KDTree.kt @@ -1,9 +1,13 @@ package net.torvald.aa +import net.torvald.terrarum.gameactors.ActorWithBody +import net.torvald.terrarum.gameactors.Hitbox +import net.torvald.terrarum.sqr + /** * Created by minjaesong on 2019-04-18. */ -/*class KDTree(points: List) { +class KDTree(points: List) { companion object { const val DIMENSION = 2 @@ -15,7 +19,7 @@ package net.torvald.aa root = create(points, 0) } - fun findNearest(query: ActorWithBody) = getNearest(root!!, query, 0) + fun findNearest(query: ActorWithBody) = getNearest(root!!, query.hitbox, 0) private fun create(points: List, depth: Int): KDNode? { if (points.isEmpty()) { @@ -34,21 +38,21 @@ package net.torvald.aa } } - private fun getNearest(currentNode: KDNode, query: ActorWithBody, depth: Int = 0): KDNode { - val direction = currentNode.compare(query, depth % DIMENSION) + private fun getNearest(currentNode: KDNode, actorHitbox: Hitbox, depth: Int = 0): KDNode { + val direction = currentNode.compare(actorHitbox, depth % DIMENSION) val next = if (direction < 0) currentNode.left else currentNode.right val other = if (direction < 0) currentNode.right else currentNode.left - var best = if (next == null) currentNode else getNearest(next, query, depth + 1) // traverse to leaf + var best = if (next == null) currentNode else getNearest(next, actorHitbox, depth + 1) // traverse to leaf - if (currentNode.position.distSqr(query) < best.position.distSqr(query)) { + if (currentNode.position.distSqr(actorHitbox) < best.position.distSqr(actorHitbox)) { best = currentNode } if (other != null) { - if (currentNode.position.dimDistSqr(query, depth % DIMENSION) < best.position.distSqr(query)) { - val bestCandidate = getNearest(other, query, depth + 1) - if (bestCandidate.position.distSqr(query) < best.position.distSqr(query)) { + if (currentNode.position.dimDistSqr(actorHitbox, depth % DIMENSION) < best.position.distSqr(actorHitbox)) { + val bestCandidate = getNearest(other, actorHitbox, depth + 1) + if (bestCandidate.position.distSqr(actorHitbox) < best.position.distSqr(actorHitbox)) { best = bestCandidate } } @@ -58,14 +62,15 @@ package net.torvald.aa } data class KDNode(val left: KDNode?, val right: KDNode?, val actor: ActorWithBody, val position: Hitbox) { - fun compare(other: ActorWithBody, dimension: Int) = other.getDimensionalPoint(dimension) - this.position.getDimensionalPoint(dimension) - + //fun compare(other: ActorWithBody, dimension: Int) = other.getDimensionalPoint(dimension) - this.position.getDimensionalPoint(dimension) + fun compare(other: Hitbox, dimension: Int) = other.getDimensionalPoint(dimension) - this.position.getDimensionalPoint(dimension) } - private fun Hitbox.distSqr(other: Hitbox) { + private fun Hitbox.distSqr(other: Hitbox): Double { var dist = 0.0 for (i in 0 until DIMENSION) dist += (this.getDimensionalPoint(i) - other.getDimensionalPoint(i)).sqr() + return dist } private fun Hitbox.dimDistSqr(other: Hitbox, dimension: Int) = other.getDimensionalPoint(dimension).minus(this.getDimensionalPoint(dimension)).sqr() @@ -74,4 +79,4 @@ package net.torvald.aa internal fun ActorWithBody.getDimensionalPoint(depth: Int) = this.hitbox.getDimensionalPoint(depth) // TODO take ROUNDWORLD into account internal fun Hitbox.getDimensionalPoint(depth: Int) = - if (depth % KDTree.DIMENSION == 0) this.canonicalX else this.canonicalY*/ \ No newline at end of file + if (depth % KDTree.DIMENSION == 0) this.canonicalX else this.canonicalY \ No newline at end of file diff --git a/src/net/torvald/terrarum/IngameInstance.kt b/src/net/torvald/terrarum/IngameInstance.kt index 8b6e85771..966c08247 100644 --- a/src/net/torvald/terrarum/IngameInstance.kt +++ b/src/net/torvald/terrarum/IngameInstance.kt @@ -94,16 +94,18 @@ open class IngameInstance(val batch: SpriteBatch) : Screen { } /** + * I have decided that left and right clicks must do the same thing, so no secondary use from now on. --Torvald on 2019-05-26 + * * Event for triggering held item's `startSecondaryUse(Float)` */ - open fun worldSecondaryClickStart(delta: Float) { - } + //open fun worldSecondaryClickStart(delta: Float) { } /** + * I have decided that left and right clicks must do the same thing, so no secondary use from now on. --Torvald on 2019-05-26 + * * Event for triggering held item's `endSecondaryUse(Float)` */ - open fun worldSecondaryClickEnd(delta: Float) { - } + //open fun worldSecondaryClickEnd(delta: Float) { } /** * Event for triggering fixture update when something is placed/removed on the world. diff --git a/src/net/torvald/terrarum/UIItemInventoryElem.kt b/src/net/torvald/terrarum/UIItemInventoryElem.kt index 3ff2ba7c0..cc0ee9cac 100644 --- a/src/net/torvald/terrarum/UIItemInventoryElem.kt +++ b/src/net/torvald/terrarum/UIItemInventoryElem.kt @@ -188,7 +188,7 @@ class UIItemInventoryElem( // equip da shit val itemEquipSlot = item!!.equipPosition if (itemEquipSlot == GameItem.EquipPosition.NULL) { - TODO("Equip position is NULL, does this mean it's single-consume items like a potion?") + TODO("Equip position is NULL, does this mean it's single-consume items like a potion? (from item: \"$item\" with itemID: ${item?.originalID}/${item?.dynamicID})") } val player = (Terrarum.ingame!! as Ingame).actorNowPlaying diff --git a/src/net/torvald/terrarum/blockproperties/Block.kt b/src/net/torvald/terrarum/blockproperties/Block.kt index 5a130838a..6100b37c4 100644 --- a/src/net/torvald/terrarum/blockproperties/Block.kt +++ b/src/net/torvald/terrarum/blockproperties/Block.kt @@ -116,7 +116,7 @@ object Block { const val DAYLIGHT_CAPACITOR = 258 - const val ACTORBLOCK_NO_COLLISION = 4191 + const val ACTORBLOCK_NO_COLLISION = 4091 const val ACTORBLOCK_FULL_COLLISION = 4092 const val ACTORBLOCK_ALLOW_MOVE_DOWN = 4093 const val ACTORBLOCK_NO_PASS_RIGHT = 4094 diff --git a/src/net/torvald/terrarum/gamecontroller/IngameController.kt b/src/net/torvald/terrarum/gamecontroller/IngameController.kt index d5e94528d..907c7ae63 100644 --- a/src/net/torvald/terrarum/gamecontroller/IngameController.kt +++ b/src/net/torvald/terrarum/gamecontroller/IngameController.kt @@ -58,12 +58,14 @@ class IngameController(val ingame: Ingame) : InputAdapter() { // fire world click events; the event is defined as Ingame's (or any others') WorldClick event if (ingame.uiContainer.map { if ((it.isOpening || it.isOpened) && it.mouseUp) 1 else 0 }.sum() == 0) { // no UI on the mouse, right? - if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary"))) { + if ( + Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary")) || + Gdx.input.isButtonPressed(AppLoader.getConfigInt("mousesecondary"))) { ingame.worldPrimaryClickStart(AppLoader.UPDATE_RATE.toFloat()) } - if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("mousesecondary"))) { + /*if Gdx.input.isButtonPressed(AppLoader.getConfigInt("mousesecondary")) { ingame.worldSecondaryClickStart(AppLoader.UPDATE_RATE.toFloat()) - } + }*/ } } @@ -146,12 +148,14 @@ class IngameController(val ingame: Ingame) : InputAdapter() { // fire world click events; the event is defined as Ingame's (or any others') WorldClick event if (ingame.uiContainer.map { if ((it.isOpening || it.isOpened) && it.mouseUp) 1 else 0 }.sum() == 0) { // no UI on the mouse, right? - if (button == AppLoader.getConfigInt("mouseprimary")) { + if ( + button == AppLoader.getConfigInt("mouseprimary") || + button == AppLoader.getConfigInt("mousesecondary")) { ingame.worldPrimaryClickEnd(AppLoader.UPDATE_RATE.toFloat()) } - if (button == AppLoader.getConfigInt("mousesecondary")) { + /*if (button == AppLoader.getConfigInt("mousesecondary")) { ingame.worldSecondaryClickEnd(AppLoader.UPDATE_RATE.toFloat()) - } + }*/ } } diff --git a/src/net/torvald/terrarum/gameitem/GameItem.kt b/src/net/torvald/terrarum/gameitem/GameItem.kt index 53913c1bc..5a6767d40 100644 --- a/src/net/torvald/terrarum/gameitem/GameItem.kt +++ b/src/net/torvald/terrarum/gameitem/GameItem.kt @@ -82,7 +82,13 @@ abstract class GameItem(val originalID: ItemID) : Comparable, Cloneabl /** * Where to equip the item. * - * Can't use 'open val' as GSON don't like that + * Can't use 'open val' as GSON doesn't like that. Initialise this property like: + * + * ``` + * init { + * equipPosition = EquipPosition.HAND_GRIP + * } + * ``` */ var equipPosition: Int = EquipPosition.NULL @@ -165,6 +171,8 @@ abstract class GameItem(val originalID: ItemID) : Comparable, Cloneabl open fun startPrimaryUse(delta: Float): Boolean = false /** + * I have decided that left and right clicks must do the same thing, so no secondary use from now on. --Torvald on 2019-05-26 + * * Apply effects (continuously or not) while secondary button is down * The item will NOT be consumed, so you will want to consume it yourself by inventory.consumeItem(item) * @@ -174,7 +182,7 @@ abstract class GameItem(val originalID: ItemID) : Comparable, Cloneabl * * note: DO NOT super() this! */ - open fun startSecondaryUse(delta: Float): Boolean = false + //open fun startSecondaryUse(delta: Float): Boolean = false open fun endPrimaryUse(delta: Float): Boolean = false open fun endSecondaryUse(delta: Float): Boolean = false diff --git a/src/net/torvald/terrarum/gameworld/GameWorld.kt b/src/net/torvald/terrarum/gameworld/GameWorld.kt index ed7494d57..7b95a45a1 100644 --- a/src/net/torvald/terrarum/gameworld/GameWorld.kt +++ b/src/net/torvald/terrarum/gameworld/GameWorld.kt @@ -210,12 +210,12 @@ open class GameWorld { terrain * PairedMapLayer.RANGE + terrainDamage } - fun getWallLowBits(x: Int, y: Int): Int? { + private fun getWallLowBits(x: Int, y: Int): Int? { val (x, y) = coerceXY(x, y) return layerWallLowBits.getData(x, y) } - fun getTerrainLowBits(x: Int, y: Int): Int? { + private fun getTerrainLowBits(x: Int, y: Int): Int? { val (x, y) = coerceXY(x, y) return layerTerrainLowBits.getData(x, y) } @@ -226,57 +226,49 @@ open class GameWorld { * * * @param y * * - * @param combinedTilenum Item id of the wall block. Less-than-4096-value is permitted. + * @param tilenum Item id of the wall block. Less-than-4096-value is permitted. */ - fun setTileWall(x: Int, y: Int, combinedTilenum: Int) { + fun setTileWall(x: Int, y: Int, tilenum: Int) { val (x, y) = coerceXY(x, y) - val combinedTilenum = combinedTilenum % GameWorld.TILES_SUPPORTED // does work without this, but to be safe... - setTileWall(x, y, (combinedTilenum / PairedMapLayer.RANGE).toByte(), combinedTilenum % PairedMapLayer.RANGE) + val tilenum = tilenum % TILES_SUPPORTED // does work without this, but to be safe... + + val oldWall = getTileFromWall(x, y) + layerWall.setTile(x, y, (tilenum / PairedMapLayer.RANGE).toByte()) + layerWallLowBits.setData(x, y, tilenum % PairedMapLayer.RANGE) + wallDamages.remove(LandUtil.getBlockAddr(this, x, y)) + + if (oldWall != null) + Terrarum.ingame?.queueWallChangedEvent(oldWall, tilenum, LandUtil.getBlockAddr(this, x, y)) } /** * Set the tile of wall as specified, with damage value of zero. + * + * Warning: this function alters fluid lists: be wary of call order! + * * @param x * * * @param y * * - * @param combinedTilenum Item id of the terrain block, <4096 + * @param tilenum Item id of the terrain block, <4096 */ - fun setTileTerrain(x: Int, y: Int, combinedTilenum: Int) { + fun setTileTerrain(x: Int, y: Int, tilenum: Int) { val (x, y) = coerceXY(x, y) - setTileTerrain(x, y, (combinedTilenum / PairedMapLayer.RANGE).toByte(), combinedTilenum % PairedMapLayer.RANGE) - } - fun setTileWall(x: Int, y: Int, tile: Byte, damage: Int) { - val (x, y) = coerceXY(x, y) - val oldWall = getTileFromWall(x, y) - layerWall.setTile(x, y, tile) - layerWallLowBits.setData(x, y, damage) - wallDamages.remove(LandUtil.getBlockAddr(this, x, y)) - - if (oldWall != null) - Terrarum.ingame?.queueWallChangedEvent(oldWall, tile.toUint() * PairedMapLayer.RANGE + damage, LandUtil.getBlockAddr(this, x, y)) - } - - /** - * Warning: this function alters fluid lists: be wary of call order! - */ - fun setTileTerrain(x: Int, y: Int, tile: Byte, damage: Int) { - val (x, y) = coerceXY(x, y) val oldTerrain = getTileFromTerrain(x, y) - layerTerrain.setTile(x, y, tile) - layerTerrainLowBits.setData(x, y, damage) + layerTerrain.setTile(x, y, (tilenum / PairedMapLayer.RANGE).toByte()) + layerTerrainLowBits.setData(x, y, tilenum % PairedMapLayer.RANGE) val blockAddr = LandUtil.getBlockAddr(this, x, y) terrainDamages.remove(blockAddr) - if (BlockCodex[tile * PairedMapLayer.RANGE + damage].isSolid) { + if (BlockCodex[tilenum].isSolid) { fluidFills.remove(blockAddr) fluidTypes.remove(blockAddr) } // fluid tiles-item should be modified so that they will also place fluid onto their respective map if (oldTerrain != null) - Terrarum.ingame?.queueTerrainChangedEvent(oldTerrain, tile.toUint() * PairedMapLayer.RANGE + damage, LandUtil.getBlockAddr(this, x, y)) + Terrarum.ingame?.queueTerrainChangedEvent(oldTerrain, tilenum, LandUtil.getBlockAddr(this, x, y)) } /*fun setTileWire(x: Int, y: Int, tile: Byte) { diff --git a/src/net/torvald/terrarum/modulebasegame/Ingame.kt b/src/net/torvald/terrarum/modulebasegame/Ingame.kt index 366e247f5..85d49bbec 100644 --- a/src/net/torvald/terrarum/modulebasegame/Ingame.kt +++ b/src/net/torvald/terrarum/modulebasegame/Ingame.kt @@ -404,7 +404,8 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) { ItemCodex[itemOnGrip]?.endPrimaryUse(delta) } - override fun worldSecondaryClickStart(delta: Float) { + // I have decided that left and right clicks must do the same thing, so no secondary use from now on. --Torvald on 2019-05-26 + /*override fun worldSecondaryClickStart(delta: Float) { val itemOnGrip = actorNowPlaying?.inventory?.itemEquipped?.get(GameItem.EquipPosition.HAND_GRIP) val consumptionSuccessful = ItemCodex[itemOnGrip]?.startSecondaryUse(delta) ?: false if (consumptionSuccessful) @@ -414,7 +415,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) { override fun worldSecondaryClickEnd(delta: Float) { val itemOnGrip = actorNowPlaying?.inventory?.itemEquipped?.get(GameItem.EquipPosition.HAND_GRIP) ItemCodex[itemOnGrip]?.endSecondaryUse(delta) - } + }*/ diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureBase.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureBase.kt index 162ca7679..e4458195e 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureBase.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureBase.kt @@ -42,20 +42,27 @@ open class FixtureBase(val blockBox: BlockBox, val blockBoxProps: BlockBoxProps // posY: bottom of the blockBox // using the actor's hitbox + // TODO: obviously check for collision + for (x in posX until posX + blockBox.width) { for (y in posY until posY + blockBox.height) { world.setTileTerrain(x, y, blockBox.collisionType) } } + // set the position of this actor worldBlockPos = Point2i(posX, posY) this.isVisible = true this.hitbox.setFromWidthHeight(posX * TSIZE, posY * TSIZE, blockBox.width * TSIZE, blockBox.height * TSIZE) + // actually add this actor into the world + Terrarum.ingame!!.addNewActor(this) return true // TODO for the tests' sake, just get fucking spawned + + // TODO TESTING RESULTS SO FAR: tiki torch does emit lights, but its body cannot be seen } /** diff --git a/src/net/torvald/terrarum/modulebasegame/gameitems/TikiTorchTester.kt b/src/net/torvald/terrarum/modulebasegame/gameitems/TikiTorchTester.kt index c2c52fc65..b0d7c39f2 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameitems/TikiTorchTester.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameitems/TikiTorchTester.kt @@ -25,10 +25,17 @@ class TikiTorchTester(originalID: ItemID) : GameItem(originalID) { get() = AppLoader.resourcePool.getAsTextureRegion("itemplaceholder_48") override var baseToolSize: Double? = baseMass + init { + equipPosition = EquipPosition.HAND_GRIP + } + override fun startPrimaryUse(delta: Float): Boolean { val torch = FixtureTikiTorch() + //println("aroisetn") + return torch.spawn(Terrarum.mouseTileX, Terrarum.mouseTileY - torch.blockBox.height + 1) // return true when placed, false when cannot be placed } + } \ No newline at end of file diff --git a/src/net/torvald/terrarum/modulebasegame/gameworld/WorldSimulator.kt b/src/net/torvald/terrarum/modulebasegame/gameworld/WorldSimulator.kt index 8f2e35a96..f1e39b5e7 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameworld/WorldSimulator.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameworld/WorldSimulator.kt @@ -1,7 +1,7 @@ package net.torvald.terrarum.modulebasegame.gameworld import com.badlogic.gdx.graphics.Color -import net.torvald.aa.KDHeapifiedTree +import net.torvald.aa.KDTree import net.torvald.terrarum.AppLoader import net.torvald.terrarum.Terrarum import net.torvald.terrarum.blockproperties.BlockCodex @@ -52,7 +52,7 @@ object WorldSimulator { private val ingame = Terrarum.ingame!! private val world = ingame.world - private var actorsKDTree: KDHeapifiedTree? = null + private var actorsKDTree: KDTree? = null fun resetForThisFrame() { actorsKDTree = null @@ -61,7 +61,7 @@ object WorldSimulator { operator fun invoke(player: ActorHumanoid?, delta: Float) { // build the kdtree that will be used during a single frame of updating if (actorsKDTree == null) - actorsKDTree = KDHeapifiedTree(ingame.actorContainerActive.filter { it is ActorWBMovable }) + actorsKDTree = KDTree(ingame.actorContainerActive.filter { it is ActorWBMovable }) //printdbg(this, "============================") diff --git a/terrarum.iml b/terrarum.iml index 325aeaaa0..47dd18719 100644 --- a/terrarum.iml +++ b/terrarum.iml @@ -2,10 +2,10 @@ - + -