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