DayZ 1.24
Loading...
Searching...
No Matches
AreaExposureMdfr Class Reference
Inheritance diagram for AreaExposureMdfr:
[legend]
Collaboration diagram for AreaExposureMdfr:
[legend]

Protected Member Functions

override void Init ()
 
override bool ActivateCondition (PlayerBase player)
 
override void OnActivate (PlayerBase player)
 
override void OnDeactivate (PlayerBase player)
 
override bool DeactivateCondition (PlayerBase player)
 
override void OnTick (PlayerBase player, float deltaT)
 
void ApplyAgentsToBleedingSources (PlayerBase player, float deltaT)
 
void BleedingSourceCreateCheck (PlayerBase player)
 
float TransmitAgents (PlayerBase player, float count)
 

Protected Attributes

float m_NextEvent1
 
float m_Time1
 
const int EVENT_2_INTERVAL_MIN = 13
 
const int EVENT_2_INTERVAL_MAX = 18
 
const float AGENT_DOSE_PER_BS_SEC = 0.33
 
float m_NextEvent2
 
float m_Time2
 

Private Attributes

const int EVENT_1_INTERVAL_MIN = 3
 
const int EVENT_1_INTERVAL_MAX = 5
 
const float AGENTS_PER_SEC = 5
 

Detailed Description

Definition at line 1 of file AreaExposure.c.

Member Function Documentation

◆ ActivateCondition()

override bool AreaExposureMdfr::ActivateCondition ( PlayerBase player)
inlineprotected

Definition at line 32 of file AreaExposure.c.

33 {
34 return false;
35 }

◆ ApplyAgentsToBleedingSources()

void AreaExposureMdfr::ApplyAgentsToBleedingSources ( PlayerBase player,
float deltaT )
inlineprotected

Definition at line 99 of file AreaExposure.c.

100 {
101
102 int count = player.GetBleedingSourceCount();
104 player.InsertAgent(eAgents.CHEMICAL_POISON, agent_dose);
105
106 }
eAgents
Definition EAgents.c:3
const float AGENT_DOSE_PER_BS_SEC

References AGENT_DOSE_PER_BS_SEC.

Referenced by OnTick().

◆ BleedingSourceCreateCheck()

void AreaExposureMdfr::BleedingSourceCreateCheck ( PlayerBase player)
inlineprotected

Definition at line 108 of file AreaExposure.c.

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 }
eBleedingSourceType
Definition EnMath.c:7
const int DEF_CHEMICAL
Definition constants.c:479
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:126
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

References DEF_CHEMICAL, Math::GetNthBitSet(), Math::GetNumberOfSetBits(), Math::Pow(), Math::RandomFloat01(), and Math::RandomIntInclusive().

Referenced by OnTick().

◆ DeactivateCondition()

override bool AreaExposureMdfr::DeactivateCondition ( PlayerBase player)
inlineprotected

Definition at line 56 of file AreaExposure.c.

57 {
58 return false;
59 }

◆ Init()

override void AreaExposureMdfr::Init ( )
inlineprotected

Definition at line 20 of file AreaExposure.c.

21 {
23 m_ID = eModifiers.MDF_AREAEXPOSURE;
26 m_SyncID = eModifierSyncIDs.MODIFIER_SYNC_ZONE_EXPOSURE;
29
30 }
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
eModifiers
Definition eModifiers.c:2

References DEFAULT_TICK_TIME_ACTIVE_SHORT, DEFAULT_TICK_TIME_INACTIVE_LONG, DisableActivateCheck(), DisableDeactivateCheck(), m_ID, m_SyncID, m_TickIntervalActive, m_TickIntervalInactive, and m_TrackActivatedTime.

◆ OnActivate()

override void AreaExposureMdfr::OnActivate ( PlayerBase player)
inlineprotected

Definition at line 37 of file AreaExposure.c.

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 }
const int EVENT_1_INTERVAL_MIN
Definition AreaExposure.c:3
float TransmitAgents(PlayerBase player, float count)
const int EVENT_1_INTERVAL_MAX
Definition AreaExposure.c:4
static JsonDataContaminatedAreas GetData()
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106

