Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
breathvapourmdfr.c
Go to the documentation of this file.
2
3class BreathVapourMdfr extends ModifierBase
4{
5 override void Init()
6 {
8 m_ID = eModifiers.MDF_BREATH_VAPOUR;
12
13 }
14
15 override bool ActivateCondition(PlayerBase player)
16 {
17 return true;
18 }
19
20 override bool DeactivateCondition(PlayerBase player)
21 {
22 return false;
23 }
24
25 override void OnReconnect(PlayerBase player)
26 {
27
28 }
29
30 override string GetDebugText()
31 {
32 //return m_Player.GetStatHeatComfort().Get().ToString();
33 }
34
35 override string GetDebugTextSimple()
36 {
37 //return m_Player.GetStatHeatComfort().Get().ToString();
38 }
39
40
41 override void OnTick(PlayerBase player, float deltaT)
42 {
43 if( !player.m_Environment.IsTemperatureSet() )
44 return;
45 float air_temperature = player.m_Environment.GetTemperature();
46 int level = 0;//default
47 if( MiscGameplayFunctions.IsValueInRange( air_temperature, PlayerConstants.BREATH_VAPOUR_THRESHOLD_HIGH, PlayerConstants.BREATH_VAPOUR_THRESHOLD_LOW) )
48 {
50 value = Math.Clamp(value,0,1);
51 level = Math.Round(Math.Lerp(1,BREATH_VAPOUR_LEVEL_MAX,value));
52 }
53 else if(air_temperature < PlayerConstants.BREATH_VAPOUR_THRESHOLD_HIGH)
54 {
56 }
57 if( level != player.m_BreathVapour )
58 {
59 player.m_BreathVapour = level;
60 player.SetSynchDirty();
61 }
62 }
63};
const int BREATH_VAPOUR_LEVEL_MAX
Definition enmath.c:7
override bool DeactivateCondition(PlayerBase player)
override void OnReconnect(PlayerBase player)
override string GetDebugText()
override string GetDebugTextSimple()
override void OnTick(PlayerBase player, float deltaT)
override void Init()
override bool ActivateCondition(PlayerBase player)
static const float BREATH_VAPOUR_THRESHOLD_HIGH
static const float BREATH_VAPOUR_THRESHOLD_LOW
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it).
Definition effect.c:51
eModifiers
Definition emodifiers.c:2
static proto float Round(float f)
Returns mathematical round of value.
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 Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
bool m_TrackActivatedTime
overall time this modifier was active
void DisableDeactivateCheck()
float m_TickIntervalActive
float m_TickIntervalInactive
const int DEFAULT_TICK_TIME_INACTIVE