Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
fever.c
Go to the documentation of this file.
2 {
3  private float m_Time;
4  private float m_NextEvent;
5 
6  static const float EVENT_INTERVAL_MIN = 12;
7  static const float EVENT_INTERVAL_MAX = 18;
8 
9 
10  override void Init()
11  {
12  m_TrackActivatedTime = false;
13  m_ID = eModifiers.MDF_FEVER;
16  m_SyncID = eModifierSyncIDs.MODIFIER_SYNC_FEVER;
17  }
18  override bool ActivateCondition(PlayerBase player)
19  {
20  return (player.GetModifiersManager().IsModifierActive(eModifiers.MDF_CHOLERA) || player.GetModifiersManager().IsModifierActive(eModifiers.MDF_INFLUENZA) || player.GetModifiersManager().IsModifierActive(eModifiers.MDF_WOUND_INFECTION2));
21  }
22 
23  override void OnActivate(PlayerBase player)
24  {
25  if( player.m_NotifiersManager )
26  player.m_NotifiersManager.ActivateByType(eNotifiers.NTF_FEVERISH);
27 
28  player.GetSymptomManager().QueueUpSecondarySymptom(SymptomIDs.SYMPTOM_FEVERBLUR);
29  }
30 
31  override void OnReconnect(PlayerBase player)
32  {
33  this.OnActivate(player);
34  }
35 
36 
37  override void OnDeactivate(PlayerBase player)
38  {
39  if( player.m_NotifiersManager )
40  player.m_NotifiersManager.DeactivateByType(eNotifiers.NTF_FEVERISH);
41  player.GetSymptomManager().RemoveSecondarySymptom(SymptomIDs.SYMPTOM_FEVERBLUR);
42  }
43 
44 
45  override bool DeactivateCondition(PlayerBase player)
46  {
47  return !ActivateCondition(player);
48  }
49 
50  override void OnTick(PlayerBase player, float deltaT)
51  {
52  float water_loss = deltaT * PlayerConstants.WATER_LOSS_FEVER;
53  player.GetStatWater().Add(-water_loss);
54 
55  m_Time += deltaT;
56 
57  if ( m_Time >= m_NextEvent )
58  {
59  m_Time = 0;
60  m_NextEvent = Math.RandomFloatInclusive( EVENT_INTERVAL_MIN, EVENT_INTERVAL_MAX );
61 
62  player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_HOT);
63  }
64  }
65 };
m_Time
protected float m_Time
Definition: carscript.c:146
m_SyncID
eModifierSyncIDs m_SyncID
Definition: modifierbase.c:29
m_TickIntervalActive
float m_TickIntervalActive
Definition: modifierbase.c:19
m_TrackActivatedTime
bool m_TrackActivatedTime
Definition: modifierbase.c:15
FeverMdfr
Definition: fever.c:1
PlayerBase
Definition: playerbaseclient.c:1
PlayerConstants
Definition: playerconstants.c:1
DEFAULT_TICK_TIME_ACTIVE_SHORT
const int DEFAULT_TICK_TIME_ACTIVE_SHORT
Definition: modifiersmanager.c:32
m_TickIntervalInactive
float m_TickIntervalInactive
Definition: modifierbase.c:18
eModifiers
eModifiers
Definition: emodifiers.c:1
ModifierBase
Definition: breathvapourmdfr.c:3
eModifierSyncIDs
eModifierSyncIDs
Definition: modifiersmanager.c:2
eNotifiers
eNotifiers
Definition: notifiersmanager.c:1
Math
Definition: enmath.c:6
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