forked from mirror/openmw-tes3mp
Don't try to set a new state when dead
This commit is contained in:
parent
f2948ced23
commit
627b866744
1 changed files with 36 additions and 35 deletions
|
@ -174,13 +174,16 @@ Ogre::Vector3 CharacterController::update(float duration)
|
||||||
{
|
{
|
||||||
Ogre::Vector3 movement(0.0f);
|
Ogre::Vector3 movement(0.0f);
|
||||||
|
|
||||||
|
float speed = 0.0f;
|
||||||
|
if(!(getState() >= CharState_Death1))
|
||||||
|
{
|
||||||
const MWBase::World *world = MWBase::Environment::get().getWorld();
|
const MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
const MWWorld::Class &cls = MWWorld::Class::get(mPtr);
|
const MWWorld::Class &cls = MWWorld::Class::get(mPtr);
|
||||||
const Ogre::Vector3 &vec = cls.getMovementVector(mPtr);
|
const Ogre::Vector3 &vec = cls.getMovementVector(mPtr);
|
||||||
const float speed = cls.getSpeed(mPtr);
|
|
||||||
|
|
||||||
bool inwater = world->isSwimming(mPtr);
|
bool inwater = world->isSwimming(mPtr);
|
||||||
bool isrunning = cls.getStance(mPtr, MWWorld::Class::Run);
|
bool isrunning = cls.getStance(mPtr, MWWorld::Class::Run);
|
||||||
|
speed = cls.getSpeed(mPtr);
|
||||||
|
|
||||||
if(std::abs(vec.x/2.0f) > std::abs(vec.y))
|
if(std::abs(vec.x/2.0f) > std::abs(vec.y))
|
||||||
{
|
{
|
||||||
|
@ -209,8 +212,6 @@ Ogre::Vector3 CharacterController::update(float duration)
|
||||||
movement.x += vec.x * (speed*duration);
|
movement.x += vec.x * (speed*duration);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if(!(getState() >= CharState_Death1))
|
|
||||||
setState((inwater ? CharState_IdleSwim : CharState_Idle), true);
|
setState((inwater ? CharState_IdleSwim : CharState_Idle), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue