diff --git a/assets/mods/basegame/metadata.properties b/assets/mods/basegame/metadata.properties index e71f2eec0..4fcafbf1b 100644 --- a/assets/mods/basegame/metadata.properties +++ b/assets/mods/basegame/metadata.properties @@ -16,10 +16,10 @@ package=net.torvald.terrarum.modulebasegame entrypoint=net.torvald.terrarum.modulebasegame.EntryPoint # Release date in YYYY-MM-DD -releasedate=2017-07-14 +releasedate=2022-01-24 # The version, must follow Semver 2.0.0 scheme (https://semver.org/) -version=0.2.0 +version=0.3.0 # External JAR that the module is compiled. If your module requires yet another library, the JAR must be compiled as a "Fatjar"; # Due to security reasons, loading an arbitrary JAR is not allowed. diff --git a/assets/mods/dwarventech/metadata.properties b/assets/mods/dwarventech/metadata.properties index aff70f2b9..a947a47ea 100644 --- a/assets/mods/dwarventech/metadata.properties +++ b/assets/mods/dwarventech/metadata.properties @@ -6,4 +6,4 @@ entrypoint=net.torvald.terrarum.modulecomputers.EntryPoint releasedate=2021-12-03 version=0.3.0 jar=ModuleComputers.jar -dependency=basegame 0.2.* +dependency=basegame 0.3.0 diff --git a/src/net/torvald/terrarum/gameactors/ActorWithBody.kt b/src/net/torvald/terrarum/gameactors/ActorWithBody.kt index ecec5d140..90f01af71 100644 --- a/src/net/torvald/terrarum/gameactors/ActorWithBody.kt +++ b/src/net/torvald/terrarum/gameactors/ActorWithBody.kt @@ -1281,24 +1281,39 @@ open class ActorWithBody : Actor { * Very straightforward for the actual solid tiles, not so much for the platforms */ private fun shouldICollideWithThis(tile: ItemID) = - // regular solid block + // regular solid block (BlockCodex[tile].isSolid) + // the location and size of the platform in world coord + protected var platformsToIgnore: Hitbox? = null + + private fun standingOnIgnoredPlatform(): Boolean = platformsToIgnore.let { + return if (it != null) + hitbox.startX >= it.startX && hitbox.endX <= it.endX - PHYS_EPSILON_DIST && + it.startY <= hitbox.endY && hitbox.endY <= it.endY - PHYS_EPSILON_DIST + else false + } + /** * If this tile should be treated as "collidable" * * Just like "shouldICollideWithThis" but it's intended to work with feet tiles */ private fun shouldICollideWithThisFeet(tile: ItemID) = - // regular solid block + // regular solid block (BlockCodex[tile].isSolid) || - // platforms, moving downward AND not "going down" - (this is ActorHumanoid && BlockCodex[tile].isPlatform && - externalV.y + (controllerV?.y ?: 0.0) >= 0.0 && - !this.isDownDown && this.axisY <= 0f) || - // platforms, moving downward - (this !is ActorHumanoid && BlockCodex[tile].isPlatform && - externalV.y + (controllerV?.y ?: 0.0) >= 0.0) + // or platforms that are not on the "ignored list" (the list is updated on the update()) + (this is ActorHumanoid && BlockCodex[tile].isPlatform && !standingOnIgnoredPlatform()) + + /* + // platforms, moving downward AND not "going down" + (this is ActorHumanoid && BlockCodex[tile].isPlatform && + externalV.y + (controllerV?.y ?: 0.0) >= 0.0 && + !this.isDownDown && this.axisY <= 0f) || + // platforms, moving downward + (this !is ActorHumanoid && BlockCodex[tile].isPlatform && + externalV.y + (controllerV?.y ?: 0.0) >= 0.0) + */ // TODO: as for the platform, only apply it when it's a feet tile diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt index a9aef8318..dbadc1dd6 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt @@ -197,6 +197,7 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L if (isNoClip) { //grounded = true + platformsToIgnore = null } // reset control box of AI @@ -498,6 +499,10 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L isWalkingV = true + + + + // TODO do something to the ActorWithBody.platformsToIgnore } private fun applyAccel(x: Int): Double { diff --git a/src/net/torvald/terrarum/ui/ConsoleWindow.kt b/src/net/torvald/terrarum/ui/ConsoleWindow.kt index 34991036d..c9ce5f858 100644 --- a/src/net/torvald/terrarum/ui/ConsoleWindow.kt +++ b/src/net/torvald/terrarum/ui/ConsoleWindow.kt @@ -129,13 +129,6 @@ class ConsoleWindow : UICanvas() { } uiItems.forEach { it.render(batch, camera) } - - Terrarum.ingame?.let { - batch.color = Color.WHITE - it.actorNowPlaying?.getSpriteHead()!!.let { - batch.draw(it, drawOffX + 10f, drawOffY + height + 4f) - } - } } override fun inputStrobed(e: TerrarumKeyboardEvent) {