mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-28 17:09:41 +00:00
Check collision before findInteriorPositionfindInteriorPos
This commit is contained in:
parent
72dbad6fb4
commit
c1cd8bd900
1 changed files with 12 additions and 9 deletions
|
@ -589,16 +589,19 @@ namespace MWWorld
|
||||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
MWWorld::Ptr playerPtr = world->getPlayerPtr();
|
MWWorld::Ptr playerPtr = world->getPlayerPtr();
|
||||||
|
|
||||||
ESM::Position newPos;
|
// Check that collision is enabled, which is opposite to Vanilla
|
||||||
const ESM::RefId refId = MWBase::Environment::get().getWorld()->findInteriorPosition(cellNameId, newPos);
|
// this change was decided in MR #4100 as the behaviour is preferable
|
||||||
|
if (world->isActorCollisionEnabled(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 (!refId.empty() && world->isActorCollisionEnabled(playerPtr)
|
|
||||||
&& newPos.pos[2] >= mLowestPoint - lowestPointAdjustment)
|
|
||||||
{
|
{
|
||||||
MWWorld::ActionTeleport(refId, newPos, false).execute(playerPtr);
|
ESM::Position newPos;
|
||||||
Log(Debug::Warning) << "Player position has been reset due to falling into the void";
|
const ESM::RefId refId = world->findInteriorPosition(cellNameId, newPos);
|
||||||
|
|
||||||
|
// Only teleport if that teleport point is > the lowest point, rare edge case
|
||||||
|
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";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue