Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
contamination2.c
Go to the documentation of this file.
2 {
3  static const int AGENT_THRESHOLD_ACTIVATE = 100;
4  static const int AGENT_THRESHOLD_DEACTIVATE = 400;
5 
6  static const int EVENT_1_INTERVAL_MIN = 20;
7  static const int EVENT_1_INTERVAL_MAX = 40;
8 
9  protected float m_NextEvent1;
10  protected float m_Time1;
11 
12 
13  static const int EVENT_2_INTERVAL_MIN = 200;
14  static const int EVENT_2_INTERVAL_MAX = 400;
15 
16  protected float m_NextEvent2;
17  protected float m_Time2;
18 
19  override void Init()
20  {
21  m_ID = eModifiers.MDF_CONTAMINATION2;
24  m_SyncID = eModifierSyncIDs.MODIFIER_SYNC_CONTAMINATION2;
25  }
26 
27  override string GetDebugText()
28  {
29  return ("Activate threshold: "+AGENT_THRESHOLD_ACTIVATE + "| " +"Deativate threshold: "+AGENT_THRESHOLD_DEACTIVATE);
30  }
31 
32  override protected bool ActivateCondition(PlayerBase player)
33  {
34  return ( player.GetSingleAgentCount(eAgents.CHEMICAL_POISON) >= AGENT_THRESHOLD_ACTIVATE && player.GetSingleAgentCount(eAgents.CHEMICAL_POISON) < AGENT_THRESHOLD_DEACTIVATE);
35  }
36 
37  override protected void OnActivate(PlayerBase player)
38  {
39  player.IncreaseDiseaseCount();
40  m_NextEvent1 = Math.RandomFloatInclusive( EVENT_1_INTERVAL_MIN, EVENT_1_INTERVAL_MAX );
41  m_NextEvent2 = Math.RandomFloatInclusive( EVENT_2_INTERVAL_MIN, EVENT_2_INTERVAL_MAX );
42  }
43 
44  override protected void OnDeactivate(PlayerBase player)
45  {
46  player.DecreaseDiseaseCount();
47  }
48 
49  override protected bool DeactivateCondition(PlayerBase player)
50  {
51  return !ActivateCondition(player);
52  }
53 
54  override protected void OnTick(PlayerBase player, float deltaT)
55  {
56 
57  m_Time1 += deltaT;
58  m_Time2 += deltaT;
59 
60 
61  if ( m_Time1 >= m_NextEvent1 )
62  {
63  player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
64  m_Time1 = 0;
65  m_NextEvent1 = Math.RandomFloatInclusive( EVENT_1_INTERVAL_MIN, EVENT_1_INTERVAL_MAX );
66  }
67  if ( m_Time2 >= m_NextEvent2 )
68  {
69  player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_VOMIT);
70  m_Time2 = 0;
71  m_NextEvent2 = Math.RandomFloatInclusive( EVENT_2_INTERVAL_MIN, EVENT_2_INTERVAL_MAX );
72  }
73 
74  }
75 };
m_SyncID
eModifierSyncIDs m_SyncID
Definition: modifierbase.c:29
m_TickIntervalActive
float m_TickIntervalActive
Definition: modifierbase.c:19
DEFAULT_TICK_TIME_ACTIVE
const int DEFAULT_TICK_TIME_ACTIVE
Definition: modifiersmanager.c:31
PlayerBase
Definition: playerbaseclient.c:1
eAgents
eAgents
Definition: eagents.c:2
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
ContaminationStage2Mdfr
Definition: contamination2.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