DayZ 1.24
Loading...
Searching...
No Matches
InjuryHandler.c
Go to the documentation of this file.
2{
3 const float WORN = 0.5;
4 const float DAMAGED = 0.3;
5 const float BADLY_DAMAGED = 0.2;
6 const float RUINED = 0.1;
7};
8
10{
11 const float LVL0 = 0;
12 const float LVL1 = 0.3;
13 const float LVL2 = 0.6;
14 const float LVL3 = 0.8;
15 const float LVL4 = 1;
16};
17
26
28{
30 NONE = 0,
34 BROKEN_LEGS = 8, //New
36 PRONE_ANIM_OVERRIDE = 32, //Prevent non pristine animation when prone
37}
38
40{
41
42 const float VALUE_CHECK_INTERVAL = 5;
43 const float SENSITIVTY_PERCENTAGE = 1; //how much the value needs to change up/down from previous update to trigger a new update(in percent)
44
46
51
52
54 private bool m_AnimationChange = false;
55 private bool m_InjuryAnimEnabled = false;
56 private float m_InjuryAnimDamageValue = 0;
58
60 {
62 m_HealthMaxValue = m_Player.GetMaxHealth("", "Health");
63 }
64
66 {
68 }
69
71 {
73 }
74
79
80 void Update(float deltaT)
81 {
83 {
84 m_Player.GetCommandModifier_Additives().SetInjured(m_InjuryAnimDamageValue, m_InjuryAnimEnabled);
85 m_AnimationChange = false;
86 }
87
88 if (GetGame().IsClient())
89 return;
90
92
94 {
95 CheckValue();
97 }
98 }
99
101 {
103
104 //Whatever the case, prone will always use PRISTINE anim level as alternative anim level(s) are not interesting gameplaywise
105 if (m_ForceInjuryAnimMask & eInjuryOverrides.PRONE_ANIM_OVERRIDE && override_level > eInjuryHandlerLevels.PRISTINE)
106 {
108 return override_level;
109 }
110
113
116
119
122
123 //Broken leg overrides
126
128 {
129 //Average leg health used to determine which animation to use
130 float avgLegHealth = m_Player.GetHealth("RightLeg", "") + m_Player.GetHealth("LeftLeg", "") + m_Player.GetHealth("RightFoot", "") + m_Player.GetHealth("LeftFoot", "");
131 avgLegHealth *= 0.25; //divide by 4 to make the average leg health;
136 else
138 }
139
140 return override_level;
141
142 }
143
160
162 {
163 m_Player.m_HealthLevel = level;
164 //Print("m_Player.m_HealthLevel:" + m_Player.m_HealthLevel);
165 m_Player.SetSynchDirty();
166 }
167
172
179
181 {
183 return eInjuryHandlerLevels.RUINED;
184
186 return eInjuryHandlerLevels.BADLY_DAMAGED;
187
189 return eInjuryHandlerLevels.DAMAGED;
190
192 return eInjuryHandlerLevels.WORN;
193
194 return eInjuryHandlerLevels.PRISTINE;
195 }
196
197
199 {
200 switch (level)
201 {
202 case eInjuryHandlerLevels.RUINED:
203 {
204 return InjuryAnimValues.LVL4;
205 }
206 case eInjuryHandlerLevels.BADLY_DAMAGED:
207 {
208 return InjuryAnimValues.LVL3;
209 }
210 case eInjuryHandlerLevels.DAMAGED:
211 {
212 return InjuryAnimValues.LVL2;
213 }
214 case eInjuryHandlerLevels.WORN:
215 {
216 return InjuryAnimValues.LVL1;
217 }
218 case eInjuryHandlerLevels.PRISTINE:
219 {
220 return InjuryAnimValues.LVL0;
221 }
222 default:
223 Error("Undefined Injury level");
224 }
225 return 0;
226 }
227}
void Synchronize()
DayZPlayer m_Player
Definition Hand_Events.c:42
enum eInjuryHandlerLevels MORPHINE
ref ScriptInvoker m_ChangedStateInvoker
float m_LastUpdate
ScriptInvoker GetInvoker()
float GetInjuryValue(eInjuryHandlerLevels level)
float m_InjuryAnimDamageValue
eInjuryHandlerLevels GetOverrideLevel(eInjuryHandlerLevels unchanged_level)
eInjuryHandlerLevels m_LastHealthUpdate
float m_HealthMaxValue
const float SENSITIVTY_PERCENTAGE
void CheckValue(bool forceUpdate=false)
enum eInjuryHandlerLevels PAIN_KILLERS_LVL0
bool m_InjuryAnimEnabled
void SetInjuryCommandParams(bool enable, eInjuryHandlerLevels level)
float GetInjuryAnimValue()
enum eInjuryHandlerLevels VALUE_CHECK_INTERVAL
enum eInjuryHandlerLevels PRONE_ANIM_OVERRIDE
eInjuryHandlerLevels
@ RUINED
@ BADLY_DAMAGED
@ DAMAGED
@ PRISTINE
@ WORN
enum eInjuryHandlerLevels BROKEN_LEGS
void InjuryAnimationHandler(PlayerBase player)
float m_TimeSinceLastTick
bool IsInjuryAnimEnabled()
enum eInjuryHandlerLevels PAIN_KILLERS_LVL1
int m_ForceInjuryAnimMask
bool m_AnimationChange
owner
enum eInjuryHandlerLevels NONE
MUST BE POW2.
eInjuryHandlerLevels GetInjuryLevel(float health)
void SendValue(eInjuryHandlerLevels level)
enum eInjuryHandlerLevels BROKEN_LEGS_SPLINT
static void SendInjury(DayZPlayer pPlayer, bool pEnable, eInjuryHandlerLevels level)
const float LVL4
const float LVL1
const float LVL0
const float LVL2
const float LVL3
static const float BROKEN_LEGS_HIGH_HEALTH_THRESHOLD
static const float BROKEN_LEGS_LOW_HEALTH_THRESHOLD
ScriptInvoker Class provide list of callbacks usage:
Definition tools.c:116
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
proto native volatile void Update()