DayZ 1.30
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 строка 1284

1285 {
1286 float max_health = 0;
1287
1288 if (m_ThisEntityAI && m_ThisEntityAI.HasDamageSystem())
1289 max_health = m_ThisEntityAI.GetMaxHealth("","");
1290 //else if ( m_ReduceMaxEnergyByDamageCoef != 0 )
1291 // Error("[ERROR] ReduceMaxEnergyByDamageCoef is setup but " + m_ThisEntityAI.GetType() + " does not have a Damage System");
1292
1293 if ( max_health == 0 || m_ReduceMaxEnergyByDamageCoef == 0 )
1294 return GetEnergyMaxPristine();
1295
1296 float health = 100;
1297
1298 if (m_ThisEntityAI && (g_Game.IsServer() || !g_Game.IsMultiplayer())) // TO DO: Remove this IF when method GetHealth can be called on client!
1299 health = m_ThisEntityAI.GetHealth("","");
1300
1301 float damage_coef = 1 - (health / max_health);
1302
1303 return GetEnergyMaxPristine() * (1 - ( damage_coef * m_ReduceMaxEnergyByDamageCoef ) );
1304 }
DayZGame g_Game
Определения DayZGame.c:4074
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:1307

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

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