3 const int GET_LIFETIME_TRIES_MAX = 3;
10 int m_iTriesToGetLifetime;
16 m_iLastUpdateTime = time_of_death;
17 m_iTimeOfDeath = time_of_death;
22 m_iTriesToGetLifetime = 0;
29 void UpdateCorpseState(
bool force_check =
false)
35 if (m_iMaxLifetime <= 0 )
37 if ( m_iCorpseState ==
PlayerConstants.CORPSE_STATE_DECAYED && !force_check )
44 m_iMaxLifetime =
m_Player.GetLifetime();
45 if (m_iMaxLifetime <= 0)
47 m_iTriesToGetLifetime++;
49 if (m_iTriesToGetLifetime >= GET_LIFETIME_TRIES_MAX)
56 m_iMaxLifetime -= 30 * m_iTriesToGetLifetime;
57 m_Player.SetLifetime(m_iMaxLifetime);
61 int ioriginal_state = m_iCorpseState;
62 float fremaining_lifetime =
m_Player.GetLifetime();
63 float fdecay_percentage = fremaining_lifetime/m_iMaxLifetime;
67 if (FeatureTimeAccel.GetFeatureTimeAccelEnabled(ETimeAccelCategories.FOOD_DECAY))
69 timeAccel = FeatureTimeAccel.GetFeatureTimeAccelValue();
70 float percetElapsed = 1-fdecay_percentage;
71 fdecay_percentage =
Math.Clamp(1 - percetElapsed * timeAccel,0,1);
83 else if (fdecay_percentage <= PlayerConstants.CORPSE_THRESHOLD_MEDIUM && fdecay_percentage >
PlayerConstants.CORPSE_THRESHOLD_DECAYED)
93 if (ioriginal_state != m_iCorpseState)
95 m_Player.m_CorpseState = m_iCorpseState;