Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
influenza.c
Go to the documentation of this file.
1
class
InfluenzaMdfr
:
ModifierBase
2
{
3
const
int
AGENT_THRESHOLD_ACTIVATE
= 600;
4
const
int
AGENT_THRESHOLD_DEACTIVATE
= 400;
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
13
private
ModifiersManager
m_ModifiersManager
;
14
15
override
void
Init
()
16
{
17
m_TrackActivatedTime
=
false
;
18
m_AnalyticsStatsEnabled
=
true
;
19
m_ID
=
eModifiers
.MDF_INFLUENZA;
20
m_TickIntervalInactive
=
DEFAULT_TICK_TIME_INACTIVE
;
21
m_TickIntervalActive
=
DEFAULT_TICK_TIME_ACTIVE
;
22
}
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
60
float
coughRandomDivider =
Math
.
RandomInt
(
COUGH_RND_DIVIDER_NORMAL_MIN
,
COUGH_RND_DIVIDER_NORMAL_MAX
);
61
if
(
m_ModifiersManager
.IsModifierActive(
eModifiers
.MDF_PAINKILLERS) ||
m_ModifiersManager
.IsModifierActive(
eModifiers
.MDF_MORPHINE))
62
coughRandomDivider =
Math
.
RandomInt
(
COUGH_RND_DIVIDER_SUPPRESSED_MIN
,
COUGH_RND_DIVIDER_SUPPRESSED_MAX
);
63
64
if
(
Math
.
RandomFloat01
() < chanceOfCough / coughRandomDivider)
65
{
66
player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
67
}
68
}
69
}
InfluenzaMdfr
Definition
influenza.c:2
InfluenzaMdfr::m_ModifiersManager
ModifiersManager m_ModifiersManager
Definition
influenza.c:13
InfluenzaMdfr::AGENT_THRESHOLD_ACTIVATE
const int AGENT_THRESHOLD_ACTIVATE
Definition
influenza.c:3
InfluenzaMdfr::COUGH_RND_DIVIDER_SUPPRESSED_MAX
const int COUGH_RND_DIVIDER_SUPPRESSED_MAX
Definition
influenza.c:9
InfluenzaMdfr::COUGH_RND_DIVIDER_NORMAL_MAX
const int COUGH_RND_DIVIDER_NORMAL_MAX
Definition
influenza.c:7
InfluenzaMdfr::ActivateCondition
bool ActivateCondition(PlayerBase player)
Definition
influenza.c:29
InfluenzaMdfr::GetDebugText
override string GetDebugText()
Definition
influenza.c:24
InfluenzaMdfr::Init
override void Init()
Definition
influenza.c:15
InfluenzaMdfr::DeactivateCondition
bool DeactivateCondition(PlayerBase player)
Definition
influenza.c:51
InfluenzaMdfr::AGENT_THRESHOLD_DEACTIVATE
const int AGENT_THRESHOLD_DEACTIVATE
Definition
influenza.c:4
InfluenzaMdfr::OnTick
void OnTick(PlayerBase player, float deltaT)
Definition
influenza.c:56
InfluenzaMdfr::TEMPORARY_RESISTANCE_TIME
const int TEMPORARY_RESISTANCE_TIME
Definition
influenza.c:11
InfluenzaMdfr::COUGH_RND_DIVIDER_SUPPRESSED_MIN
const int COUGH_RND_DIVIDER_SUPPRESSED_MIN
Definition
influenza.c:8
InfluenzaMdfr::OnActivate
void OnActivate(PlayerBase player)
Definition
influenza.c:37
InfluenzaMdfr::OnDeactivate
void OnDeactivate(PlayerBase player)
Definition
influenza.c:44
InfluenzaMdfr::COUGH_RND_DIVIDER_NORMAL_MIN
const int COUGH_RND_DIVIDER_NORMAL_MIN
Definition
influenza.c:6
Math
Definition
enmath.c:7
ModifierBase
Definition
breathvapourmdfr.c:4
PlayerBase
Definition
playerbaseclient.c:2
eAgents
eAgents
Definition
eagents.c:3
m_ID
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it).
Definition
effect.c:51
eModifiers
eModifiers
Definition
emodifiers.c:2
Math::RandomInt
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
Math::Clamp
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'.
Math::RandomFloat01
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition
enmath.c:126
m_TrackActivatedTime
bool m_TrackActivatedTime
overall time this modifier was active
Definition
modifierbase.c:14
m_AnalyticsStatsEnabled
bool m_AnalyticsStatsEnabled
Definition
modifierbase.c:31
m_TickIntervalActive
float m_TickIntervalActive
Definition
modifierbase.c:18
m_TickIntervalInactive
float m_TickIntervalInactive
Definition
modifierbase.c:17
DEFAULT_TICK_TIME_INACTIVE
const int DEFAULT_TICK_TIME_INACTIVE
Definition
modifiersmanager.c:29
ModifiersManager
void ModifiersManager(PlayerBase player)
Definition
modifiersmanager.c:80
DEFAULT_TICK_TIME_ACTIVE
enum eModifierSyncIDs DEFAULT_TICK_TIME_ACTIVE
Games
Dayz
scripts
4_world
classes
playermodifiers
modifiers
diseases
influenza.c
Generated by
1.17.0