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

◆ UpdateBattery()

void Car::UpdateBattery ( ItemBase battery)
inlineprotected

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

2887 {
2888 if (!battery)
2889 {
2890 m_BatteryTimer = 0;
2891 return;
2892 }
2893
2894 // unlikely
2895 if (m_BatteryTimer < 0)
2896 {
2897 m_BatteryTimer = 0;
2898 }
2899
2900 bool engineOn = EngineIsOn();
2901 bool lightsOn = IsScriptedLightsOn();
2902
2903 if (engineOn)
2904 {
2905 // alternator
2906 battery.GetCompEM().ConsumeEnergy(GetBatteryRechargeRate() * m_BatteryTimer);
2907 }
2908 else if (!engineOn && lightsOn)
2909 {
2910 battery.GetCompEM().ConsumeEnergy(GetBatteryRuntimeConsumption() * m_BatteryTimer);
2911 }
2912
2913 if (lightsOn && battery.GetCompEM().GetEnergy() <= 0)
2914 {
2915 // 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
2916 if (!engineOn)
2917 {
2919 }
2920 }
2921
2922 m_BatteryTimer = 0;
2923 }
float GetBatteryRechargeRate()
Определения CarScript.c:2867
bool IsScriptedLightsOn()
Proper way to get if light is swiched on. Use instead of IsLightsOn().
Определения CarScript.c:1939
float GetBatteryRuntimeConsumption()
Определения CarScript.c:2862
void ToggleHeadlights()
Switches headlights on/off, including the illumination of the control panel and synchronizes this cha...
Определения CarScript.c:1945
float m_BatteryTimer
Определения CarScript.c:208

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

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