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

◆ UpdateBattery()

void Car::UpdateBattery ( ItemBase battery)
inlineprotected

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

3030 {
3031 if (!battery)
3032 {
3033 m_BatteryTimer = 0;
3034 return;
3035 }
3036
3037 // unlikely
3038 if (m_BatteryTimer < 0)
3039 {
3040 m_BatteryTimer = 0;
3041 }
3042
3043 bool engineOn = EngineIsOn();
3044 bool lightsOn = IsScriptedLightsOn();
3045
3046 if (engineOn)
3047 {
3048 // alternator
3049 battery.GetCompEM().ConsumeEnergy(GetBatteryRechargeRate() * m_BatteryTimer);
3050 }
3051 else if (!engineOn && lightsOn)
3052 {
3053 battery.GetCompEM().ConsumeEnergy(GetBatteryRuntimeConsumption() * m_BatteryTimer);
3054 }
3055
3056 if (lightsOn && battery.GetCompEM().GetEnergy() <= 0)
3057 {
3058 // lights currently don't automatically turn back on if the headlight was last turned on, so we just keep them on if the engine is on
3059 if (!engineOn)
3060 {
3062 }
3063 }
3064
3065 m_BatteryTimer = 0;
3066 }
float GetBatteryRechargeRate()
Определения CarScript.c:3010
bool IsScriptedLightsOn()
Proper way to get if light is swiched on.
Определения CarScript.c:2070
float GetBatteryRuntimeConsumption()
Определения CarScript.c:3005
void ToggleHeadlights()
Switches headlights on/off, including the illumination of the control panel and synchronizes this cha...
Определения CarScript.c:2088
float m_BatteryTimer
Определения CarScript.c:217

Перекрестные ссылки GetBatteryRechargeRate(), GetBatteryRuntimeConsumption(), IsScriptedLightsOn(), m_BatteryTimer и ToggleHeadlights().

Используется в EEItemDetached(), OnEngineStart(), OnEngineStop() и OnUpdate().