Merge pull request #1536 from rexelion/knockoutfix

Wait a few seconds before getting up (fixes #3884)
new-script-api
scrawl 7 years ago committed by GitHub
commit 87c79d7102
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -254,6 +254,7 @@ void CharacterController::refreshHitRecoilAnims()
|| mPtr.getClass().getCreatureStats(mPtr).getFatigue().getBase() == 0)
&& mAnimation->hasAnimation("knockout"))
{
mTimeUntilWake = Misc::Rng::rollClosedProbability() * 2 + 1; // Wake up after 1 to 3 seconds
if (isSwimming && mAnimation->hasAnimation("swimknockout"))
{
mHitState = CharState_SwimKnockOut;
@ -338,7 +339,8 @@ void CharacterController::refreshHitRecoilAnims()
mPtr.getClass().getCreatureStats(mPtr).setBlock(false);
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;
mAnimation->disable(mCurrentHit);
@ -767,6 +769,7 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
, mSecondsOfRunning(0)
, mTurnAnimationThreshold(0)
, mAttackingOrSpell(false)
, mTimeUntilWake(0.f)
{
if(!mAnimation)
return;
@ -1636,6 +1639,9 @@ void CharacterController::update(float duration)
float speed = 0.f;
updateMagicEffects();
if (isKnockedOut())
mTimeUntilWake -= duration;
bool godmode = mPtr == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();

@ -196,6 +196,8 @@ class CharacterController : public MWRender::Animation::TextKeyListener
float mSecondsOfSwimming;
float mSecondsOfRunning;
float mTimeUntilWake;
MWWorld::ConstPtr mHeadTrackTarget;
float mTurnAnimationThreshold; // how long to continue playing turning animation after actor stopped turning

Loading…
Cancel
Save