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

◆ OnUpdate()

override void Car::OnUpdate ( float dt)
inlineprotected

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

1211 {
1212 Human driver = CrewDriver();
1213 if (driver && !driver.IsControllingVehicle())
1214 {
1215 // likely unconscious
1216 if (driver.IsAlive())
1217 {
1218 SetBrake(0.5);
1219 }
1220 }
1221
1222 if (g_Game.IsServer())
1223 {
1224 ItemBase battery = GetBattery();
1225 if (battery)
1226 {
1227 m_BatteryTimer += dt;
1229 {
1230 UpdateBattery(battery);
1231 }
1232 }
1233
1234 if ( g_Game.GetWaterDepth( GetEnginePosWS() ) > 0 )
1235 {
1236 m_DrownTime += dt;
1238 {
1239 // *dt to get damage per second
1240 AddHealth( "Engine", "Health", -DROWN_ENGINE_DAMAGE * dt);
1241 SetEngineZoneReceivedHit(true);
1242 }
1243 }
1244 else
1245 {
1246 m_DrownTime = 0;
1247 }
1248 }
1249
1250 // For visualisation of brake lights for all players
1251 float brake_coef = GetBrake();
1252 if ( brake_coef > 0 )
1253 {
1254 if ( !m_BrakesArePressed )
1255 {
1256 m_BrakesArePressed = true;
1257 SetSynchDirty();
1259 }
1260 }
1261 else
1262 {
1263 if ( m_BrakesArePressed )
1264 {
1265 m_BrakesArePressed = false;
1266 SetSynchDirty();
1268 }
1269 }
1270 }
DayZGame g_Game
Определения DayZGame.c:4074
class GP5GasMask extends MaskBase ItemBase
proto native void SetBrake(float value)
Sets the future rear brake value.
proto native float GetBrake()
Returns the current rear brake value in range <0, 1>.
float m_DrownTime
Определения CarScript.c:118
vector GetEnginePosWS()
Определения CarScript.c:304
ItemBase GetBattery()
Определения CarScript.c:2437
static float DROWN_ENGINE_THRESHOLD
Определения CarScript.c:102
void UpdateBattery(ItemBase battery)
Определения CarScript.c:2442
void OnBrakesPressed()
Определения CarScript.c:930
void OnBrakesReleased()
Определения CarScript.c:935
static float DROWN_ENGINE_DAMAGE
Определения CarScript.c:103
const float BATTERY_UPDATE_DELAY
Определения CarScript.c:134
bool m_BrakesArePressed
Определения CarScript.c:2774
float m_BatteryTimer
Определения CarScript.c:133
proto native bool IsControllingVehicle()

Перекрестные ссылки BATTERY_UPDATE_DELAY, DROWN_ENGINE_DAMAGE, DROWN_ENGINE_THRESHOLD, g_Game, GetBattery(), GetBrake(), GetEnginePosWS(), Human::IsControllingVehicle(), m_BatteryTimer, m_BrakesArePressed, m_DrownTime, OnBrakesPressed(), OnBrakesReleased(), SetBrake() и UpdateBattery().