1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-28 16:39:43 +00:00

Check collision before findInteriorPositionfindInteriorPos

This commit is contained in:
Sam Hellawell 2024-05-18 06:33:06 +01:00
parent 72dbad6fb4
commit c1cd8bd900

View file

@ -589,19 +589,22 @@ namespace MWWorld
MWBase::World* world = MWBase::Environment::get().getWorld();
MWWorld::Ptr playerPtr = world->getPlayerPtr();
// Check that collision is enabled, which is opposite to Vanilla
// this change was decided in MR #4100 as the behaviour is preferable
if (world->isActorCollisionEnabled(playerPtr))
{
ESM::Position newPos;
const ESM::RefId refId = MWBase::Environment::get().getWorld()->findInteriorPosition(cellNameId, newPos);
const ESM::RefId refId = world->findInteriorPosition(cellNameId, newPos);
// 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 (!refId.empty() && world->isActorCollisionEnabled(playerPtr)
&& newPos.pos[2] >= mLowestPoint - lowestPointAdjustment)
if (!refId.empty() && 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";
}
}
}
}
void Scene::requestChangeCellGrid(const osg::Vec3f& position, const osg::Vec2i& cell, bool changeEvent)
{