mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
use real time; wait random number of seconds
This commit is contained in:
parent
5b8610b34b
commit
de83ad0116
2 changed files with 4 additions and 5 deletions
|
@ -248,15 +248,14 @@ void CharacterController::refreshHitRecoilAnims()
|
||||||
bool knockdown = mPtr.getClass().getCreatureStats(mPtr).getKnockedDown();
|
bool knockdown = mPtr.getClass().getCreatureStats(mPtr).getKnockedDown();
|
||||||
bool block = mPtr.getClass().getCreatureStats(mPtr).getBlock();
|
bool block = mPtr.getClass().getCreatureStats(mPtr).getBlock();
|
||||||
bool isSwimming = MWBase::Environment::get().getWorld()->isSwimming(mPtr);
|
bool isSwimming = MWBase::Environment::get().getWorld()->isSwimming(mPtr);
|
||||||
MWWorld::TimeStamp currentTime = MWBase::Environment::get().getWorld()->getTimeStamp();
|
|
||||||
float timeScale = MWBase::Environment::get().getWorld()->getTimeScaleFactor();
|
|
||||||
if(mHitState == CharState_None)
|
if(mHitState == CharState_None)
|
||||||
{
|
{
|
||||||
if ((mPtr.getClass().getCreatureStats(mPtr).getFatigue().getCurrent() < 0
|
if ((mPtr.getClass().getCreatureStats(mPtr).getFatigue().getCurrent() < 0
|
||||||
|| mPtr.getClass().getCreatureStats(mPtr).getFatigue().getBase() == 0)
|
|| mPtr.getClass().getCreatureStats(mPtr).getFatigue().getBase() == 0)
|
||||||
&& mAnimation->hasAnimation("knockout"))
|
&& mAnimation->hasAnimation("knockout"))
|
||||||
{
|
{
|
||||||
mKnockoutTime = MWBase::Environment::get().getWorld()->getTimeStamp();
|
mTimeToWake = time(NULL);
|
||||||
|
mTimeToWake += rand() % 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;
|
||||||
|
@ -342,7 +341,7 @@ void CharacterController::refreshHitRecoilAnims()
|
||||||
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
|
||||||
&& (currentTime - mKnockoutTime) > 3*timeScale/3600) //Wait 3 seconds before getting up
|
&& time(NULL) > mTimeToWake)
|
||||||
{
|
{
|
||||||
mHitState = isSwimming ? CharState_SwimKnockDown : CharState_KnockDown;
|
mHitState = isSwimming ? CharState_SwimKnockDown : CharState_KnockDown;
|
||||||
mAnimation->disable(mCurrentHit);
|
mAnimation->disable(mCurrentHit);
|
||||||
|
|
|
@ -197,7 +197,7 @@ class CharacterController : public MWRender::Animation::TextKeyListener
|
||||||
float mSecondsOfSwimming;
|
float mSecondsOfSwimming;
|
||||||
float mSecondsOfRunning;
|
float mSecondsOfRunning;
|
||||||
|
|
||||||
MWWorld::TimeStamp mKnockoutTime;
|
time_t mTimeToWake;
|
||||||
|
|
||||||
MWWorld::ConstPtr mHeadTrackTarget;
|
MWWorld::ConstPtr mHeadTrackTarget;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue