DayZ 1.24
Loading...
Searching...
No Matches
CorpseData Class Reference
Collaboration diagram for CorpseData:
[legend]

Private Member Functions

void CorpseData (notnull PlayerBase player, int time_of_death)
 
void UpdateCorpseState (bool force_check=false)
 

Private Attributes

const int GET_LIFETIME_TRIES_MAX = 3
 
bool m_bUpdate
 
int m_iLastUpdateTime
 
int m_iTimeOfDeath
 
int m_iMaxLifetime
 
int m_iCorpseState
 
int m_iTriesToGetLifetime
 
PlayerBase m_Player
 

Detailed Description

Definition at line 1 of file CorpseData.c.

Constructor & Destructor Documentation

◆ CorpseData()

void CorpseData::CorpseData ( notnull PlayerBase player,
int time_of_death )
inlineprivate

Definition at line 13 of file CorpseData.c.

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 }
int m_iTriesToGetLifetime
Definition CorpseData.c:10
int m_iMaxLifetime
Definition CorpseData.c:8
int m_iTimeOfDeath
Definition CorpseData.c:7
PlayerBase m_Player
Definition CorpseData.c:11
int m_iLastUpdateTime
Definition CorpseData.c:6
bool m_bUpdate
Definition CorpseData.c:5
int m_iCorpseState
Definition CorpseData.c:9
static const int CORPSE_STATE_FRESH

References PlayerConstants::CORPSE_STATE_FRESH, m_bUpdate, m_iCorpseState, m_iLastUpdateTime, m_iMaxLifetime, m_iTimeOfDeath, m_iTriesToGetLifetime, and m_Player.

Member Function Documentation

◆ UpdateCorpseState()

void CorpseData::UpdateCorpseState ( bool force_check = false)
inlineprivate

Definition at line 29 of file CorpseData.c.

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 }
const int GET_LIFETIME_TRIES_MAX
Definition CorpseData.c:3
Definition EnMath.c:7
static const int CORPSE_STATE_MEDIUM
static const int CORPSE_STATE_DECAYED
static const float CORPSE_THRESHOLD_MEDIUM
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'.

References Math::Clamp(), PlayerConstants::CORPSE_STATE_DECAYED, PlayerConstants::CORPSE_STATE_FRESH, PlayerConstants::CORPSE_STATE_MEDIUM, PlayerConstants::CORPSE_THRESHOLD_DECAYED, PlayerConstants::CORPSE_THRESHOLD_MEDIUM, GET_LIFETIME_TRIES_MAX, m_bUpdate, m_iCorpseState, m_iMaxLifetime, m_iTriesToGetLifetime, and m_Player.

Member Data Documentation

◆ GET_LIFETIME_TRIES_MAX

const int CorpseData::GET_LIFETIME_TRIES_MAX = 3
private

Definition at line 3 of file CorpseData.c.

Referenced by UpdateCorpseState().

◆ m_bUpdate

bool CorpseData::m_bUpdate
private

Definition at line 5 of file CorpseData.c.

Referenced by CorpseData(), and UpdateCorpseState().

◆ m_iCorpseState

int CorpseData::m_iCorpseState
private

Definition at line 9 of file CorpseData.c.

Referenced by CorpseData(), and UpdateCorpseState().

◆ m_iLastUpdateTime

int CorpseData::m_iLastUpdateTime
private

Definition at line 6 of file CorpseData.c.

Referenced by CorpseData().

◆ m_iMaxLifetime

int CorpseData::m_iMaxLifetime
private

Definition at line 8 of file CorpseData.c.

Referenced by CorpseData(), and UpdateCorpseState().

◆ m_iTimeOfDeath

int CorpseData::m_iTimeOfDeath
private

Definition at line 7 of file CorpseData.c.

Referenced by CorpseData().

◆ m_iTriesToGetLifetime

int CorpseData::m_iTriesToGetLifetime
private

Definition at line 10 of file CorpseData.c.

Referenced by CorpseData(), and UpdateCorpseState().

◆ m_Player

PlayerBase CorpseData::m_Player
private

Definition at line 11 of file CorpseData.c.

Referenced by CorpseData(), and UpdateCorpseState().


The documentation for this class was generated from the following file: