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

◆ GetEnergyMax()

float ComponentEnergyManager::GetEnergyMax ( )
inlineprotected

Energy manager: Returns the maximum amount of energy this device can curently store. If parameter 'reduceMaxEnergyByDamageCoef' is used in the config of this device then the returned value will be reduced by damage.

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

1298 {
1299 float max_health = 0;
1300
1301 if (m_ThisEntityAI && m_ThisEntityAI.HasDamageSystem())
1302 max_health = m_ThisEntityAI.GetMaxHealth("","");
1303 //else if ( m_ReduceMaxEnergyByDamageCoef != 0 )
1304 // Error("[ERROR] ReduceMaxEnergyByDamageCoef is setup but " + m_ThisEntityAI.GetType() + " does not have a Damage System");
1305
1306 if ( max_health == 0 || m_ReduceMaxEnergyByDamageCoef == 0 )
1307 return GetEnergyMaxPristine();
1308
1309 float health = 100;
1310
1311 if (m_ThisEntityAI && (g_Game.IsServer() || !g_Game.IsMultiplayer())) // TO DO: Remove this IF when method GetHealth can be called on client!
1312 health = m_ThisEntityAI.GetHealth("","");
1313
1314 float damage_coef = 1 - (health / max_health);
1315
1316 return GetEnergyMaxPristine() * (1 - ( damage_coef * m_ReduceMaxEnergyByDamageCoef ) );
1317 }
DayZGame g_Game
Определения DayZGame.c:3942
EntityAI m_ThisEntityAI
Определения Component.c:24
float m_ReduceMaxEnergyByDamageCoef
Определения ComponentEnergyManager.c:52
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1320

Перекрестные ссылки g_Game, GetEnergyMaxPristine(), m_ReduceMaxEnergyByDamageCoef и Component::m_ThisEntityAI.

Используется в AddEnergy() и SetEnergy0To1().