DayZ 1.24
Loading...
Searching...
No Matches
AreaExposure.c
Go to the documentation of this file.
2{
3 const int EVENT_1_INTERVAL_MIN = 3;
4 const int EVENT_1_INTERVAL_MAX = 5;
5
6 const float AGENTS_PER_SEC = 5;
7 protected float m_NextEvent1;
8 protected float m_Time1;
9
10 const int EVENT_2_INTERVAL_MIN = 13;
11 const int EVENT_2_INTERVAL_MAX = 18;
12
13
14 const float AGENT_DOSE_PER_BS_SEC = 0.33;//how many agents will be injected in one sec per a single bleeding source
15
16 protected float m_NextEvent2;
17 protected float m_Time2;
18
19
31
33 {
34 return false;
35 }
36
38 {
39
41 if (data)
42 MiscGameplayFunctions.TeleportCheck(player, data.SafePositions);
43
44 //make the player cough immediately
46 if (transmitted)
47 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
48
50 }
51
53 {
54 }
55
57 {
58 return false;
59 }
60
61 override void OnTick(PlayerBase player, float deltaT)
62 {
63#ifdef DEVELOPER
64 if (!player.GetCanBeDestroyed())
65 return;
66#endif
67
69
70 m_Time2 += deltaT;
71
72 if (transmitted)
73 {
74 m_Time1 += deltaT;
75 if (m_Time1 >= m_NextEvent1)
76 {
77 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
78
79 if (Math.RandomFloat01() < 0.25) //creates a cough cooldown once in a while
81 else
83
84 m_Time1 = 0;
85 }
86 }
87
88 if (m_Time2 >= m_NextEvent2)
89 {
91 m_Time2 = 0;
93 }
94
96
97 }
98
100 {
101
102 int count = player.GetBleedingSourceCount();
104 player.InsertAgent(eAgents.CHEMICAL_POISON, agent_dose);
105
106 }
107
109 {
110 int free_bs_locations = 0;//bitmask where each bit set to 1 represents available bleeding source location
111 set<int> list = player.GetBleedingManagerServer().GetBleedingSourcesLocations();
112
113 foreach (int location: list)
114 {
115 float prot_level = PluginTransmissionAgents.GetProtectionLevelEx(DEF_CHEMICAL, location, player, true);
116 float dice_throw = Math.RandomFloat01();
118 free_bs_locations = player.GetBleedingManagerServer().GetFreeBleedingSourceBitsByInvLocation(location) | free_bs_locations;
119 }
120
121 int num_of_free_bs = Math.GetNumberOfSetBits(free_bs_locations);//gets us the number of bits set to 1, where each represents a free bleeding source location
122
123 if (num_of_free_bs > 0)
124 {
125 int random_bs_index = Math.RandomIntInclusive(0, num_of_free_bs - 1); // - 1 on the max to convert count to index
127 player.GetBleedingManagerServer().AttemptAddBleedingSourceDirectly(random_bs_bit, eBleedingSourceType.CONTAMINATED);
128 }
129 }
130
132 {
133 PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
134 return plugin.TransmitAgentsEx(null, player, AGT_AIRBOURNE_CHEMICAL, count, eAgents.CHEMICAL_POISON);
135 }
136
137
138};
eBleedingSourceType
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
bool m_TrackActivatedTime
void DisableDeactivateCheck()
void DisableActivateCheck()
eModifierSyncIDs m_SyncID
float m_TickIntervalActive
float m_TickIntervalInactive
eModifierSyncIDs
const int DEFAULT_TICK_TIME_ACTIVE_SHORT
const int DEFAULT_TICK_TIME_INACTIVE_LONG
PluginBase GetPlugin(typename plugin_type)
void ApplyAgentsToBleedingSources(PlayerBase player, float deltaT)
const int EVENT_1_INTERVAL_MIN
Definition AreaExposure.c:3
const float AGENT_DOSE_PER_BS_SEC
const int EVENT_2_INTERVAL_MAX
float TransmitAgents(PlayerBase player, float count)
const int EVENT_2_INTERVAL_MIN
void BleedingSourceCreateCheck(PlayerBase player)
override void OnTick(PlayerBase player, float deltaT)
override bool DeactivateCondition(PlayerBase player)
override bool ActivateCondition(PlayerBase player)
const float AGENTS_PER_SEC
Definition AreaExposure.c:6
override void Init()
const int EVENT_1_INTERVAL_MAX
Definition AreaExposure.c:4
override void OnDeactivate(PlayerBase player)
override void OnActivate(PlayerBase player)
static JsonDataContaminatedAreas GetData()
Definition EnMath.c:7
eModifiers
Definition eModifiers.c:2
const int DEF_CHEMICAL
Definition constants.c:479
const int AGT_AIRBOURNE_CHEMICAL
Definition constants.c:476
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:126
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 GetNthBitSet(int value, int n)
returns the the index of n-th bit set in a bit mask counting from the right, for instance,...
static proto float Pow(float v, float power)
Return power of v ^ power.
static proto int GetNumberOfSetBits(int i)
returns the number of bits set in a bitmask i
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54