DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
AreaExposure.c
См. документацию.
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
20
33
34 override bool ActivateCondition(PlayerBase player)
35 {
36 return false;
37 }
38
39 override void OnActivate(PlayerBase player)
40 {
42 if (data)
43 {
44 MiscGameplayFunctions.TeleportCheck(player, data.SafePositions);
45 player.SetPersistentFlag(PersistentFlag.AREA_PRESENCE, false);
46 }
47
48 //make the player cough immediately
49 float transmitted = TransmitAgents(player, 1);
50 if(transmitted)
51 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
52
54 }
55
56 override void OnDeactivate(PlayerBase player)
57 {
58 }
59
60 override bool DeactivateCondition(PlayerBase player)
61 {
62 return false;
63 }
64
65 override void OnTick(PlayerBase player, float deltaT)
66 {
67 #ifdef DEVELOPER
68 if(!player.GetCanBeDestroyed())
69 return;
70 #endif
71
72 float transmitted = TransmitAgents(player, AGENTS_PER_SEC * deltaT);
73
74 m_Time2 += deltaT;
75
76 if (transmitted)
77 {
78 m_Time1 += deltaT;
79 if (m_Time1 >= m_NextEvent1 )
80 {
81 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
82
83 if(Math.RandomFloat01() < 0.25)//creates a cough cooldown once in a while
84 {
86 }
87 else
88 {
90 }
91
92 m_Time1 = 0;
93 }
94 }
95
96 if ( m_Time2 >= m_NextEvent2 )
97 {
99 m_Time2 = 0;
101 }
102
103 ApplyAgentsToBleedingSources(player, deltaT);
104
105 }
106
107 void ApplyAgentsToBleedingSources(PlayerBase player, float deltaT)
108 {
109
110 int count = player.GetBleedingSourceCount();
111 float agent_dose = count * AGENT_DOSE_PER_BS_SEC * deltaT;
112 player.InsertAgent(eAgents.CHEMICAL_POISON, agent_dose);
113
114 }
115
117 {
118 int free_bs_locations = 0;//bitmask where each bit set to 1 represents available bleeding source location
119 set<int> list = player.GetBleedingManagerServer().GetBleedingSourcesLocations();
120
121 foreach(int location: list)
122 {
123 float prot_level = PluginTransmissionAgents.GetProtectionLevelEx(DEF_CHEMICAL, location, player, true);
124 float dice_throw = Math.RandomFloat01();
125 if(dice_throw > prot_level)
126 {
127 free_bs_locations = player.GetBleedingManagerServer().GetFreeBleedingSourceBitsByInvLocation(location) | free_bs_locations;
128 }
129 }
130
131 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
132
133 if ( num_of_free_bs > 0 )
134 {
135 int random_bs_index = Math.RandomIntInclusive(0, num_of_free_bs - 1 );// - 1 on the max to convert count to index
136 int random_bs_bit = Math.Pow(2, Math.GetNthBitSet(free_bs_locations,random_bs_index));
137 player.GetBleedingManagerServer().AttemptAddBleedingSourceDirectly(random_bs_bit, eBleedingSourceType.CONTAMINATED);
138 }
139 }
140
141 float TransmitAgents(PlayerBase player, float count)
142 {
143 PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
144 return plugin.TransmitAgentsEx(null, player, AGT_AIRBOURNE_CHEMICAL, count, eAgents.CHEMICAL_POISON);
145 }
146
147
148};
eBleedingSourceType
Определения BleedingSource.c:2
eAgents
Определения EAgents.c:3
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Определения Effect.c:49
bool m_TrackActivatedTime
overall time this modifier was active
Определения ModifierBase.c:14
void DisableDeactivateCheck()
Определения ModifierBase.c:86
void DisableActivateCheck()
Определения ModifierBase.c:81
bool m_AnalyticsStatsEnabled
Определения ModifierBase.c:31
eModifierSyncIDs m_SyncID
Определения ModifierBase.c:28
float m_TickIntervalActive
Определения ModifierBase.c:18
float m_TickIntervalInactive
Определения ModifierBase.c:17
eModifierSyncIDs
Определения ModifiersManager.c:3
const int DEFAULT_TICK_TIME_ACTIVE_SHORT
Определения ModifiersManager.c:28
const int DEFAULT_TICK_TIME_INACTIVE_LONG
Определения ModifiersManager.c:30
PersistentFlag
Определения PersistentFlag.c:6
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
void ApplyAgentsToBleedingSources(PlayerBase player, float deltaT)
Определения AreaExposure.c:107
const int EVENT_1_INTERVAL_MIN
Определения AreaExposure.c:3
const float AGENT_DOSE_PER_BS_SEC
Определения AreaExposure.c:14
const int EVENT_2_INTERVAL_MAX
Определения AreaExposure.c:11
float m_Time1
Определения AreaExposure.c:8
float TransmitAgents(PlayerBase player, float count)
Определения AreaExposure.c:141
const int EVENT_2_INTERVAL_MIN
Определения AreaExposure.c:10
void BleedingSourceCreateCheck(PlayerBase player)
Определения AreaExposure.c:116
override void OnTick(PlayerBase player, float deltaT)
Определения AreaExposure.c:65
override bool DeactivateCondition(PlayerBase player)
Определения AreaExposure.c:60
override bool ActivateCondition(PlayerBase player)
Определения AreaExposure.c:34
float m_Time2
Определения AreaExposure.c:17
const float AGENTS_PER_SEC
Определения AreaExposure.c:6
float m_NextEvent1
Определения AreaExposure.c:7
override void Init()
Определения AreaExposure.c:21
const int EVENT_1_INTERVAL_MAX
Определения AreaExposure.c:4
override void OnDeactivate(PlayerBase player)
Определения AreaExposure.c:56
override void OnActivate(PlayerBase player)
Определения AreaExposure.c:39
float m_NextEvent2
Определения AreaExposure.c:16
Определения AreaExposure.c:2
static JsonDataContaminatedAreas GetData()
Определения ContaminatedAreaLoader.c:101
ref array< ref array< float > > SafePositions
Определения JsonDataContaminatedArea.c:5
Определения EnMath.c:7
Определения BreathVapourMdfr.c:4
Определения PlayerBaseClient.c:2
eModifiers
Определения eModifiers.c:2
const int DEF_CHEMICAL
Определения constants.c:511
const int AGT_AIRBOURNE_CHEMICAL
Определения constants.c:505
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Определения EnMath.c:126
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Определения 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].
Определения EnMath.c:54