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

◆ EvaluateDamageHitAnimation()

bool DayZPlayer::EvaluateDamageHitAnimation ( TotalDamageResult pDamageResult,
int pDamageType,
EntityAI pSource,
string pComponent,
string pAmmoType,
vector pModelPos,
out int pAnimType,
out float pAnimHitDir,
out bool pAnimHitFullbody )
inlineprotected

selects animation type and direction based on damage system data

impact from infected attack will be light only

play full body when these coponents were hit

skip evaluation of dmg hit animation

direction

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

1381 {
1382 int invertHitDir = 0; //Used to flip the heavy hit animation direction
1383
1384 pAnimType = 0;
1385 pAnimHitFullbody = false; // additive anm
1386 GetMovementState(m_MovementState);
1387
1388 switch (pDamageType)
1389 {
1390 case DamageType.CLOSE_COMBAT:
1392 if (pSource.IsInherited(DayZInfected))
1393 break;
1394
1395 pAnimType = GetGame().ConfigGetInt("cfgAmmo " + pAmmoType + " hitAnimation");
1396 invertHitDir = GetGame().ConfigGetInt("cfgAmmo " + pAmmoType + " invertHitDir");
1397 if (!IsUnconscious() && pAnimType == 1 && !m_MeleeFightLogic.IsInBlock())
1398 pAnimHitFullbody = true;
1399 break;
1400
1401 case DamageType.FIRE_ARM:
1402 int impactBehaviour = 0;
1403
1404 if (!IsUnconscious() && GetHealth("", "Shock") > 25)
1405 {
1407 if (pComponent == "Torso" || pComponent == "Head")
1408 {
1409 impactBehaviour = GetGame().ConfigGetInt("cfgAmmo " + pAmmoType + " impactBehaviour");
1410 float fireDamage = pDamageResult.GetHighestDamage("Health");
1411 float shockDamage = pDamageResult.GetHighestDamage("Shock");
1412 if ((fireDamage > 80.0 || shockDamage > 40.0) && impactBehaviour == 1)
1413 pAnimHitFullbody = true;
1414 }
1415 }
1416
1417 break;
1418
1419 case DamageType.EXPLOSION:
1420 break;
1421
1422 case DamageType.CUSTOM:
1423 pAnimType = GetGame().ConfigGetInt("cfgAmmo " + pAmmoType + " hitAnimation");
1424 if (pAnimType == 1)
1425 pAnimHitFullbody = true;
1426 else if (pAmmoType != "HeatDamage" || IsSwimming() || IsInVehicle())
1427 return false;
1428
1429 break;
1430 }
1431
1433 vector targetDirection = GetDirection();
1434 vector toSourceDirection = (pSource.GetPosition() - GetPosition());
1435
1436 targetDirection[1] = 0;
1437 toSourceDirection[1] = 0;
1438
1439 targetDirection.Normalize();
1440 toSourceDirection.Normalize();
1441
1442 float cosFi = vector.Dot(targetDirection, toSourceDirection);
1443 vector cross = targetDirection * toSourceDirection;
1444
1445 pAnimHitDir = Math.Acos(cosFi) * Math.RAD2DEG;
1446
1447 // We will invert direction of the hit
1448 if (invertHitDir > 0)
1449 pAnimHitDir -= 180;
1450
1451 if (cross[1] < 0)
1452 pAnimHitDir = -pAnimHitDir;
1453
1454 return true;
1455 }
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
proto native int ConfigGetInt(string path)
Get int value from config on path.
ref DayZPlayerMeleeFightLogic_LightHeavy m_MeleeFightLogic
Определения DayZPlayerImplement.c:119
bool IsSwimming()
Определения DayZPlayerImplement.c:481
bool IsInVehicle()
Определения DayZPlayerImplement.c:476
ref HumanMovementState m_MovementState
time step for gradual update of dead screen visibilibty up to full visbility [s]
Определения DayZPlayerImplement.c:116
proto native float GetHighestDamage(string healthType)
proto float Normalize()
Normalizes vector. Returns length.
proto native CGame GetGame()
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9

Перекрестные ссылки Math::Acos(), CGame::ConfigGetInt(), vector::Dot(), GetGame(), TotalDamageResult::GetHighestDamage(), GetPosition, IsInVehicle(), IsSwimming(), m_MeleeFightLogic, m_MovementState, vector::Normalize() и Math::RAD2DEG.

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