Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
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 {
22 m_ID = eModifiers.MDF_CONTAMINATION2;
25 m_SyncID = eModifierSyncIDs.MODIFIER_SYNC_CONTAMINATION2;
26 }
27
28 override string GetDebugText()
29 {
30 return ("Activate threshold: "+AGENT_THRESHOLD_ACTIVATE + "| " +"Deativate threshold: "+AGENT_THRESHOLD_DEACTIVATE);
31 }
32
33 override protected bool ActivateCondition(PlayerBase player)
34 {
35 return ( player.GetSingleAgentCount(eAgents.CHEMICAL_POISON) >= AGENT_THRESHOLD_ACTIVATE && player.GetSingleAgentCount(eAgents.CHEMICAL_POISON) < AGENT_THRESHOLD_DEACTIVATE);
36 }
37
38 override protected void OnActivate(PlayerBase player)
39 {
40 player.IncreaseDiseaseCount();
41 m_NextEvent1 = Math.RandomFloatInclusive( EVENT_1_INTERVAL_MIN, EVENT_1_INTERVAL_MAX );
43 }
44
45 override protected void OnDeactivate(PlayerBase player)
46 {
47 player.DecreaseDiseaseCount();
48 }
49
50 override protected bool DeactivateCondition(PlayerBase player)
51 {
52 return !ActivateCondition(player);
53 }
54
55 override protected void OnTick(PlayerBase player, float deltaT)
56 {
57
58 m_Time1 += deltaT;
59 m_Time2 += deltaT;
60
61
62 if ( m_Time1 >= m_NextEvent1 )
63 {
64 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
65 m_Time1 = 0;
66 m_NextEvent1 = Math.RandomFloatInclusive( EVENT_1_INTERVAL_MIN, EVENT_1_INTERVAL_MAX );
67 }
68 if ( m_Time2 >= m_NextEvent2 )
69 {
70 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_VOMIT);
71 m_Time2 = 0;
73 }
74
75 }
76};
bool DeactivateCondition(PlayerBase player)
static const int EVENT_2_INTERVAL_MIN
void OnDeactivate(PlayerBase player)
void OnActivate(PlayerBase player)
static const int EVENT_2_INTERVAL_MAX
bool ActivateCondition(PlayerBase player)
override string GetDebugText()
void OnTick(PlayerBase player, float deltaT)
Definition enmath.c:7
eAgents
Definition eagents.c:3
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
HeavyMetalMdfr AGENT_THRESHOLD_ACTIVATE
bool m_AnalyticsStatsEnabled
eModifierSyncIDs m_SyncID
float m_TickIntervalActive
float m_TickIntervalInactive
eModifierSyncIDs
const int DEFAULT_TICK_TIME_INACTIVE
enum eModifierSyncIDs DEFAULT_TICK_TIME_ACTIVE