Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
commoncold.c
Go to the documentation of this file.
2{
3 const int AGENT_THRESHOLD_ACTIVATE = 100;
5
6 private const int SNEEZE_RND_DIVIDER_NORMAL_MIN = 15;
7 private const int SNEEZE_RND_DIVIDER_NORMAL_MAX = 20;
8 private const int SNEEZE_RND_DIVIDER_SUPPRESSED_MIN = 30;
9 private const int SNEEZE_RND_DIVIDER_SUPPRESSED_MAX = 40;
10
11 private const int TEMPORARY_RESISTANCE_TIME = 900;
12
14
23
24 override string GetDebugText()
25 {
26 return ("Activate threshold: "+AGENT_THRESHOLD_ACTIVATE + "| " +"Deativate threshold: "+AGENT_THRESHOLD_DEACTIVATE);
27 }
28
29 override 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 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_SNEEZE);
43 }
44
45 override protected void OnDeactivate(PlayerBase player)
46 {
47 player.DecreaseDiseaseCount();
48
49 player.SetTemporaryResistanceToAgent(eAgents.INFLUENZA, TEMPORARY_RESISTANCE_TIME);
50 }
51
52 override protected bool DeactivateCondition(PlayerBase player)
53 {
54 return (player.GetSingleAgentCount(eAgents.INFLUENZA) <= AGENT_THRESHOLD_DEACTIVATE);
55 }
56
57 override protected void OnTick(PlayerBase player, float deltaT)
58 {
59 float chanceOfSneeze = Math.Clamp(player.GetSingleAgentCountNormalized(eAgents.INFLUENZA),0.4,0.75);
60
62 if (m_ModifiersManager.IsModifierActive(eModifiers.MDF_PAINKILLERS) || m_ModifiersManager.IsModifierActive(eModifiers.MDF_MORPHINE))
64
65 if (Math.RandomFloat01() < chanceOfSneeze / randomDivider)
66 {
67 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_SNEEZE);
68 }
69 }
70}
ModifiersManager m_ModifiersManager
Definition commoncold.c:13
const int AGENT_THRESHOLD_ACTIVATE
Definition commoncold.c:3
override string GetDebugText()
Definition commoncold.c:24
override void Init()
Definition commoncold.c:15
bool DeactivateCondition(PlayerBase player)
Definition commoncold.c:52
const int AGENT_THRESHOLD_DEACTIVATE
Definition commoncold.c:4
void OnTick(PlayerBase player, float deltaT)
Definition commoncold.c:57
const int TEMPORARY_RESISTANCE_TIME
Definition commoncold.c:11
override bool ActivateCondition(PlayerBase player)
Definition commoncold.c:29
const int SNEEZE_RND_DIVIDER_SUPPRESSED_MAX
Definition commoncold.c:9
void OnActivate(PlayerBase player)
Definition commoncold.c:37
const int SNEEZE_RND_DIVIDER_NORMAL_MIN
Definition commoncold.c:6
void OnDeactivate(PlayerBase player)
Definition commoncold.c:45
const int SNEEZE_RND_DIVIDER_SUPPRESSED_MIN
Definition commoncold.c:8
const int SNEEZE_RND_DIVIDER_NORMAL_MAX
Definition commoncold.c:7
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