mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
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 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…
Reference in a new issue