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

◆ OnInput()

override void Car::OnInput ( float dt)
inlineprotected

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

1304 {
1305 super.OnInput(dt);
1306
1307#ifdef DIAG_DEVELOPER
1308 if (m_eDebugMode == ECarDebugMode.NONE)
1309 return;
1310
1311 float currentRPM = EngineGetRPM();
1312 if (currentRPM < EngineGetRPMIdle())
1313 {
1314 if (currentRPM < 1.0 && EngineIsOn())
1315 {
1317 EngineStop();
1318 }
1319 else if (!EngineIsOn())
1320 {
1321 EngineStart();
1322 }
1323
1324 return;
1325 }
1326
1327 float speed = GetSpeedometerAbsolute();
1328
1329 float thrustWanted = 0.0;
1330 float steeringWanted = 0.0;
1331
1332 bool attemptSpeed = false;
1333 float speedWanted = 0;
1334
1335 switch (m_eDebugMode)
1336 {
1337 case ECarDebugMode.FORWARD_10:
1338 attemptSpeed = true;
1339 speedWanted = 10;
1340 break;
1341 case ECarDebugMode.FORWARD_50:
1342 attemptSpeed = true;
1343 speedWanted = 50;
1344 break;
1345 }
1346
1347 if (attemptSpeed)
1348 {
1349 // very basic and doesn't actually work
1350 thrustWanted = Math.Clamp(1.0 - Math.InverseLerp(0, speedWanted, speed), 0, 1);
1351 }
1352
1353 bool isManual = GearboxGetType() == CarGearboxType.MANUAL;
1354 bool isReverse = GetGear() == CarGear.REVERSE;
1355
1356 if (isManual)
1357 {
1358 float thrustWantedAbs = Math.AbsFloat(thrustWanted);
1359
1360 if (currentRPM > EngineGetRPMRedline() * 0.8)
1361 {
1362 if (thrustWantedAbs > 0.1)
1363 {
1364 ShiftUp();
1365 }
1366 }
1367 else if (GetGear() > CarGear.FIRST && thrustWantedAbs < 0.1)
1368 {
1369 ShiftDown();
1370 }
1371 else if (GetGear() < CarGear.FIRST || (thrustWanted > 0.0 && speed < 5.0))
1372 {
1373 ShiftTo(CarGear.FIRST);
1374 }
1375 }
1376
1377 SetThrottle(thrustWanted);
1378 SetSteering(steeringWanted);
1379 SetBrake(0.0);
1380 SetHandbrake(0.0);
1381 SetBrakesActivateWithoutDriver(false);
1382#endif
1383 }
CarGearboxType
Enumerated gearbox types. (native, do not change or extend)
Определения Car.c:35

Перекрестные ссылки Math::AbsFloat(), Math::Clamp() и Math::InverseLerp().