actor draw planting offset

This commit is contained in:
minjaesong
2023-08-08 17:14:13 +09:00
parent 2411db17a7
commit 88d844cc09
3 changed files with 17 additions and 6 deletions

View File

@@ -1764,9 +1764,12 @@ open class ActorWithBody : Actor {
if (world == null) return
val offsetX = 0f
val offsetY = 1f // plant to the ground
val offsetY = 0f // for some reason this value must be zero to draw the actor planted to the ground
drawBodyInGoodPosition(hitbox.startX.toFloat(), hitbox.startY.toFloat()) { x, y ->
val posX = hitbox.startX.plus(PHYS_EPSILON_DIST).toFloat()
val posY = hitbox.startY.plus(PHYS_EPSILON_DIST).toFloat()
drawBodyInGoodPosition(posX, posY) { x, y ->
sprite.render(batch, x + offsetX, y + offsetY, scale.toFloat())
}
}

View File

@@ -14,16 +14,21 @@ import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
*/
internal object Inventory : ConsoleCommand {
private var targetID: ActorID = INGAME.actorNowPlaying?.referenceID ?: PLAYER_REF_ID
private var targetID: ActorID = 0
private fun tryTargetActivePlayer() {
targetID = INGAME.actorNowPlaying?.referenceID ?: 0
}
override fun execute(args: Array<String>) {
if (args.size == 1) {
printUsage()
}
else if (args[1] == "target") {
targetID = if (args[2].lowercase() == "player") (INGAME.actorNowPlaying?.referenceID ?: PLAYER_REF_ID) else args[2].toInt()
if (args[2].lowercase() == "player") tryTargetActivePlayer() else targetID = args[2].toInt()
}
else {
if (targetID == 0) tryTargetActivePlayer()
val actor = getActor()
if (actor != null) {
when (args[1]) {
@@ -36,7 +41,7 @@ internal object Inventory : ConsoleCommand {
}
}
else {
Echo("Actor $targetID is not Pocketed or does not exists")
Echo("Actor $targetID is not Pocketed or does not exist")
}
}
}

View File

@@ -1,5 +1,6 @@
package net.torvald.terrarum.modulebasegame.gameactors
import net.torvald.terrarum.INGAME
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.langpack.Lang
@@ -27,5 +28,7 @@ class FixtureWallCalendar : FixtureBase {
actorValue[AVKey.BASEMASS] = 1.0
}
override var tooltipText: String?
get() = INGAME.world.worldTime.getFormattedCalendarDay()
set(value) {}
}