Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
temperaturedata.c
Go to the documentation of this file.
2{
5 float m_Value; //target or increment, depends on context!
6 float m_AdjustedTarget; //actual target of the operation (can be adjusted via over-time interpolation, not necessarily the original target value!)
7 float m_UpdateTimeInfo; //if the temperature change was accumulated over some time, pass this info to temperature subsystems
8 float m_UpdateTimeCoef; //multiplies the time
9 float m_HeatPermeabilityCoef; //permeability multiplier (modifies change speed).
10
11 float m_InterpolatedStepSize; //only useful for interpolated temperature values
12 float m_InterpolatedFraction; //only useful for interpolated temperature values
13
14 void TemperatureData(float val, ETemperatureAccessTypes accessType = ETemperatureAccessTypes.ACCESS_UNKNOWN, float time = -1, float timeCoef = 1, float heatPermCoef = 1)
15 {
16 m_Value = val;
17 m_AdjustedTarget = val;
18 m_AccessType = accessType;
19 m_UpdateTimeInfo = time;
20 m_UpdateTimeCoef = timeCoef;
21 m_HeatPermeabilityCoef = heatPermCoef;
22
23 Init();
24 }
25
26 protected void Init()
27 {
28 m_UseGlobalCooling = true;
30 }
31}
32
33class TemperatureDataInterpolated : TemperatureData
34{
35 void InterpolateTemperatureDelta(float start)
36 {
39 float target = m_Value;
42 if (start != target)
43 {
44 float diffAbs = Math.Max(start,target) - Math.Min(start,target);
48 float coef = m_UpdateTimeCoef;
49 float absBaseTempChange = m_UpdateTimeInfo * m_InterpolatedStepSize;
50
51 if (start > target)
52 {
53 absBaseTempChange *= -1;
56 }
57
59 absBaseTempChange *= coef;
60
61 m_AdjustedTarget = start + Math.Clamp(absBaseTempChange,-diffAbs,diffAbs);
62 }
63 }
64}
Definition enmath.c:7
void TemperatureData(float val, ETemperatureAccessTypes accessType=ETemperatureAccessTypes.ACCESS_UNKNOWN, float time=-1, float timeCoef=1, float heatPermCoef=1)
ETemperatureAccessTypes m_AccessType
float m_HeatPermeabilityCoef
string m_Value
Definition enentity.c:808
const float TEMP_COEF_COOLING_GLOBAL
Definition constants.c:952
static const float TEMPERATURE_INTERPOLATION_THRESHOLD_MAX_ABS
Definition constants.c:929
static const float TEMPERATURE_INTERPOLATION_THRESHOLD_MIN_ABS
Definition constants.c:928
static const float TEMPERATURE_RATE_MAX_ABS
Definition constants.c:926
static const float TEMPERATURE_RATE_AVERAGE_ABS
Definition constants.c:925
static proto float Max(float x, float y)
Returns bigger of two given values.
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'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
float m_InterpolatedStepSize
float m_InterpolatedFraction
float m_AdjustedTarget
float m_HeatPermeabilityCoef
float m_UpdateTimeInfo
float m_UpdateTimeCoef
bool m_UseGlobalCooling
class TemperatureData InterpolateTemperatureDelta(float start)