some checks reworked

actorid
mrcheko 11 years ago
parent 6a3dddfb9a
commit 82121e0401

@ -170,6 +170,14 @@ namespace MWClass
virtual int getBaseGold(const MWWorld::Ptr& ptr) 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
bool canMoveByZ;
if(canMoveByZ = ((actorCls.isNpc() || actorCls.canSwim(actor)) && MWBase::Environment::get().getWorld()->isSwimming(actor))
|| (actorCls.canFly(actor) && MWBase::Environment::get().getWorld()->isFlying(actor)))
if(canMoveByZ = (actorCls.canSwim(actor) && MWBase::Environment::get().getWorld()->isSwimming(actor))
|| MWBase::Environment::get().getWorld()->isFlying(actor))
{
// determine vertical angle to target
mMovement.mRotation[0] = getXAngleToDir(vDirToTarget, distToTarget);

@ -313,8 +313,9 @@ namespace MWWorld
// NOTE: stepMove modifies newPosition if successful
if(stepMove(colobj, newPosition, velocity, remainingTime, engine))
{
// don't let slaughterfish move out of water after stepMove
if(ptr.getClass().canSwim(ptr) && newPosition.z > (waterlevel - halfExtents.z * 0.5))
// don't let pure water creatures move out of water after stepMove
if((ptr.getClass().canSwim(ptr) && !ptr.getClass().canWalk(ptr))
&& newPosition.z > (waterlevel - halfExtents.z * 0.5))
newPosition = oldPosition;
else // Only on the ground if there's gravity
isOnGround = !(newPosition.z < waterlevel || isFlying);

Loading…
Cancel
Save