Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
breathvapourmdfr.c
Go to the documentation of this file.
1 const int BREATH_VAPOUR_LEVEL_MAX = 3;
2 
3 class BreathVapourMdfr extends ModifierBase
4 {
5  override void Init()
6  {
7  m_TrackActivatedTime = false;
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  {
49  float value = Math.InverseLerp( PlayerConstants.BREATH_VAPOUR_THRESHOLD_LOW, PlayerConstants.BREATH_VAPOUR_THRESHOLD_HIGH,air_temperature);
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 };
ActivateCondition
bool ActivateCondition(PlayerBase player)
Definition: modifierbase.c:174
OnReconnect
void OnReconnect(PlayerBase player)
is called when a modifier is being re-activated upon player server connection, use to activate system...
Definition: modifierbase.c:191
BREATH_VAPOUR_LEVEL_MAX
const int BREATH_VAPOUR_LEVEL_MAX
Definition: breathvapourmdfr.c:1
m_TickIntervalActive
float m_TickIntervalActive
Definition: modifierbase.c:19
m_TrackActivatedTime
bool m_TrackActivatedTime
Definition: modifierbase.c:15
GetDebugTextSimple
string GetDebugTextSimple()
Definition: modifierbase.c:73
DisableDeactivateCheck
void DisableDeactivateCheck()
Definition: modifierbase.c:83
PlayerBase
Definition: playerbaseclient.c:1
PlayerConstants
Definition: playerconstants.c:1
Init
class InventoryGridController extends ScriptedWidgetEventHandler Init
Definition: uihintpanel.c:46
GetDebugText
string GetDebugText()
Definition: modifierbase.c:68
m_TickIntervalInactive
float m_TickIntervalInactive
Definition: modifierbase.c:18
eModifiers
eModifiers
Definition: emodifiers.c:1
ModifierBase
Definition: breathvapourmdfr.c:3
OnTick
private void OnTick(PlayerBase player, float deltaT)
Definition: modifierbase.c:234
Math
Definition: enmath.c:6
DeactivateCondition
bool DeactivateCondition(PlayerBase player)
Definition: modifierbase.c:179
m_ID
protected int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition: effect.c:49
DEFAULT_TICK_TIME_INACTIVE
const int DEFAULT_TICK_TIME_INACTIVE
Definition: modifiersmanager.c:33