DayZ 1.27
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 строка 1252

1253 {
1254 float max_health = 0;
1255
1256 if ( m_ThisEntityAI.HasDamageSystem() )
1257 max_health = m_ThisEntityAI.GetMaxHealth("","");
1258 //else if ( m_ReduceMaxEnergyByDamageCoef != 0 )
1259 // Error("[ERROR] ReduceMaxEnergyByDamageCoef is setup but " + m_ThisEntityAI.GetType() + " does not have a Damage System");
1260
1261 if ( max_health == 0 || m_ReduceMaxEnergyByDamageCoef == 0 )
1262 return GetEnergyMaxPristine();
1263
1264 float health = 100;
1265
1266 if (GetGame().IsServer() || !GetGame().IsMultiplayer()) // TO DO: Remove this IF when method GetHealth can be called on client!
1267 health = m_ThisEntityAI.GetHealth("","");
1268
1269 float damage_coef = 1 - (health / max_health);
1270
1271 return GetEnergyMaxPristine() * (1 - ( damage_coef * m_ReduceMaxEnergyByDamageCoef ) );
1272 }
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:1275
proto native CGame GetGame()

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

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