Responsible for damaging the car according to contact events from OnContact.
1312 {
1313
1315
1316 if (contactZonesCount == 0)
1317 return;
1318
1319
1320 for (int i = 0; i < contactZonesCount; ++i)
1321 {
1324
1327
1328 #ifdef DIAG_DEVELOPER
1329 CrashDebugData.m_CrashDataPoint = new CrashDebugData();
1330 CrashDebugData.m_CrashDataPoint.m_VehicleType =
GetDisplayName();
1331 CrashDebugData.m_CrashDataPoint.m_Damage = dmg;
1332 CrashDebugData.m_CrashDataPoint.m_Zone = zoneName;
1333 CrashDebugData.m_CrashDataPoint.m_MomentumCurr = GetMomentum();
1335 CrashDebugData.m_CrashDataPoint.m_MomentumDelta = data[0].impulse;
1336 CrashDebugData.m_CrashDataPoint.m_SpeedWorld =
GetVelocity(
this).
Length() * 3.6;
1337 CrashDebugData.m_CrashDataPoint.m_SpeedWorldPrev =
m_VelocityPrevTick.Length() * 3.6;
1339 CrashDebugData.m_CrashDataPoint.m_VelocityCur =
GetVelocity(
this);
1343
1344
1345
1346 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_CONSIDERED)
1347 {
1348 Debug.
Log(
"--------------------------------------------------");
1351 Debug.
Log(
"zoneName : "+ zoneName);
1352 Debug.
Log(
"momentumCurr : "+ GetMomentum());
1354 Debug.
Log(
"momentumDelta : "+ data[0].impulse);
1362 Debug.
Log(
"--------------------------------------------------");
1363 }
1364 #endif
1366 continue;
1367
1368 int pddfFlags;
1369 #ifdef DIAG_DEVELOPER
1370 CrashDebugData.m_CrashData.Insert(CrashDebugData.m_CrashDataPoint);
1371 CrashDebugData.m_CrashDataPoint.m_Speedometer = GetSpeedometer();
1372
1373 #endif
1375 {
1376 #ifdef DIAG_DEVELOPER
1377 CrashDebugData.m_CrashDataPoint.m_DamageType = "Small";
1378 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1380 #endif
1383 }
1384 else
1385 {
1386 #ifdef DIAG_DEVELOPER
1387 CrashDebugData.m_CrashDataPoint.m_DamageType = "Big";
1388 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1390 #endif
1393 pddfFlags = 0;
1394 }
1395
1396 #ifdef DEVELOPER
1397 m_DebugContactDamageMessage += string.Format("%1: %2\n", zoneName, dmg);
1398 #endif
1399
1400 ProcessDirectDamage(
DamageType.CUSTOM, null, zoneName,
"EnviroDmg",
"0 0 0", dmg, pddfFlags);
1401
1402
1403
1405 if (targetEntity && targetEntity.IsTree())
1406 {
1408 }
1409
1410 }
1411
1414
1416
1417 }
vector m_VelocityPrevTick
void DamageCrew(float dmg)
Responsible for damaging crew in a car crash.
void UpdateLights(int new_gear=-1)
void SynchCrashHeavySound(bool play)
void UpdateHeadlightState()
void SynchCrashLightSound(bool play)
ref CarContactCache m_ContactCache
DamageType
exposed from C++ (do not change)
static string GetDisplayName(int liquid_type)
proto int GetTime()
returns mission time in milliseconds
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
static int CreateParticleServer(vector pos, EffecterParameters parameters)
returns unique effecter ID
Manager class for managing Effect (EffectParticle, EffectSound)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native float Length()
Returns length of vector (magnitude)
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
proto native CGame GetGame()
static proto int AbsInt(int i)
Returns absolute value.
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
proto native float dBodyGetMass(notnull IEntity ent)