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

◆ CheckContactCache()

void CheckContactCache ( )
protected

Responsible for damaging the car according to contact events from OnContact.

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

1312 {
1313
1314 int contactZonesCount = m_ContactCache.Count();
1315
1316 if (contactZonesCount == 0)
1317 return;
1318
1319
1320 for (int i = 0; i < contactZonesCount; ++i)
1321 {
1322 string zoneName = m_ContactCache.GetKey(i);
1324
1325 float dmg = Math.AbsInt(data[0].impulse * m_dmgContactCoef);
1326 float crewDmgBase = Math.AbsInt((data[0].impulse / dBodyGetMass(this)) * 1000 * m_dmgContactCoef);// calculates damage as if the object's weight was 1000kg instead of its actual weight
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();
1334 CrashDebugData.m_CrashDataPoint.m_MomentumPrev = m_MomentumPrevTick;
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;
1338 CrashDebugData.m_CrashDataPoint.m_SpeedWorldDelta = (m_VelocityPrevTick.Length() - GetVelocity(this).Length()) * 3.6;
1339 CrashDebugData.m_CrashDataPoint.m_VelocityCur = GetVelocity(this);
1340 CrashDebugData.m_CrashDataPoint.m_VelocityPrev = m_VelocityPrevTick;
1341 CrashDebugData.m_CrashDataPoint.m_VelocityDot = vector.Dot(m_VelocityPrevTick.Normalized(), GetVelocity(this).Normalized());
1342 CrashDebugData.m_CrashDataPoint.m_Time = GetGame().GetTime();
1343
1344
1345
1346 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_CONSIDERED)
1347 {
1348 Debug.Log("--------------------------------------------------");
1349 Debug.Log("Vehicle:" + GetDisplayName());
1350 Debug.Log("DMG: " + dmg);
1351 Debug.Log("zoneName : "+ zoneName);
1352 Debug.Log("momentumCurr : "+ GetMomentum());
1353 Debug.Log("momentumPrev : "+ m_MomentumPrevTick);
1354 Debug.Log("momentumDelta : "+ data[0].impulse);
1355 Debug.Log("speed(km/h): "+ GetVelocity(this).Length() * 3.6);
1356 Debug.Log("speedPrev(km/h): "+ m_VelocityPrevTick.Length() * 3.6);
1357 Debug.Log("speedDelta(km/h) : "+ (m_VelocityPrevTick.Length() - GetVelocity(this).Length()) * 3.6);
1358 Debug.Log("velocityCur.): "+ GetVelocity(this));
1359 Debug.Log("velocityPrev.): "+ m_VelocityPrevTick);
1360 Debug.Log("velocityDot): "+ vector.Dot(m_VelocityPrevTick.Normalized(), GetVelocity(this).Normalized()));
1361 Debug.Log("GetGame().GetTime(): "+ GetGame().GetTime());
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 //Print("Crash data recorded");
1373 #endif
1375 {
1376 #ifdef DIAG_DEVELOPER
1377 CrashDebugData.m_CrashDataPoint.m_DamageType = "Small";
1378 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1379 Debug.Log(string.Format("[Vehiles:Damage]:: DMG %1 to the %2 zone is SMALL (threshold: %3), SPEEDOMETER: %4, TIME: %5", dmg, zoneName, GameConstants.CARS_CONTACT_DMG_MIN, GetSpeedometer(), GetGame().GetTime() ));
1380 #endif
1382 pddfFlags = ProcessDirectDamageFlags.NO_TRANSFER;
1383 }
1384 else
1385 {
1386 #ifdef DIAG_DEVELOPER
1387 CrashDebugData.m_CrashDataPoint.m_DamageType = "Big";
1388 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1389 Debug.Log(string.Format("[Vehiles:Damage]:: DMG %1 to the %2 zone is BIG (threshold: %3), SPEED: %4, TIME: %5", dmg, zoneName, GameConstants.CARS_CONTACT_DMG_THRESHOLD, GetSpeedometer(), GetGame().GetTime() ));
1390 #endif
1391 DamageCrew(crewDmgBase);
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 //if (data[0].impulse > TRESHOLD)
1403 //{
1404 Object targetEntity = Object.Cast(data[0].other);
1405 if (targetEntity && targetEntity.IsTree())
1406 {
1407 SEffectManager.CreateParticleServer(targetEntity.GetPosition(), new TreeEffecterParameters("TreeEffecter", 1.0, 0.1));
1408 }
1409 //}
1410 }
1411
1413 UpdateLights();
1414
1415 m_ContactCache.Clear();
1416
1417 }
vector m_VelocityPrevTick
Определения CarScript.c:143
void DamageCrew(float dmg)
Responsible for damaging crew in a car crash.
Определения CarScript.c:1420
float m_MomentumPrevTick
Определения CarScript.c:142
void UpdateLights(int new_gear=-1)
Определения CarScript.c:1842
void SynchCrashHeavySound(bool play)
Определения CarScript.c:2338
void UpdateHeadlightState()
Определения CarScript.c:714
float m_dmgContactCoef
Определения CarScript.c:161
void SynchCrashLightSound(bool play)
Определения CarScript.c:2319
ref CarContactCache m_ContactCache
Определения CarScript.c:144
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
static string GetDisplayName(int liquid_type)
Определения Liquid.c:382
float GetTime()
Определения NotificationSystem.c:35
ProcessDirectDamageFlags
Определения Object.c:2
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.
Определения Debug.c:122
Определения Debug.c:2
Определения constants.c:659
Определения EnMath.c:7
Определения ObjectTyped.c:2
static int CreateParticleServer(vector pos, EffecterParameters parameters)
returns unique effecter ID
Определения EffectManager.c:577
Manager class for managing Effect (EffectParticle, EffectSound)
Определения EffectManager.c:6
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.
Определения EnConvert.c:271
Определения EnConvert.c:106
proto native CGame GetGame()
const float CARS_CONTACT_DMG_THRESHOLD
Определения constants.c:836
const float CARS_CONTACT_DMG_MIN
Определения constants.c:837
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)

Перекрестные ссылки Math::AbsInt(), GameConstants::CARS_CONTACT_DMG_MIN, GameConstants::CARS_CONTACT_DMG_THRESHOLD, SEffectManager::CreateParticleServer(), DamageCrew(), dBodyGetMass(), vector::Dot(), string::Format(), GetDisplayName(), GetGame(), CGame::GetTime(), GetTime(), GetVelocity(), vector::Length(), Debug::Log(), m_ContactCache, m_dmgContactCoef, m_MomentumPrevTick, m_VelocityPrevTick, SynchCrashHeavySound(), SynchCrashLightSound(), UpdateHeadlightState() и UpdateLights().

Используется в EOnPostSimulate().