References EVENT_1_INTERVAL_MAX, EVENT_1_INTERVAL_MIN, EffectAreaLoader::GetData(), m_NextEvent1, Math::RandomFloatInclusive(), and TransmitAgents().

◆ OnDeactivate()

override void AreaExposureMdfr::OnDeactivate ( PlayerBase player)
inlineprotected

Definition at line 52 of file AreaExposure.c.

53 {
54 }

◆ OnTick()

override void AreaExposureMdfr::OnTick ( PlayerBase player,
float deltaT )
inlineprotected

Definition at line 61 of file AreaExposure.c.

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 }
void ApplyAgentsToBleedingSources(PlayerBase player, float deltaT)
const int EVENT_2_INTERVAL_MAX
const int EVENT_2_INTERVAL_MIN
void BleedingSourceCreateCheck(PlayerBase player)
const float AGENTS_PER_SEC
Definition AreaExposure.c:6

References AGENTS_PER_SEC, ApplyAgentsToBleedingSources(), BleedingSourceCreateCheck(), EVENT_1_INTERVAL_MAX, EVENT_1_INTERVAL_MIN, EVENT_2_INTERVAL_MAX, EVENT_2_INTERVAL_MIN, m_NextEvent1, m_NextEvent2, m_Time1, m_Time2, Math::RandomFloat01(), Math::RandomFloatInclusive(), and TransmitAgents().

◆ TransmitAgents()

float AreaExposureMdfr::TransmitAgents ( PlayerBase player,
float count )
inlineprotected

Definition at line 131 of file AreaExposure.c.

132 {
133 PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
134 return plugin.TransmitAgentsEx(null, player, AGT_AIRBOURNE_CHEMICAL, count, eAgents.CHEMICAL_POISON);
135 }
PluginBase GetPlugin(typename plugin_type)
const int AGT_AIRBOURNE_CHEMICAL
Definition constants.c:476

References AGT_AIRBOURNE_CHEMICAL, and GetPlugin().

Referenced by OnActivate(), and OnTick().

Member Data Documentation

◆ AGENT_DOSE_PER_BS_SEC

const float AreaExposureMdfr::AGENT_DOSE_PER_BS_SEC = 0.33
protected

Definition at line 14 of file AreaExposure.c.

Referenced by ApplyAgentsToBleedingSources().

◆ AGENTS_PER_SEC

const float AreaExposureMdfr::AGENTS_PER_SEC = 5
private

Definition at line 6 of file AreaExposure.c.

Referenced by OnTick().

◆ EVENT_1_INTERVAL_MAX

const int AreaExposureMdfr::EVENT_1_INTERVAL_MAX = 5
private

Definition at line 4 of file AreaExposure.c.

Referenced by OnActivate(), and OnTick().

◆ EVENT_1_INTERVAL_MIN

const int AreaExposureMdfr::EVENT_1_INTERVAL_MIN = 3
private

Definition at line 3 of file AreaExposure.c.

Referenced by OnActivate(), and OnTick().

◆ EVENT_2_INTERVAL_MAX

const int AreaExposureMdfr::EVENT_2_INTERVAL_MAX = 18
protected

Definition at line 11 of file AreaExposure.c.

Referenced by OnTick().

◆ EVENT_2_INTERVAL_MIN

const int AreaExposureMdfr::EVENT_2_INTERVAL_MIN = 13
protected

Definition at line 10 of file AreaExposure.c.

Referenced by OnTick().

◆ m_NextEvent1

float AreaExposureMdfr::m_NextEvent1
protected

Definition at line 7 of file AreaExposure.c.

Referenced by OnActivate(), and OnTick().

◆ m_NextEvent2

float AreaExposureMdfr::m_NextEvent2
protected

Definition at line 16 of file AreaExposure.c.

Referenced by OnTick().

◆ m_Time1

float AreaExposureMdfr::m_Time1
protected

Definition at line 8 of file AreaExposure.c.

Referenced by OnTick().

◆ m_Time2

float AreaExposureMdfr::m_Time2
protected

Definition at line 17 of file AreaExposure.c.

Referenced by OnTick().


The documentation for this class was generated from the following file: