Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
influenza.c
Go to the documentation of this file.
2{
3 const int AGENT_THRESHOLD_ACTIVATE = 600;
5
6 private const int COUGH_RND_DIVIDER_NORMAL_MIN = 5;
7 private const int COUGH_RND_DIVIDER_NORMAL_MAX = 20;
8 private const int COUGH_RND_DIVIDER_SUPPRESSED_MIN = 10;
9 private const int COUGH_RND_DIVIDER_SUPPRESSED_MAX = 40;
10
11 private const int TEMPORARY_RESISTANCE_TIME = 300;
12
14
23
24 override string GetDebugText()
25 {
26 return ("Activate threshold: "+AGENT_THRESHOLD_ACTIVATE + "| " +"Deativate threshold: "+AGENT_THRESHOLD_DEACTIVATE);
27 }
28
29 override protected bool ActivateCondition(PlayerBase player)
30 {
31 if (player.GetSingleAgentCount(eAgents.INFLUENZA) >= AGENT_THRESHOLD_ACTIVATE)
32 return true;
33
34 return false;
35 }
36
37 override protected void OnActivate(PlayerBase player)
38 {
39 player.IncreaseDiseaseCount();
40
41 m_ModifiersManager = player.GetModifiersManager();
42 }
43
44 override protected void OnDeactivate(PlayerBase player)
45 {
46 player.DecreaseDiseaseCount();
47
48 player.SetTemporaryResistanceToAgent(eAgents.INFLUENZA, TEMPORARY_RESISTANCE_TIME);
49 }
50
51 override protected bool DeactivateCondition(PlayerBase player)
52 {
53 return (player.GetSingleAgentCount(eAgents.INFLUENZA) <= AGENT_THRESHOLD_DEACTIVATE);
54 }
55
56 override protected void OnTick(PlayerBase player, float deltaT)
57 {
58 float chanceOfCough = Math.Clamp(player.GetSingleAgentCountNormalized(eAgents.INFLUENZA),0,0.85);
59
61 if (m_ModifiersManager.IsModifierActive(eModifiers.MDF_PAINKILLERS) || m_ModifiersManager.IsModifierActive(eModifiers.MDF_MORPHINE))
63
64 if (Math.RandomFloat01() < chanceOfCough / coughRandomDivider)
65 {
66 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
67 }
68 }
69}
ModifiersManager m_ModifiersManager
Definition influenza.c:13
const int AGENT_THRESHOLD_ACTIVATE
Definition influenza.c:3
const int COUGH_RND_DIVIDER_SUPPRESSED_MAX
Definition influenza.c:9
const int COUGH_RND_DIVIDER_NORMAL_MAX
Definition influenza.c:7
bool ActivateCondition(PlayerBase player)
Definition influenza.c:29
override string GetDebugText()
Definition influenza.c:24
override void Init()
Definition influenza.c:15
bool DeactivateCondition(PlayerBase player)
Definition influenza.c:51
const int AGENT_THRESHOLD_DEACTIVATE
Definition influenza.c:4
void OnTick(PlayerBase player, float deltaT)
Definition influenza.c:56
const int TEMPORARY_RESISTANCE_TIME
Definition influenza.c:11
const int COUGH_RND_DIVIDER_SUPPRESSED_MIN
Definition influenza.c:8
void OnActivate(PlayerBase player)
Definition influenza.c:37
void OnDeactivate(PlayerBase player)
Definition influenza.c:44
const int COUGH_RND_DIVIDER_NORMAL_MIN
Definition influenza.c:6
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
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition enmath.c:126
bool m_TrackActivatedTime
overall time this modifier was active
bool m_AnalyticsStatsEnabled
float m_TickIntervalActive
float m_TickIntervalInactive
const int DEFAULT_TICK_TIME_INACTIVE
void ModifiersManager(PlayerBase player)
enum eModifierSyncIDs DEFAULT_TICK_TIME_ACTIVE