1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-01 03:45:32 +00:00

Fix fixme behavior in interiors

This commit is contained in:
Capostrophic 2018-10-24 01:40:57 +03:00
parent 6c4116cc8b
commit 4ce35c6ad5
4 changed files with 8 additions and 8 deletions

View file

@ -262,8 +262,8 @@ namespace MWBase
///< Adjust position after load to be on ground. Must be called after model load. ///< Adjust position after load to be on ground. Must be called after model load.
/// @param force do this even if the ptr is flying /// @param force do this even if the ptr is flying
virtual void fixPosition (const MWWorld::Ptr& actor) = 0; virtual void fixPosition () = 0;
///< Attempt to fix position so that the Ptr is no longer inside collision geometry. ///< Attempt to fix position so that the player is not stuck inside the geometry.
/// @note No-op for items in containers. Use ContainerStore::removeItem instead. /// @note No-op for items in containers. Use ContainerStore::removeItem instead.
virtual void deleteObject (const MWWorld::Ptr& ptr) = 0; virtual void deleteObject (const MWWorld::Ptr& ptr) = 0;

View file

@ -738,8 +738,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime) virtual void execute (Interpreter::Runtime& runtime)
{ {
const MWWorld::Ptr ptr = MWMechanics::getPlayer(); MWBase::Environment::get().getWorld()->fixPosition();
MWBase::Environment::get().getWorld()->fixPosition(ptr);
} }
}; };

View file

@ -1351,8 +1351,9 @@ namespace MWWorld
moveObject(ptr, ptr.getCell(), pos.x(), pos.y(), pos.z()); moveObject(ptr, ptr.getCell(), pos.x(), pos.y(), pos.z());
} }
void World::fixPosition(const Ptr &actor) void World::fixPosition()
{ {
const MWWorld::Ptr actor = getPlayerPtr();
const float distance = 128.f; const float distance = 128.f;
ESM::Position esmPos = actor.getRefData().getPosition(); ESM::Position esmPos = actor.getRefData().getPosition();
osg::Quat orientation(esmPos.rot[2], osg::Vec3f(0,0,-1)); osg::Quat orientation(esmPos.rot[2], osg::Vec3f(0,0,-1));
@ -1382,7 +1383,7 @@ namespace MWWorld
esmPos.pos[0] = traced.x(); esmPos.pos[0] = traced.x();
esmPos.pos[1] = traced.y(); esmPos.pos[1] = traced.y();
esmPos.pos[2] = traced.z(); esmPos.pos[2] = traced.z();
MWWorld::ActionTeleport("", esmPos, false).execute(actor); MWWorld::ActionTeleport(actor.getCell()->isExterior() ? "" : actor.getCell()->getCell()->mName, esmPos, false).execute(actor);
} }
} }

View file

@ -291,8 +291,8 @@ namespace MWWorld
///< Adjust position after load to be on ground. Must be called after model load. ///< Adjust position after load to be on ground. Must be called after model load.
/// @param force do this even if the ptr is flying /// @param force do this even if the ptr is flying
void fixPosition (const Ptr& actor) override; void fixPosition () override;
///< Attempt to fix position so that the Ptr is no longer inside collision geometry. ///< Attempt to fix position so that the player is not stuck inside the geometry.
void enable (const Ptr& ptr) override; void enable (const Ptr& ptr) override;