DayZ 1.30
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 строка 1485

1486 {
1487 int invertHitDir = 0; //Used to flip the heavy hit animation direction
1488
1489 pAnimType = 0;
1490 pAnimHitFullbody = false; // additive anm
1491 GetMovementState(m_MovementState);
1492
1493 switch (pDamageType)
1494 {
1495 case DamageType.CLOSE_COMBAT:
1497 if (pSource.IsInherited(DayZInfected))
1498 break;
1499
1500 pAnimType = g_Game.ConfigGetInt("cfgAmmo " + pAmmoType + " hitAnimation");
1501 invertHitDir = g_Game.ConfigGetInt("cfgAmmo " + pAmmoType + " invertHitDir");
1502 if (!IsUnconscious() && pAnimType == 1 && !m_MeleeFightLogic.IsInBlock())
1503 pAnimHitFullbody = true;
1504 break;
1505
1506 case DamageType.FIRE_ARM:
1507 int impactBehaviour = 0;
1508
1509 if (!IsUnconscious() && GetHealth("", "Shock") > 25)
1510 {
1512 if (pComponent == "Torso" || pComponent == "Head")
1513 {
1514 impactBehaviour = g_Game.ConfigGetInt("cfgAmmo " + pAmmoType + " impactBehaviour");
1515 float fireDamage = pDamageResult.GetHighestDamage("Health");
1516 float shockDamage = pDamageResult.GetHighestDamage("Shock");
1517 if ((fireDamage > 80.0 || shockDamage > 40.0) && impactBehaviour == 1)
1518 pAnimHitFullbody = true;
1519 }
1520 }
1521
1522 break;
1523
1524 case DamageType.EXPLOSION:
1525 break;
1526
1527 case DamageType.CUSTOM:
1528 pAnimType = g_Game.ConfigGetInt("cfgAmmo " + pAmmoType + " hitAnimation");
1529 if (pAnimType == 1)
1530 pAnimHitFullbody = true;
1531 else if (pAmmoType != "HeatDamage" || IsSwimming() || IsInVehicle())
1532 return false;
1533
1534 break;
1535 }
1536
1538 vector targetDirection = GetDirection();
1539 vector toSourceDirection = (pSource.GetPosition() - GetPosition());
1540
1541 targetDirection[1] = 0;
1542 toSourceDirection[1] = 0;
1543
1544 targetDirection.Normalize();
1545 toSourceDirection.Normalize();
1546
1547 float cosFi = vector.Dot(targetDirection, toSourceDirection);
1548 vector cross = targetDirection * toSourceDirection;
1549
1550 pAnimHitDir = Math.Acos(cosFi) * Math.RAD2DEG;
1551
1552 // We will invert direction of the hit
1553 if (invertHitDir > 0)
1554 pAnimHitDir -= 180;
1555
1556 if (cross[1] < 0)
1557 pAnimHitDir = -pAnimHitDir;
1558
1559 return true;
1560 }
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:4074
ref DayZPlayerMeleeFightLogic_LightHeavy m_MeleeFightLogic
Определения DayZPlayerImplement.c:95
bool IsSwimming()
Определения DayZPlayerImplement.c:473
bool IsInVehicle()
Определения DayZPlayerImplement.c:468
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().