mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-23 21:09:42 +00:00
Implement GetPCTraveling console command
This commit is contained in:
parent
1cfc1f9bdb
commit
9dfd775bf2
5 changed files with 28 additions and 3 deletions
|
@ -566,6 +566,9 @@ namespace MWBase
|
|||
|
||||
virtual bool isPlayerInJail() const = 0;
|
||||
|
||||
virtual void setPlayerTraveling(bool traveling) = 0;
|
||||
virtual bool isPlayerTraveling() const = 0;
|
||||
|
||||
virtual void rotateWorldObject (const MWWorld::Ptr& ptr, osg::Quat rotate) = 0;
|
||||
|
||||
/// Return terrain height at \a worldPos position.
|
||||
|
|
|
@ -154,6 +154,10 @@ namespace MWGui
|
|||
if (playerGold<price)
|
||||
return;
|
||||
|
||||
// Set "traveling" flag, so GetPCTraveling can detect teleportation.
|
||||
// We will reset this flag during next world update.
|
||||
MWBase::Environment::get().getWorld()->setPlayerTraveling(true);
|
||||
|
||||
if (!mPtr.getCell()->isExterior())
|
||||
// Interior cell -> mages guild transport
|
||||
MWBase::Environment::get().getWindowManager()->playSound("mysticism cast");
|
||||
|
|
|
@ -1155,8 +1155,7 @@ namespace MWScript
|
|||
|
||||
virtual void execute (Interpreter::Runtime &runtime)
|
||||
{
|
||||
/// \todo implement traveling check
|
||||
runtime.push (0);
|
||||
runtime.push (MWBase::Environment::get().getWorld()->isPlayerTraveling());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -153,7 +153,8 @@ namespace MWWorld
|
|||
mGodMode(false), mScriptsEnabled(true), mContentFiles (contentFiles), mUserDataPath(userDataPath),
|
||||
mActivationDistanceOverride (activationDistanceOverride), mStartupScript(startupScript),
|
||||
mStartCell (startCell), mDistanceToFacedObject(-1), mTeleportEnabled(true),
|
||||
mLevitationEnabled(true), mGoToJail(false), mDaysInPrison(0), mSpellPreloadTimer(0.f)
|
||||
mLevitationEnabled(true), mGoToJail(false), mDaysInPrison(0),
|
||||
mPlayerTraveling(false), mSpellPreloadTimer(0.f)
|
||||
{
|
||||
mPhysics.reset(new MWPhysics::PhysicsSystem(resourceSystem, rootNode));
|
||||
mRendering.reset(new MWRender::RenderingManager(viewer, rootNode, resourceSystem, workQueue, &mFallback, resourcePath));
|
||||
|
@ -311,6 +312,7 @@ namespace MWWorld
|
|||
mGoToJail = false;
|
||||
mTeleportEnabled = true;
|
||||
mLevitationEnabled = true;
|
||||
mPlayerTraveling = false;
|
||||
|
||||
fillGlobalVariables();
|
||||
}
|
||||
|
@ -1639,6 +1641,9 @@ namespace MWWorld
|
|||
|
||||
void World::update (float duration, bool paused)
|
||||
{
|
||||
// Reset "traveling" flag - there was a frame to detect traveling.
|
||||
mPlayerTraveling = false;
|
||||
|
||||
if (mGoToJail && !paused)
|
||||
goToJail();
|
||||
|
||||
|
@ -3312,6 +3317,16 @@ namespace MWWorld
|
|||
return MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Jail);
|
||||
}
|
||||
|
||||
void World::setPlayerTraveling(bool traveling)
|
||||
{
|
||||
mPlayerTraveling = traveling;
|
||||
}
|
||||
|
||||
bool World::isPlayerTraveling() const
|
||||
{
|
||||
return mPlayerTraveling;
|
||||
}
|
||||
|
||||
float World::getTerrainHeightAt(const osg::Vec3f& worldPos) const
|
||||
{
|
||||
return mRendering->getTerrainHeightAt(worldPos);
|
||||
|
|
|
@ -168,6 +168,7 @@ namespace MWWorld
|
|||
bool mLevitationEnabled;
|
||||
bool mGoToJail;
|
||||
int mDaysInPrison;
|
||||
bool mPlayerTraveling;
|
||||
|
||||
float mSpellPreloadTimer;
|
||||
|
||||
|
@ -672,6 +673,9 @@ namespace MWWorld
|
|||
|
||||
bool isPlayerInJail() const override;
|
||||
|
||||
void setPlayerTraveling(bool traveling);
|
||||
bool isPlayerTraveling() const;
|
||||
|
||||
/// Return terrain height at \a worldPos position.
|
||||
float getTerrainHeightAt(const osg::Vec3f& worldPos) const override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue