1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-29 03:36:40 +00:00

Do not teleport if dest < lowest point or collision disabled, add debug log

This commit is contained in:
Sam Hellawell 2024-05-15 20:41:48 +01:00
parent b43c7238e9
commit e1cfd46f87

View file

@ -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.";
}
}
}