mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Merge pull request #1536 from rexelion/knockoutfix
Wait a few seconds before getting up (fixes #3884)
This commit is contained in:
commit
87c79d7102
2 changed files with 9 additions and 1 deletions
|
@ -254,6 +254,7 @@ void CharacterController::refreshHitRecoilAnims()
|
||||||
|| mPtr.getClass().getCreatureStats(mPtr).getFatigue().getBase() == 0)
|
|| mPtr.getClass().getCreatureStats(mPtr).getFatigue().getBase() == 0)
|
||||||
&& mAnimation->hasAnimation("knockout"))
|
&& mAnimation->hasAnimation("knockout"))
|
||||||
{
|
{
|
||||||
|
mTimeUntilWake = Misc::Rng::rollClosedProbability() * 2 + 1; // Wake up after 1 to 3 seconds
|
||||||
if (isSwimming && mAnimation->hasAnimation("swimknockout"))
|
if (isSwimming && mAnimation->hasAnimation("swimknockout"))
|
||||||
{
|
{
|
||||||
mHitState = CharState_SwimKnockOut;
|
mHitState = CharState_SwimKnockOut;
|
||||||
|
@ -338,7 +339,8 @@ void CharacterController::refreshHitRecoilAnims()
|
||||||
mPtr.getClass().getCreatureStats(mPtr).setBlock(false);
|
mPtr.getClass().getCreatureStats(mPtr).setBlock(false);
|
||||||
mHitState = CharState_None;
|
mHitState = CharState_None;
|
||||||
}
|
}
|
||||||
else if (isKnockedOut() && mPtr.getClass().getCreatureStats(mPtr).getFatigue().getCurrent() > 0)
|
else if (isKnockedOut() && mPtr.getClass().getCreatureStats(mPtr).getFatigue().getCurrent() > 0
|
||||||
|
&& mTimeUntilWake <= 0)
|
||||||
{
|
{
|
||||||
mHitState = isSwimming ? CharState_SwimKnockDown : CharState_KnockDown;
|
mHitState = isSwimming ? CharState_SwimKnockDown : CharState_KnockDown;
|
||||||
mAnimation->disable(mCurrentHit);
|
mAnimation->disable(mCurrentHit);
|
||||||
|
@ -767,6 +769,7 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
|
||||||
, mSecondsOfRunning(0)
|
, mSecondsOfRunning(0)
|
||||||
, mTurnAnimationThreshold(0)
|
, mTurnAnimationThreshold(0)
|
||||||
, mAttackingOrSpell(false)
|
, mAttackingOrSpell(false)
|
||||||
|
, mTimeUntilWake(0.f)
|
||||||
{
|
{
|
||||||
if(!mAnimation)
|
if(!mAnimation)
|
||||||
return;
|
return;
|
||||||
|
@ -1636,6 +1639,9 @@ void CharacterController::update(float duration)
|
||||||
float speed = 0.f;
|
float speed = 0.f;
|
||||||
|
|
||||||
updateMagicEffects();
|
updateMagicEffects();
|
||||||
|
|
||||||
|
if (isKnockedOut())
|
||||||
|
mTimeUntilWake -= duration;
|
||||||
|
|
||||||
bool godmode = mPtr == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
|
bool godmode = mPtr == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,8 @@ class CharacterController : public MWRender::Animation::TextKeyListener
|
||||||
float mSecondsOfSwimming;
|
float mSecondsOfSwimming;
|
||||||
float mSecondsOfRunning;
|
float mSecondsOfRunning;
|
||||||
|
|
||||||
|
float mTimeUntilWake;
|
||||||
|
|
||||||
MWWorld::ConstPtr mHeadTrackTarget;
|
MWWorld::ConstPtr mHeadTrackTarget;
|
||||||
|
|
||||||
float mTurnAnimationThreshold; // how long to continue playing turning animation after actor stopped turning
|
float mTurnAnimationThreshold; // how long to continue playing turning animation after actor stopped turning
|
||||||
|
|
Loading…
Reference in a new issue