mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 07:23:51 +00:00
Don't allow casting Water Walking in deep water
This commit is contained in:
parent
b92a4f1a32
commit
a6216d883f
4 changed files with 30 additions and 0 deletions
|
@ -385,6 +385,7 @@ namespace MWBase
|
||||||
///Is the head of the creature underwater?
|
///Is the head of the creature underwater?
|
||||||
virtual bool isSubmerged(const MWWorld::ConstPtr &object) const = 0;
|
virtual bool isSubmerged(const MWWorld::ConstPtr &object) const = 0;
|
||||||
virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const = 0;
|
virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const = 0;
|
||||||
|
virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const = 0;
|
||||||
virtual bool isOnGround(const MWWorld::Ptr &ptr) const = 0;
|
virtual bool isOnGround(const MWWorld::Ptr &ptr) const = 0;
|
||||||
|
|
||||||
virtual osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const = 0;
|
virtual osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const = 0;
|
||||||
|
|
|
@ -384,6 +384,21 @@ namespace MWMechanics
|
||||||
else
|
else
|
||||||
canCastAnEffect = true;
|
canCastAnEffect = true;
|
||||||
|
|
||||||
|
if (magicEffect->mIndex == ESM::MagicEffect::WaterWalking)
|
||||||
|
{
|
||||||
|
if (target.getClass().isPureWaterCreature(target))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
|
||||||
|
if (!world->isWaterWalkingCastableOnTarget(target))
|
||||||
|
{
|
||||||
|
if (caster == getPlayer())
|
||||||
|
MWBase::Environment::get().getWindowManager()->messageBox ("#{sMagicInvalidEffect}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!checkEffectTarget(effectIt->mEffectID, target, castByPlayer))
|
if (!checkEffectTarget(effectIt->mEffectID, target, castByPlayer))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -2077,6 +2077,19 @@ namespace MWWorld
|
||||||
return pos.z() < cell->getWaterLevel();
|
return pos.z() < cell->getWaterLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool World::isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const
|
||||||
|
{
|
||||||
|
const MWWorld::CellStore* cell = target.getCell();
|
||||||
|
if (!cell->getCell()->hasWater())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Based on observations from the original engine, the depth
|
||||||
|
// limit at which water walking can still be cast on a target
|
||||||
|
// in water appears to be the same as what the highest swimmable
|
||||||
|
// z position would be with SwimHeightScale + 1.
|
||||||
|
return !isUnderwater(target, mSwimHeightScale + 1);
|
||||||
|
}
|
||||||
|
|
||||||
bool World::isOnGround(const MWWorld::Ptr &ptr) const
|
bool World::isOnGround(const MWWorld::Ptr &ptr) const
|
||||||
{
|
{
|
||||||
return mPhysics->isOnGround(ptr);
|
return mPhysics->isOnGround(ptr);
|
||||||
|
|
|
@ -481,6 +481,7 @@ namespace MWWorld
|
||||||
virtual bool isSwimming(const MWWorld::ConstPtr &object) const;
|
virtual bool isSwimming(const MWWorld::ConstPtr &object) const;
|
||||||
virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const;
|
virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const;
|
||||||
virtual bool isWading(const MWWorld::ConstPtr &object) const;
|
virtual bool isWading(const MWWorld::ConstPtr &object) const;
|
||||||
|
virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const;
|
||||||
virtual bool isOnGround(const MWWorld::Ptr &ptr) const;
|
virtual bool isOnGround(const MWWorld::Ptr &ptr) const;
|
||||||
|
|
||||||
virtual osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const;
|
virtual osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const;
|
||||||
|
|
Loading…
Reference in a new issue