DayZ 1.24
Loading...
Searching...
No Matches
Salmonella.c
Go to the documentation of this file.
2{
3 static const int AGENT_THRESHOLD_ACTIVATE = 60;
4 static const int AGENT_THRESHOLD_DEACTIVATE = 20;
5
6 static const int CHANCE_OF_VOMIT = 10; // base vomit chance
7 static const int CHANCE_OF_VOMIT_AGENT = 20; // adjusted by the agent count
8 static const int WATER_DRAIN_FROM_VOMIT = 450;
9 static const int ENERGY_DRAIN_FROM_VOMIT = 310;
10 static const float STOMACH_MIN_VOLUME = 200; // min volume of stomach for vomit symptom
11
12 static const float EVENT_INTERVAL_MIN = 12;
13 static const float EVENT_INTERVAL_MAX = 18;
14
15
16 float m_Time;
18
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 if (player.GetSingleAgentCount(eAgents.SALMONELLA) >= AGENT_THRESHOLD_ACTIVATE)
35 return true;
36 else
37 return false;
38 }
39
40 override protected void OnActivate(PlayerBase player)
41 {
42 //if( player.m_NotifiersManager ) player.m_NotifiersManager.ActivateByType(eNotifiers.NTF_SICK);
43 player.IncreaseDiseaseCount();
44 }
45
46 override protected void OnDeactivate(PlayerBase player)
47 {
48 player.DecreaseDiseaseCount();
49 }
50
51 override protected bool DeactivateCondition(PlayerBase player)
52 {
53 if (player.GetSingleAgentCount(eAgents.SALMONELLA) <= AGENT_THRESHOLD_DEACTIVATE)
54 return true;
55 else
56 return false;
57 }
58
59 override protected void OnTick(PlayerBase player, float deltaT)
60 {
61 float stomach_volume = player.m_PlayerStomach.GetStomachVolume();
63 {
64 int roll = Math.RandomInt(0, 100);
65 int chance_of_vomit = CHANCE_OF_VOMIT + (CHANCE_OF_VOMIT_AGENT * player.GetSingleAgentCountNormalized(eAgents.SALMONELLA));
67 {
68 SymptomBase symptom = player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_VOMIT);
69
70 if (symptom)
71 {
72 symptom.SetDuration(5);
73
74 // figure something more clever
75 if (m_Player.GetStatWater().Get() > WATER_DRAIN_FROM_VOMIT)
76 m_Player.GetStatWater().Add(-1 * WATER_DRAIN_FROM_VOMIT);
77 if (m_Player.GetStatEnergy().Get() > ENERGY_DRAIN_FROM_VOMIT)
78 m_Player.GetStatEnergy().Add(-1 * ENERGY_DRAIN_FROM_VOMIT);
79 }
80 }
81 }
82
83 m_Time += deltaT;
84
85 if (m_Time >= m_NextEvent)
86 {
87 m_Time = 0;
89 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_PAIN_LIGHT);
90 }
91
92
93 }
94};
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:49
DayZPlayer m_Player
Definition Hand_Events.c:42
bool m_TrackActivatedTime
float m_TickIntervalActive
float m_TickIntervalInactive
const int DEFAULT_TICK_TIME_INACTIVE
const int DEFAULT_TICK_TIME_ACTIVE
Definition EnMath.c:7
override string GetDebugText()
Definition Salmonella.c:27
bool DeactivateCondition(PlayerBase player)
Definition Salmonella.c:51
static const float EVENT_INTERVAL_MIN
Definition Salmonella.c:12
static const int WATER_DRAIN_FROM_VOMIT
Definition Salmonella.c:8
void OnTick(PlayerBase player, float deltaT)
Definition Salmonella.c:59
static const int CHANCE_OF_VOMIT
Definition Salmonella.c:6
static const int ENERGY_DRAIN_FROM_VOMIT
Definition Salmonella.c:9
static const float STOMACH_MIN_VOLUME
Definition Salmonella.c:10
void OnDeactivate(PlayerBase player)
Definition Salmonella.c:46
float m_NextEvent
Definition Salmonella.c:17
static const float EVENT_INTERVAL_MAX
Definition Salmonella.c:13
override void Init()
Definition Salmonella.c:19
bool ActivateCondition(PlayerBase player)
Definition Salmonella.c:32
static const int AGENT_THRESHOLD_ACTIVATE
Definition Salmonella.c:3
static const int AGENT_THRESHOLD_DEACTIVATE
Definition Salmonella.c:4
static const int CHANCE_OF_VOMIT_AGENT
Definition Salmonella.c:7
void OnActivate(PlayerBase player)
Definition Salmonella.c:40
eModifiers
Definition eModifiers.c:2
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].