DayZ 1.24
Loading...
Searching...
No Matches
CorpseData.c
Go to the documentation of this file.
2{
3 const int GET_LIFETIME_TRIES_MAX = 3;
4
12
14 {
15 m_bUpdate = true;
18 m_iMaxLifetime = -1;
19 //m_iMaxLifetime = player.GetLifetime(); //player.GetEconomyProfile().GetLifetime();
23
24 /*Print("CorpseData init value | player.GetLifetime(): " + player.GetLifetime() );
25 Print("CorpseData init value | player.GetEconomyProfile().GetLifetime(): " + player.GetEconomyProfile().GetLifetime() );
26 Print("---------------------");*/
27 }
28
29 void UpdateCorpseState(bool force_check = false)
30 {
31 /*Print("CorpseData update value | player.GetLifetime(): " + m_Player.GetLifetime() );
32 Print("CorpseData update value | player.GetEconomyProfile().GetLifetime(): " + m_Player.GetEconomyProfile().GetLifetime() );
33 Print("---------------------");*/
34
35 if (m_iMaxLifetime <= 0)
36 {
38 {
39 m_bUpdate = false;
40 return;
41 }
42 else
43 {
44 m_iMaxLifetime = m_Player.GetLifetime();
45 if (m_iMaxLifetime <= 0) //cleanup time not initialized yet!
46 {
48 m_iMaxLifetime = -1;
50 m_bUpdate = false;
51
52 return;
53 }
54 m_iMaxLifetime -= 30 * m_iTriesToGetLifetime; //adjusts for failed init attempts
55 m_Player.SetLifetime(m_iMaxLifetime);
56 }
57 }
58
60 float fremaining_lifetime = m_Player.GetLifetime();
62
63#ifdef DIAG_DEVELOPER
64 float timeAccel = 1;
65 if (FeatureTimeAccel.GetFeatureTimeAccelEnabled(ETimeAccelCategories.FOOD_DECAY))
66 {
67 timeAccel = FeatureTimeAccel.GetFeatureTimeAccelValue();
70 }
71#endif
72
73 //int current_time = GetGame().GetTime();
74 //float fdecay_percentage_by_game_time = 1 - ((current_time - m_iTimeOfDeath) / 1000 )/m_iMaxLifetime;
75 //Print("fdecay_percentage_by_game_time - " + fdecay_percentage_by_game_time);
76
81 else
82 {
84 m_bUpdate = false;
85 }
86
88 {
89 m_Player.m_CorpseState = m_iCorpseState;
90 m_Player.SetSynchDirty();
91 /*
92 Print("Corpse Syncing | player - " + m_Player);
93 Print("Corpse Syncing | state - " + m_iCorpseState);
94 */
95 }
96 }
97}
int m_iTriesToGetLifetime
Definition CorpseData.c:10
int m_iMaxLifetime
Definition CorpseData.c:8
void CorpseData(notnull PlayerBase player, int time_of_death)
Definition CorpseData.c:13
int m_iTimeOfDeath
Definition CorpseData.c:7
PlayerBase m_Player
Definition CorpseData.c:11
const int GET_LIFETIME_TRIES_MAX
Definition CorpseData.c:3
int m_iLastUpdateTime
Definition CorpseData.c:6
bool m_bUpdate
Definition CorpseData.c:5
void UpdateCorpseState(bool force_check=false)
Definition CorpseData.c:29
int m_iCorpseState
Definition CorpseData.c:9
Definition EnMath.c:7
static const int CORPSE_STATE_MEDIUM
static const int CORPSE_STATE_DECAYED
static const float CORPSE_THRESHOLD_MEDIUM
static const int CORPSE_STATE_FRESH
static const float CORPSE_THRESHOLD_DECAYED
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.