DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
HeatComfortAnimHandler.c
Go to the documentation of this file.
2{
3 const float TICK_INTERVAL = 2;
7
9 float m_EventTimeFreeze = -1;
10 float m_EventTimeHot = -1;
12
15
18
20 {
21 m_Player = player;
22 }
23
24 void Update(float delta_time, HumanMovementState hms)
25 {
26 m_TimeSinceLastTick += delta_time;
27
29 {
32 }
33 }
34
35 float GetEventTime(float hc_value ,float threshold_low, float threshold_high, float low_min, float high_min, float low_max, float high_max)
36 {
37 float inv_value = Math.InverseLerp(threshold_low, threshold_high, hc_value);
38 float value_min = Math.Lerp(low_min, high_min,inv_value);
39 float value_max = Math.Lerp(low_max,high_max,inv_value);
40
41 return Math.RandomFloatInclusive(value_min,value_max);
42 }
43
44
45 void Process(float delta_time)
46 {
47 if( GetGame().IsServer() )
48 {
49
50 float hc = m_Player.GetStatHeatComfort().Get();
51 float inv_value;
52 float value_min;
53 float value_max;
54 float offset_time;
55
57 {
59
60 if(m_EventTimeFreeze < 0)//if not set
61 {
63 }
64
66 {
69 m_Player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_FREEZE);
70 /*
71 Print("-----======== freezing ========-------");
72 Print(inv_value);
73 Print(value_min);
74 Print(value_max);
75 Print(offset_time);
76 Print("-----======== freezing ========-------");
77 */
78 }
79 }
81 {
83
84 if(m_EventTimeHot < 0)//if not set
85 {
87 }
88
90 {
92 m_EventTimeHot = -1;
93 m_Player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_HOT);
94
95 //Print("-----======== freezing ========-------");
96 //Print(inv_value);
97 //Print(value_min);
98 //Print(value_max);
99 //Print(offset_time);
100 //Print("-----======== freezing ========-------");
101
102 }
103 }
104 }
105 }
106}
float GetEventTime(float hc_value, float threshold_low, float threshold_high, float low_min, float high_min, float low_max, float high_max)
void Update(float delta_time, HumanMovementState hms)
void Process(float delta_time)
void HeatComfortAnimHandler(PlayerBase player)
protected ref HumanMovementState m_MovementState
Definition EnMath.c:7
static const float THRESHOLD_HEAT_COMFORT_MINUS_WARNING
static const float THRESHOLD_HEAT_COMFORT_PLUS_WARNING
static const float THRESHOLD_HEAT_COMFORT_PLUS_EMPTY
static const float THRESHOLD_HEAT_COMFORT_MINUS_EMPTY
proto native CGame GetGame()
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:86
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.