mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 19:14:05 +09:00
barehand action will not remove fixtures (more pricisely, actorblocks)
This commit is contained in:
@@ -1220,7 +1220,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
// else, punch a block
|
||||
val punchBlockSize = punchSize.div(TILE_SIZED).floorInt()
|
||||
if (punchBlockSize > 0) {
|
||||
PickaxeCore.startPrimaryUse(actor, delta, null, Terrarum.mouseTileX, Terrarum.mouseTileY, 1.0 / punchBlockSize, punchBlockSize, punchBlockSize)
|
||||
PickaxeCore.startPrimaryUse(actor, delta, null, Terrarum.mouseTileX, Terrarum.mouseTileY, 1.0 / punchBlockSize, punchBlockSize, punchBlockSize, false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,10 @@ object PickaxeCore {
|
||||
* @param mw width of the digging
|
||||
* @param mh height of the digging
|
||||
*/
|
||||
fun startPrimaryUse(actor: ActorWithBody, delta: Float, item: GameItem?, mx: Int, my: Int, dropProbability: Double = 1.0, mw: Int = 1, mh: Int = 1) = inInteractableRange(actor) {
|
||||
fun startPrimaryUse(
|
||||
actor: ActorWithBody, delta: Float, item: GameItem?, mx: Int, my: Int,
|
||||
dropProbability: Double = 1.0, mw: Int = 1, mh: Int = 1, attackActorBlocks: Boolean = true
|
||||
) = inInteractableRange(actor) {
|
||||
// un-round the mx
|
||||
val ww = INGAME.world.width
|
||||
val apos = actor.centrePosPoint
|
||||
@@ -50,6 +53,7 @@ object PickaxeCore {
|
||||
|
||||
val mousePoint = Point2d(x.toDouble(), y.toDouble())
|
||||
val actorvalue = actor.actorValue
|
||||
val tile = (INGAME.world).getTileFromTerrain(x, y)
|
||||
|
||||
item?.using = true
|
||||
|
||||
@@ -64,7 +68,7 @@ object PickaxeCore {
|
||||
if (!ret1) return ret1*/
|
||||
|
||||
// return false if here's no tile
|
||||
if (Block.AIR == (INGAME.world).getTileFromTerrain(x, y)) {
|
||||
if (Block.AIR == tile || (!attackActorBlocks && tile in Block.actorblocks)) {
|
||||
usageStatus = usageStatus or false
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -70,15 +70,15 @@ class UINewWorld(val remoCon: UIRemoCon) : UICanvas() {
|
||||
tex.forEach { it.flip(false, true) }
|
||||
|
||||
goButton.touchDownListener = { _, _, _, _ ->
|
||||
printdbg(this, "generate!")
|
||||
printdbg(this, "generate! Size=${sizeSelector.selection}, Name=${nameInput.getTextOrPlaceholder()}, Seed=${seedInput.getTextOrPlaceholder()}")
|
||||
}
|
||||
backButton.touchDownListener = { _, _, _, _ ->
|
||||
printdbg(this, "back!")
|
||||
}
|
||||
|
||||
addUIitem(sizeSelector)
|
||||
addUIitem(nameInput)
|
||||
addUIitem(seedInput)
|
||||
addUIitem(seedInput) // order is important
|
||||
addUIitem(nameInput) // because of the IME candidates overlay
|
||||
addUIitem(goButton)
|
||||
addUIitem(backButton)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user