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

◆ OnUpdate()

override void OnUpdate ( float dt)
protected

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

1200 {
1201 if ( GetGame().IsServer() )
1202 {
1203 ItemBase battery = GetBattery();
1204 if ( battery )
1205 {
1206 if ( EngineIsOn() )
1207 {
1208 m_BatteryTimer += dt;
1210 {
1211 battery.GetCompEM().ConsumeEnergy(GetBatteryRechargeRate() * m_BatteryTimer);
1212 m_BatteryTimer = 0;
1213 }
1214 }
1215 else if ( !EngineIsOn() && IsScriptedLightsOn() )
1216 {
1217 m_BatteryTimer += dt;
1219 {
1220 battery.GetCompEM().ConsumeEnergy(GetBatteryRuntimeConsumption() * m_BatteryTimer);
1221 m_BatteryTimer = 0;
1222
1223 if ( battery.GetCompEM().GetEnergy() <= 0 )
1224 {
1226 }
1227 }
1228 }
1229 }
1230
1231 if ( GetGame().GetWaterDepth( GetEnginePosWS() ) > 0 )
1232 {
1233 m_DrownTime += dt;
1235 {
1236 // *dt to get damage per second
1237 AddHealth( "Engine", "Health", -DROWN_ENGINE_DAMAGE * dt);
1238 SetEngineZoneReceivedHit(true);
1239 }
1240 }
1241 else
1242 {
1243 m_DrownTime = 0;
1244 }
1245 }
1246
1247 // For visualisation of brake lights for all players
1248 float brake_coef = GetBrake();
1249 if ( brake_coef > 0 )
1250 {
1251 if ( !m_BrakesArePressed )
1252 {
1253 m_BrakesArePressed = true;
1254 SetSynchDirty();
1256 }
1257 }
1258 else
1259 {
1260 if ( m_BrakesArePressed )
1261 {
1262 m_BrakesArePressed = false;
1263 SetSynchDirty();
1265 }
1266 }
1267
1268 if ( (!GetGame().IsDedicatedServer()) && m_ForceUpdateLights )
1269 {
1270 UpdateLights();
1271 m_ForceUpdateLights = false;
1272 }
1273 }
void OnBrakesPressed()
Определения CarScript.c:1105
ItemBase GetBattery()
Определения CarScript.c:2727
vector GetEnginePosWS()
Определения CarScript.c:448
float GetBatteryRuntimeConsumption()
Определения CarScript.c:2717
float m_DrownTime
Определения CarScript.c:165
static float DROWN_ENGINE_DAMAGE
Определения CarScript.c:149
bool m_ForceUpdateLights
Определения CarScript.c:239
bool m_BrakesArePressed
Определения CarScript.c:236
float m_BatteryTimer
Определения CarScript.c:180
void UpdateLights(int new_gear=-1)
Определения CarScript.c:1842
static float DROWN_ENGINE_THRESHOLD
Определения CarScript.c:148
const float BATTERY_UPDATE_DELAY
Определения CarScript.c:181
void ToggleHeadlights()
Switches headlights on/off, including the illumination of the control panel and synchronizes this cha...
Определения CarScript.c:1836
float GetBatteryRechargeRate()
Определения CarScript.c:2722
void OnBrakesReleased()
Определения CarScript.c:1110
bool IsScriptedLightsOn()
Propper way to get if light is swiched on. Use instead of IsLightsOn().
Определения CarScript.c:1830
Определения InventoryItem.c:731
proto native CGame GetGame()

Перекрестные ссылки BATTERY_UPDATE_DELAY, DROWN_ENGINE_DAMAGE, DROWN_ENGINE_THRESHOLD, GetBattery(), GetBatteryRechargeRate(), GetBatteryRuntimeConsumption(), GetEnginePosWS(), GetGame(), IsScriptedLightsOn(), m_BatteryTimer, m_BrakesArePressed, m_DrownTime, m_ForceUpdateLights, OnBrakesPressed(), OnBrakesReleased(), ToggleHeadlights() и UpdateLights().