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

◆ ProcessConstructionDecay()

override void ProcessConstructionDecay ( float dTime)
protected

Handles decay for constructed parts, if enabled.

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

308 {
309 float healthTarget;
310 float currentHP;
311 float threshold;
312
313 foreach (ConstructionPart part : m_ConstructionParts)
314 {
315 if (part.IsBuilt() && part.CanPartDecay())
316 {
317 string damageZone;
318 DamageSystem.GetDamageZoneFromComponentName(m_EntityParent,part.GetPartName(),damageZone);
319 if (damageZone != "")
320 {
321 currentHP = m_EntityParent.GetHealth(damageZone,"Health");
322 threshold = part.GetPartDecayThreshold() * m_EntityParent.GetMaxHealth(damageZone,"Health");
323 if (currentHP > threshold)
324 {
325 healthTarget = m_EntityParent.GetHealth(damageZone,"Health") + (dTime * part.GetPartDecayRate() * GetCurrentDecayCoef());
326 healthTarget = Math.Clamp(healthTarget,threshold,m_EntityParent.GetMaxHealth(damageZone,"Health"));
327 m_EntityParent.SetHealth(damageZone,"Health",healthTarget);
328 }
329 }
330 }
331 }
332 }
float GetCurrentDecayCoef()
Определения ConstructionBase.c:334
EntityAI m_EntityParent
Определения ConstructionBase.c:45
Instanced construction part data classes for dynamic data, statics now stored on EntityType level in ...
Определения ConstructionPart.c:4
Определения EnMath.c:7
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::Clamp(), GetCurrentDecayCoef() и m_EntityParent.