DayZ 1.29
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 строка 1469

1470 {
1471 int invertHitDir = 0; //Used to flip the heavy hit animation direction
1472
1473 pAnimType = 0;
1474 pAnimHitFullbody = false; // additive anm
1475 GetMovementState(m_MovementState);
1476
1477 switch (pDamageType)
1478 {
1479 case DamageType.CLOSE_COMBAT:
1481 if (pSource.IsInherited(DayZInfected))
1482 break;
1483
1484 pAnimType = g_Game.ConfigGetInt("cfgAmmo " + pAmmoType + " hitAnimation");
1485 invertHitDir = g_Game.ConfigGetInt("cfgAmmo " + pAmmoType + " invertHitDir");
1486 if (!IsUnconscious() && pAnimType == 1 && !m_MeleeFightLogic.IsInBlock())
1487 pAnimHitFullbody = true;
1488 break;
1489
1490 case DamageType.FIRE_ARM:
1491 int impactBehaviour = 0;
1492
1493 if (!IsUnconscious() && GetHealth("", "Shock") > 25)
1494 {
1496 if (pComponent == "Torso" || pComponent == "Head")
1497 {
1498 impactBehaviour = g_Game.ConfigGetInt("cfgAmmo " + pAmmoType + " impactBehaviour");
1499 float fireDamage = pDamageResult.GetHighestDamage("Health");
1500 float shockDamage = pDamageResult.GetHighestDamage("Shock");
1501 if ((fireDamage > 80.0 || shockDamage > 40.0) && impactBehaviour == 1)
1502 pAnimHitFullbody = true;
1503 }
1504 }
1505
1506 break;
1507
1508 case DamageType.EXPLOSION:
1509 break;
1510
1511 case DamageType.CUSTOM:
1512 pAnimType = g_Game.ConfigGetInt("cfgAmmo " + pAmmoType + " hitAnimation");
1513 if (pAnimType == 1)
1514 pAnimHitFullbody = true;
1515 else if (pAmmoType != "HeatDamage" || IsSwimming() || IsInVehicle())
1516 return false;
1517
1518 break;
1519 }
1520
1522 vector targetDirection = GetDirection();
1523 vector toSourceDirection = (pSource.GetPosition() - GetPosition());
1524
1525 targetDirection[1] = 0;
1526 toSourceDirection[1] = 0;
1527
1528 targetDirection.Normalize();
1529 toSourceDirection.Normalize();
1530
1531 float cosFi = vector.Dot(targetDirection, toSourceDirection);
1532 vector cross = targetDirection * toSourceDirection;
1533
1534 pAnimHitDir = Math.Acos(cosFi) * Math.RAD2DEG;
1535
1536 // We will invert direction of the hit
1537 if (invertHitDir > 0)
1538 pAnimHitDir -= 180;
1539
1540 if (cross[1] < 0)
1541 pAnimHitDir = -pAnimHitDir;
1542
1543 return true;
1544 }
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3942
ref DayZPlayerMeleeFightLogic_LightHeavy m_MeleeFightLogic
Определения DayZPlayerImplement.c:95
bool IsSwimming()
Определения DayZPlayerImplement.c:470
bool IsInVehicle()
Определения DayZPlayerImplement.c:465
ref HumanMovementState m_MovementState
time step for gradual update of dead screen visibilibty up to full visbility [s]
Определения DayZPlayerImplement.c:92
proto native float GetHighestDamage(string healthType)
proto float Normalize()
Normalizes vector. Returns length.
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473

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

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