diff --git a/apps/openmw/mwclass/activator.cpp b/apps/openmw/mwclass/activator.cpp index 9785eef1e..b3747f916 100644 --- a/apps/openmw/mwclass/activator.cpp +++ b/apps/openmw/mwclass/activator.cpp @@ -81,6 +81,10 @@ namespace MWClass return (ref->mBase->mName != ""); } + bool Activator::allowTelekinesis(const MWWorld::ConstPtr &ptr) const { + return false; + } + MWGui::ToolTipInfo Activator::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const { const MWWorld::LiveCellRef *ref = ptr.get(); diff --git a/apps/openmw/mwclass/activator.hpp b/apps/openmw/mwclass/activator.hpp index 15dbf5767..e90620cea 100644 --- a/apps/openmw/mwclass/activator.hpp +++ b/apps/openmw/mwclass/activator.hpp @@ -24,6 +24,9 @@ namespace MWClass virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const; ///< @return true if this object has a tooltip when focused (default implementation: false) + virtual bool allowTelekinesis(const MWWorld::ConstPtr& ptr) const; + ///< Return whether this class of object can be activated with telekinesis + virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const; ///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip. diff --git a/apps/openmw/mwclass/actor.cpp b/apps/openmw/mwclass/actor.cpp index 4e89c7282..56de5e3f8 100644 --- a/apps/openmw/mwclass/actor.cpp +++ b/apps/openmw/mwclass/actor.cpp @@ -79,4 +79,8 @@ namespace MWClass weight += effects.get(MWMechanics::EffectKey(ESM::MagicEffect::Burden)).getMagnitude(); return (weight < 0) ? 0.0f : weight; } + + bool Actor::allowTelekinesis(const MWWorld::ConstPtr &ptr) const { + return false; + } } diff --git a/apps/openmw/mwclass/actor.hpp b/apps/openmw/mwclass/actor.hpp index 88a3f1a32..1aca5e660 100644 --- a/apps/openmw/mwclass/actor.hpp +++ b/apps/openmw/mwclass/actor.hpp @@ -35,6 +35,9 @@ namespace MWClass ///< Returns total weight of objects inside this object (including modifications from magic /// effects). Throws an exception, if the object can't hold other objects. + virtual bool allowTelekinesis(const MWWorld::ConstPtr& ptr) const; + ///< Return whether this class of object can be activated with telekinesis + // not implemented Actor(const Actor&); Actor& operator= (const Actor&); diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 8d54dff5d..81188fe10 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -213,6 +213,14 @@ namespace MWClass return true; } + bool Door::allowTelekinesis(const MWWorld::ConstPtr &ptr) const + { + if (ptr.getCellRef().getTeleport()) + return false; + else + return true; + } + std::string Door::getScript (const MWWorld::ConstPtr& ptr) const { const MWWorld::LiveCellRef *ref = ptr.get(); diff --git a/apps/openmw/mwclass/door.hpp b/apps/openmw/mwclass/door.hpp index 42aa6d64d..906b18511 100644 --- a/apps/openmw/mwclass/door.hpp +++ b/apps/openmw/mwclass/door.hpp @@ -45,6 +45,9 @@ namespace MWClass virtual bool canLock(const MWWorld::ConstPtr &ptr) const; + virtual bool allowTelekinesis(const MWWorld::ConstPtr &ptr) const; + ///< Return whether this class of object can be activated with telekinesis + virtual std::string getScript (const MWWorld::ConstPtr& ptr) const; ///< Return name of the script attached to ptr diff --git a/apps/openmw/mwworld/class.hpp b/apps/openmw/mwworld/class.hpp index 0bb3edbee..23128ea9d 100644 --- a/apps/openmw/mwworld/class.hpp +++ b/apps/openmw/mwworld/class.hpp @@ -279,6 +279,9 @@ namespace MWWorld virtual bool isKey (const MWWorld::ConstPtr& ptr) const { return false; } virtual bool isGold(const MWWorld::ConstPtr& ptr) const { return false; } + + virtual bool allowTelekinesis(const MWWorld::ConstPtr& ptr) const { return true; } + ///< Return whether this class of object can be activated with telekinesis /// Get a blood texture suitable for \a ptr (see Blood Texture 0-2 in Morrowind.ini) virtual int getBloodTexture (const MWWorld::ConstPtr& ptr) const; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index c2d27e60e..869ccdfe5 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1027,11 +1027,8 @@ namespace MWWorld facedObject = getFacedObject(activationDistance, distanceToObject, true); - // Not allowing telekinesis on actors, on doors that teleport to other cells, or on activators - // Original engine doesn't allow telekinesis on books or lights, either - if (!facedObject.isEmpty() && (facedObject.getClass().isActor() - || facedObject.getCellRef().getTeleport() || facedObject.getClass().getTypeName() == typeid(ESM::Activator).name()) - && (distanceToObject > getMaxActivationDistance())) + if (!facedObject.isEmpty() && !facedObject.getClass().allowTelekinesis(facedObject) + && distanceToObject > getMaxActivationDistance()) return 0; }