Merge pull request #2711 from Capostrophic/failsafe

Revert infinite fall failsafe addition
pull/2693/head
Andrei Kortunov 5 years ago committed by GitHub
commit 8442446080
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -203,7 +203,6 @@
Bug #5269: Editor: Cell lighting in resaved cleaned content files is corrupted Bug #5269: Editor: Cell lighting in resaved cleaned content files is corrupted
Bug #5278: Console command Show doesn't fall back to global variable after local var not found Bug #5278: Console command Show doesn't fall back to global variable after local var not found
Bug #5300: NPCs don't switch from torch to shield when starting combat Bug #5300: NPCs don't switch from torch to shield when starting combat
Feature #1415: Infinite fall failsafe
Feature #1774: Handle AvoidNode Feature #1774: Handle AvoidNode
Feature #2229: Improve pathfinding AI Feature #2229: Improve pathfinding AI
Feature #3025: Analogue gamepad movement controls Feature #3025: Analogue gamepad movement controls

@ -33,7 +33,6 @@
#include "../mwphysics/object.hpp" #include "../mwphysics/object.hpp"
#include "../mwphysics/heightfield.hpp" #include "../mwphysics/heightfield.hpp"
#include "actionteleport.hpp"
#include "player.hpp" #include "player.hpp"
#include "localscripts.hpp" #include "localscripts.hpp"
#include "esmstore.hpp" #include "esmstore.hpp"
@ -258,20 +257,10 @@ namespace
struct PositionVisitor struct PositionVisitor
{ {
float mLowestPos = std::numeric_limits<float>::max();
bool operator() (const MWWorld::Ptr& ptr) bool operator() (const MWWorld::Ptr& ptr)
{ {
if (!ptr.getRefData().isDeleted() && ptr.getRefData().isEnabled()) if (!ptr.getRefData().isDeleted() && ptr.getRefData().isEnabled())
{
if (!ptr.getClass().isActor())
{
float objectPosZ = ptr.getRefData().getPosition().pos[2];
if (objectPosZ < mLowestPos)
mLowestPos = objectPosZ;
}
ptr.getClass().adjustPosition (ptr, false); ptr.getClass().adjustPosition (ptr, false);
}
return true; return true;
} }
}; };
@ -498,16 +487,6 @@ namespace MWWorld
const auto player = MWBase::Environment::get().getWorld()->getPlayerPtr(); const auto player = MWBase::Environment::get().getWorld()->getPlayerPtr();
navigator->update(player.getRefData().getPosition().asVec3()); navigator->update(player.getRefData().getPosition().asVec3());
const float fallThreshold = 256.f;
if (mCurrentCell && !mCurrentCell->isExterior() && pos.z() < mLowestPos - fallThreshold)
{
ESM::Position newPos;
std::string cellName = mCurrentCell->getCell()->mName;
MWBase::Environment::get().getWorld()->findInteriorPosition(cellName, newPos);
if (newPos.pos[2] >= mLowestPos)
MWWorld::ActionTeleport(cellName, newPos, false).execute(player);
}
if (!mCurrentCell || !mCurrentCell->isExterior()) if (!mCurrentCell || !mCurrentCell->isExterior())
return; return;
@ -898,10 +877,8 @@ namespace MWWorld
insertVisitor.insert([&] (const MWWorld::Ptr& ptr) { addObject(ptr, *mPhysics, mNavigator); }); insertVisitor.insert([&] (const MWWorld::Ptr& ptr) { addObject(ptr, *mPhysics, mNavigator); });
// do adjustPosition (snapping actors to ground) after objects are loaded, so we don't depend on the loading order // do adjustPosition (snapping actors to ground) after objects are loaded, so we don't depend on the loading order
// Also note the lowest object position in the cell to allow infinite fall fail safe to work
PositionVisitor posVisitor; PositionVisitor posVisitor;
cell.forEach (posVisitor); cell.forEach (posVisitor);
mLowestPos = posVisitor.mLowestPos;
} }
void Scene::addObjectToScene (const Ptr& ptr) void Scene::addObjectToScene (const Ptr& ptr)

@ -84,7 +84,6 @@ namespace MWWorld
float mPredictionTime; float mPredictionTime;
osg::Vec3f mLastPlayerPos; osg::Vec3f mLastPlayerPos;
float mLowestPos;
void insertCell (CellStore &cell, Loading::Listener* loadingListener, bool test = false); void insertCell (CellStore &cell, Loading::Listener* loadingListener, bool test = false);

Loading…
Cancel
Save