DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ HandleCoughing()

void HandleCoughing ( PlayerBase player,
float sandstormIntensity,
float deltaTime )
protected

См. определение в файле SandstormExposure.c строка 124

125 {
128 query.m_Placement = ECachedEquipmentPlacement.ATTACHMENT;
129 query.m_MaximumDepth = 2;
130
131 float protectionLevel = 0.0;
132 ItemBase coverItem = null;
133 array<Entity> coverItems = player.GetCachedEquipment().GetEntitiesByCategory(query);
134 int coverItemsCount = coverItems.Count();
135 for (int i = 0; i < coverItemsCount; ++i)
136 {
137 coverItem = ItemBase.Cast(coverItems[i]);
138 protectionLevel = coverItem.GetProtectionLevel(DEF_DUST_PARTICLE_BREATH);
139 if (protectionLevel > 0.0)
140 break;
141 }
142
143 float coughIntensity = Math.Clamp(sandstormIntensity - protectionLevel, 0.0, 1.0);;
144 float coughInterval = Math.Lerp(COUGH_INTERVAL_MAX, COUGH_INTERVAL_MIN, coughIntensity);
145
146 if (coughIntensity > 0.0)
147 m_CoughTimer += deltaTime;
148 else
149 m_CoughTimer = 0.0;
150
151 if (m_CoughTimer >= coughInterval)
152 {
153 m_CoughTimer = 0.0;
154
155 Math.Randomize(Math.RandomInt(1, 1000));
156 float rand = Math.RandomFloat01();
157 if (rand <= coughIntensity)
158 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
159 }
160 }
ECachedEquipmentItemCategory
Определения ECachedEquipmentItemCategory.c:2
ECachedEquipmentPlacement
Определения ECachedEquipmentPlacement.c:2
const float COUGH_INTERVAL_MAX
seconds
Определения SandstormExposure.c:86
float m_CoughTimer
Определения SandstormExposure.c:90
SandstormExposureStaticMdfr COUGH_INTERVAL_MIN
ECachedEquipmentItemCategory m_Category
Определения CachedEquipmentStorageBase.c:5
ECachedEquipmentPlacement m_Placement
Определения CachedEquipmentStorageBase.c:6
Определения EnMath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
const int DEF_DUST_PARTICLE_BREATH
Определения 3_Game/DayZ/constants.c:549
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Определения EnMath.c:126
static proto int Randomize(int seed)
Sets the seed for the random number generator.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
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 proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].

Перекрестные ссылки Math::Clamp(), COUGH_INTERVAL_MAX, COUGH_INTERVAL_MIN, DEF_DUST_PARTICLE_BREATH, Math::Lerp(), CachedEquipmentStorageQuery::m_Category, m_CoughTimer, CachedEquipmentStorageQuery::m_MaximumDepth, CachedEquipmentStorageQuery::m_Placement, Math::RandomFloat01(), Math::RandomInt() и Math::Randomize().

Используется в OnTick().