From 54715e41b00949b292ec736f8591d69acec2e3bf Mon Sep 17 00:00:00 2001 From: minjaesong Date: Mon, 9 Feb 2026 02:59:59 +0900 Subject: [PATCH] fix: sinking platform taking actors with it --- .../terrarum/gameactors/PhysContraption.kt | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/net/torvald/terrarum/gameactors/PhysContraption.kt b/src/net/torvald/terrarum/gameactors/PhysContraption.kt index 595b17e08..8a9479986 100644 --- a/src/net/torvald/terrarum/gameactors/PhysContraption.kt +++ b/src/net/torvald/terrarum/gameactors/PhysContraption.kt @@ -83,10 +83,21 @@ abstract class PhysContraption() : ActorWithBody() { rider.hitbox.setPositionX(oldRiderX) } - // Snap to contraption surface (sets Y), then check for ceiling collision + // Snap to contraption surface (sets Y), then check for terrain collision snapRiderToSurface(rider) - if (!rider.isNoCollideWorld && rider.isWalled(rider.hitbox, COLLIDING_TOP)) { - rider.hitbox.setPositionY(oldRiderY) + if (!rider.isNoCollideWorld) { + if (rider.isWalled(rider.hitbox, COLLIDING_TOP)) { + // Ceiling: revert Y + rider.hitbox.setPositionY(oldRiderY) + } + if (rider.isWalled(rider.hitbox, COLLIDING_BOTTOM)) { + // Terrain beneath rider — platform sank into ground. + // Revert Y so rider stands on terrain, then dismount. + rider.hitbox.setPositionY(oldRiderY) + actorsRiding.remove(rider.referenceID) + rider.platformsRiding.remove(this.referenceID) + continue + } } if (rider.externalV.y > 0.0) { @@ -140,7 +151,7 @@ abstract class PhysContraption() : ActorWithBody() { // --- Step 2b: Mount detection for new candidates --- - val candidates: List = (INGAME.actorContainerActive.filterIsInstance().filter { it !== this && it !is PhysContraption } + INGAME.actorNowPlaying).filterNotNull() + val candidates: List = (INGAME.actorContainerActive.filterIsInstance().filter { it !== this && it !is PhysContraption && it.physProp.usePhysics } + INGAME.actorNowPlaying).filterNotNull() for (actor in candidates) { if (actorsRiding.contains(actor.referenceID)) continue