forked from teamnwah/openmw-tes3coop
Implement and use new method allowTelekinesis()
This commit is contained in:
parent
8014f37879
commit
35a23c3b49
8 changed files with 30 additions and 5 deletions
|
@ -81,6 +81,10 @@ namespace MWClass
|
||||||
return (ref->mBase->mName != "");
|
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
|
MWGui::ToolTipInfo Activator::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||||
{
|
{
|
||||||
const MWWorld::LiveCellRef<ESM::Activator> *ref = ptr.get<ESM::Activator>();
|
const MWWorld::LiveCellRef<ESM::Activator> *ref = ptr.get<ESM::Activator>();
|
||||||
|
|
|
@ -24,6 +24,9 @@ namespace MWClass
|
||||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @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;
|
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.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
|
|
|
@ -79,4 +79,8 @@ namespace MWClass
|
||||||
weight += effects.get(MWMechanics::EffectKey(ESM::MagicEffect::Burden)).getMagnitude();
|
weight += effects.get(MWMechanics::EffectKey(ESM::MagicEffect::Burden)).getMagnitude();
|
||||||
return (weight < 0) ? 0.0f : weight;
|
return (weight < 0) ? 0.0f : weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Actor::allowTelekinesis(const MWWorld::ConstPtr &ptr) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,9 @@ namespace MWClass
|
||||||
///< Returns total weight of objects inside this object (including modifications from magic
|
///< Returns total weight of objects inside this object (including modifications from magic
|
||||||
/// effects). Throws an exception, if the object can't hold other objects.
|
/// 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
|
// not implemented
|
||||||
Actor(const Actor&);
|
Actor(const Actor&);
|
||||||
Actor& operator= (const Actor&);
|
Actor& operator= (const Actor&);
|
||||||
|
|
|
@ -213,6 +213,14 @@ namespace MWClass
|
||||||
return true;
|
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
|
std::string Door::getScript (const MWWorld::ConstPtr& ptr) const
|
||||||
{
|
{
|
||||||
const MWWorld::LiveCellRef<ESM::Door> *ref = ptr.get<ESM::Door>();
|
const MWWorld::LiveCellRef<ESM::Door> *ref = ptr.get<ESM::Door>();
|
||||||
|
|
|
@ -45,6 +45,9 @@ namespace MWClass
|
||||||
|
|
||||||
virtual bool canLock(const MWWorld::ConstPtr &ptr) const;
|
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;
|
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
|
||||||
///< Return name of the script attached to ptr
|
///< Return name of the script attached to ptr
|
||||||
|
|
||||||
|
|
|
@ -279,6 +279,9 @@ namespace MWWorld
|
||||||
virtual bool isKey (const MWWorld::ConstPtr& ptr) const { return false; }
|
virtual bool isKey (const MWWorld::ConstPtr& ptr) const { return false; }
|
||||||
|
|
||||||
virtual bool isGold(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)
|
/// Get a blood texture suitable for \a ptr (see Blood Texture 0-2 in Morrowind.ini)
|
||||||
virtual int getBloodTexture (const MWWorld::ConstPtr& ptr) const;
|
virtual int getBloodTexture (const MWWorld::ConstPtr& ptr) const;
|
||||||
|
|
|
@ -1027,11 +1027,8 @@ namespace MWWorld
|
||||||
|
|
||||||
facedObject = getFacedObject(activationDistance, distanceToObject, true);
|
facedObject = getFacedObject(activationDistance, distanceToObject, true);
|
||||||
|
|
||||||
// Not allowing telekinesis on actors, on doors that teleport to other cells, or on activators
|
if (!facedObject.isEmpty() && !facedObject.getClass().allowTelekinesis(facedObject)
|
||||||
// Original engine doesn't allow telekinesis on books or lights, either
|
&& distanceToObject > getMaxActivationDistance())
|
||||||
if (!facedObject.isEmpty() && (facedObject.getClass().isActor()
|
|
||||||
|| facedObject.getCellRef().getTeleport() || facedObject.getClass().getTypeName() == typeid(ESM::Activator).name())
|
|
||||||
&& (distanceToObject > getMaxActivationDistance()))
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue