From e1cfd46f87f0a807266f4d819c8c79470d729df2 Mon Sep 17 00:00:00 2001 From: Sam Hellawell Date: Wed, 15 May 2024 20:41:48 +0100 Subject: [PATCH] Do not teleport if dest < lowest point or collision disabled, add debug log --- apps/openmw/mwworld/scene.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 881d114ffc..77ef4686d8 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -591,7 +591,14 @@ namespace MWWorld ESM::Position newPos; const ESM::RefId refId = MWBase::Environment::get().getWorld()->findInteriorPosition(cellNameId, newPos); - MWWorld::ActionTeleport(refId, newPos, false).execute(playerPtr); + + // Only teleport if that teleport point is > the lowest point, rare edge case + // also check that collision is enabled, which is opposite to Vanilla + if (world->isActorCollisionEnabled(playerPtr) && newPos.pos[2] >= mLowestPoint - lowestPointAdjustment) + { + MWWorld::ActionTeleport(refId, newPos, false).execute(playerPtr); + Log(Debug::Warning) << "Player position has been reset due to falling into the void."; + } } }