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

◆ CheckContactCache()

void CheckContactCache ( )
protected

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

1253 {
1254 int contactZonesCount = m_ContactCache.Count();
1255 if (contactZonesCount == 0)
1256 return;
1257
1258 for (int i = 0; i < contactZonesCount; ++i)
1259 {
1260 string zoneName = m_ContactCache.GetKey(i);
1261 array<ref VehicleContactData> data = m_ContactCache[zoneName];
1262
1263 float dmg = Math.AbsInt(data[0].m_Impulse * m_VehicleContactDamageCoef);
1264 float crewDmgBase = Math.AbsInt((data[0].m_Impulse / dBodyGetMass(this)) * 500 * m_CrewContactDamageCoef);// calculates damage as if the object's weight was 500kg instead of its actual weight
1265
1266 #ifdef DIAG_DEVELOPER
1267 CrashDebugData.m_CrashDataPoint = new CrashDebugData();
1268 CrashDebugData.m_CrashDataPoint.m_VehicleType = GetDisplayName();
1269 CrashDebugData.m_CrashDataPoint.m_Damage = dmg;
1270 CrashDebugData.m_CrashDataPoint.m_Zone = zoneName;
1271 CrashDebugData.m_CrashDataPoint.m_MomentumCurr = GetMomentum();
1272 CrashDebugData.m_CrashDataPoint.m_MomentumPrev = m_MomentumPrevTick;
1273 CrashDebugData.m_CrashDataPoint.m_MomentumDelta = data[0].m_Impulse;
1274 CrashDebugData.m_CrashDataPoint.m_SpeedWorld = GetVelocity(this).Length() * 3.6;
1275 CrashDebugData.m_CrashDataPoint.m_SpeedWorldPrev = m_VelocityPrevTick.Length() * 3.6;
1276 CrashDebugData.m_CrashDataPoint.m_SpeedWorldDelta = (m_VelocityPrevTick.Length() - GetVelocity(this).Length()) * 3.6;
1277 CrashDebugData.m_CrashDataPoint.m_VelocityCur = GetVelocity(this);
1278 CrashDebugData.m_CrashDataPoint.m_VelocityPrev = m_VelocityPrevTick;
1279 CrashDebugData.m_CrashDataPoint.m_VelocityDot = vector.Dot(m_VelocityPrevTick.Normalized(), GetVelocity(this).Normalized());
1280 CrashDebugData.m_CrashDataPoint.m_Time = g_Game.GetTime();
1281
1282 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_CONSIDERED)
1283 {
1284 Debug.Log("--------------------------------------------------");
1285 Debug.Log("Vehicle:" + GetDisplayName());
1286 Debug.Log("DMG: " + dmg);
1287 Debug.Log("zoneName : "+ zoneName);
1288 Debug.Log("momentumCurr : "+ GetMomentum());
1289 Debug.Log("momentumPrev : "+ m_MomentumPrevTick);
1290 Debug.Log("momentumDelta : "+ data[0].m_Impulse);
1291 Debug.Log("speed(km/h): "+ GetVelocity(this).Length() * 3.6);
1292 Debug.Log("speedPrev(km/h): "+ m_VelocityPrevTick.Length() * 3.6);
1293 Debug.Log("speedDelta(km/h) : "+ (m_VelocityPrevTick.Length() - GetVelocity(this).Length()) * 3.6);
1294 Debug.Log("velocityCur.): "+ GetVelocity(this));
1295 Debug.Log("velocityPrev.): "+ m_VelocityPrevTick);
1296 Debug.Log("velocityDot): "+ vector.Dot(m_VelocityPrevTick.Normalized(), GetVelocity(this).Normalized()));
1297 Debug.Log("g_Game.GetTime(): "+ g_Game.GetTime());
1298 Debug.Log("--------------------------------------------------");
1299 }
1300 #endif
1302 continue;
1303
1304 int pddfFlags;
1305 #ifdef DIAG_DEVELOPER
1306 CrashDebugData.m_CrashData.Insert(CrashDebugData.m_CrashDataPoint);
1307 CrashDebugData.m_CrashDataPoint.m_Speedometer = GetSpeedometer();
1308 //Print("Crash data recorded");
1309 #endif
1311 {
1312 #ifdef DIAG_DEVELOPER
1313 CrashDebugData.m_CrashDataPoint.m_DamageType = "Small";
1314 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1315 Debug.Log(string.Format("[Vehiles:Damage]:: DMG %1 to the %2 zone is SMALL (threshold: %3), SPEEDOMETER: %4, TIME: %5", dmg, zoneName, GameConstants.MOTORBIKES_CONTACT_DMG_MIN, GetSpeedometer(), g_Game.GetTime() ));
1316 #endif
1317
1318 SynchCrashLightSound(true);
1319 pddfFlags = ProcessDirectDamageFlags.NO_TRANSFER;
1320 }
1322 {
1323 #ifdef DIAG_DEVELOPER
1324 CrashDebugData.m_CrashDataPoint.m_DamageType = "Medium";
1325 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1326 Debug.Log(string.Format("[Vehiles:Damage]:: DMG %1 to the %2 zone is SMALL (threshold: %3), SPEEDOMETER: %4, TIME: %5", dmg, zoneName, GameConstants.MOTORBIKES_CONTACT_DMG_MIN, GetSpeedometer(), g_Game.GetTime() ));
1327 #endif
1328
1329 FallOver();
1330 SynchCrashLightSound(true);
1331 }
1332 else
1333 {
1334 #ifdef DIAG_DEVELOPER
1335 CrashDebugData.m_CrashDataPoint.m_DamageType = "Big";
1336 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1337 Debug.Log(string.Format("[Vehiles:Damage]:: DMG %1 to the %2 zone is BIG (threshold: %3), SPEED: %4, TIME: %5", dmg, zoneName, GameConstants.MOTORBIKES_CONTACT_DMG_MIN, GetSpeedometer(), g_Game.GetTime() ));
1338 #endif
1339
1340 DamageCrew(crewDmgBase);
1341 FallOver();
1342 SynchCrashHeavySound(true);
1343 pddfFlags = 0;
1344 }
1345
1346 #ifdef DEVELOPER
1347 m_DebugContactDamageMessage += string.Format("%1: %2\n", zoneName, dmg);
1348 #endif
1349
1350 ProcessDirectDamage(DamageType.CUSTOM, null, zoneName, "EnviroDmg", "0 0 0", dmg, pddfFlags);
1351 }
1352
1354 UpdateLights();
1355
1356 m_ContactCache.Clear();
1357 }
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:4074
static string GetDisplayName(int liquid_type)
Определения Liquid.c:383
float GetSpeedometer()
Returns the current speed of the vehicle in km/h.
Определения Motorbike.c:45
proto native bool FallOver()
Forcibly topple over the motorbike, ejects the player.
override void UpdateLights(int new_gear=-1)
Определения MotorbikeScript.c:1080
void DamageCrew(float dmg)
Responsible for damaging crew in a car crash.
Определения MotorbikeScript.c:1360
void UpdateHeadlightState()
Определения MotorbikeScript.c:1049
ProcessDirectDamageFlags
Определения Object.c:2
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.
Определения 3_Game/DayZ/tools/Debug.c:183
Определения 3_Game/DayZ/tools/Debug.c:2
Определения EnMath.c:7
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:305
Определения EnConvert.c:119
static proto int AbsInt(int i)
Returns absolute value.
const float MOTORBIKES_CONTACT_DMG_THRESHOLD_SMALL
Определения 3_Game/DayZ/constants.c:898
const float MOTORBIKES_CONTACT_DMG_MIN
Определения 3_Game/DayZ/constants.c:900
const float MOTORBIKES_CONTACT_DMG_THRESHOLD_MID
Определения 3_Game/DayZ/constants.c:899
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
proto native float dBodyGetMass(notnull IEntity ent)

Перекрестные ссылки Math::AbsInt(), DamageCrew(), dBodyGetMass(), vector::Dot(), FallOver(), string::Format(), g_Game, GetDisplayName(), GetSpeedometer(), GetVelocity(), vector::Length(), Debug::Log(), GameConstants::MOTORBIKES_CONTACT_DMG_MIN, GameConstants::MOTORBIKES_CONTACT_DMG_THRESHOLD_MID, GameConstants::MOTORBIKES_CONTACT_DMG_THRESHOLD_SMALL, UpdateHeadlightState() и UpdateLights().

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