forked from mirror/openmw-tes3mp
some checks reworked
This commit is contained in:
parent
6a3dddfb9a
commit
82121e0401
3 changed files with 13 additions and 4 deletions
|
@ -170,6 +170,14 @@ namespace MWClass
|
||||||
virtual int getBaseGold(const MWWorld::Ptr& ptr) const;
|
virtual int getBaseGold(const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual bool isClass(const MWWorld::Ptr& ptr, const std::string &className) const;
|
virtual bool isClass(const MWWorld::Ptr& ptr, const std::string &className) const;
|
||||||
|
|
||||||
|
virtual bool canSwim (const MWWorld::Ptr &ptr) const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool canWalk (const MWWorld::Ptr &ptr) const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -341,8 +341,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
// check if can move along z-axis
|
// check if can move along z-axis
|
||||||
bool canMoveByZ;
|
bool canMoveByZ;
|
||||||
if(canMoveByZ = ((actorCls.isNpc() || actorCls.canSwim(actor)) && MWBase::Environment::get().getWorld()->isSwimming(actor))
|
if(canMoveByZ = (actorCls.canSwim(actor) && MWBase::Environment::get().getWorld()->isSwimming(actor))
|
||||||
|| (actorCls.canFly(actor) && MWBase::Environment::get().getWorld()->isFlying(actor)))
|
|| MWBase::Environment::get().getWorld()->isFlying(actor))
|
||||||
{
|
{
|
||||||
// determine vertical angle to target
|
// determine vertical angle to target
|
||||||
mMovement.mRotation[0] = getXAngleToDir(vDirToTarget, distToTarget);
|
mMovement.mRotation[0] = getXAngleToDir(vDirToTarget, distToTarget);
|
||||||
|
|
|
@ -313,8 +313,9 @@ namespace MWWorld
|
||||||
// NOTE: stepMove modifies newPosition if successful
|
// NOTE: stepMove modifies newPosition if successful
|
||||||
if(stepMove(colobj, newPosition, velocity, remainingTime, engine))
|
if(stepMove(colobj, newPosition, velocity, remainingTime, engine))
|
||||||
{
|
{
|
||||||
// don't let slaughterfish move out of water after stepMove
|
// don't let pure water creatures move out of water after stepMove
|
||||||
if(ptr.getClass().canSwim(ptr) && newPosition.z > (waterlevel - halfExtents.z * 0.5))
|
if((ptr.getClass().canSwim(ptr) && !ptr.getClass().canWalk(ptr))
|
||||||
|
&& newPosition.z > (waterlevel - halfExtents.z * 0.5))
|
||||||
newPosition = oldPosition;
|
newPosition = oldPosition;
|
||||||
else // Only on the ground if there's gravity
|
else // Only on the ground if there's gravity
|
||||||
isOnGround = !(newPosition.z < waterlevel || isFlying);
|
isOnGround = !(newPosition.z < waterlevel || isFlying);
|
||||||
|
|
Loading…
Reference in a new issue