DayZ 1.28
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 строка 1443

1444 {
1445 int invertHitDir = 0; //Used to flip the heavy hit animation direction
1446
1447 pAnimType = 0;
1448 pAnimHitFullbody = false; // additive anm
1449 GetMovementState(m_MovementState);
1450
1451 switch (pDamageType)
1452 {
1453 case DamageType.CLOSE_COMBAT:
1455 if (pSource.IsInherited(DayZInfected))
1456 break;
1457
1458 pAnimType = GetGame().ConfigGetInt("cfgAmmo " + pAmmoType + " hitAnimation");
1459 invertHitDir = GetGame().ConfigGetInt("cfgAmmo " + pAmmoType + " invertHitDir");
1460 if (!IsUnconscious() && pAnimType == 1 && !m_MeleeFightLogic.IsInBlock())
1461 pAnimHitFullbody = true;
1462 break;
1463
1464 case DamageType.FIRE_ARM:
1465 int impactBehaviour = 0;
1466
1467 if (!IsUnconscious() && GetHealth("", "Shock") > 25)
1468 {
1470 if (pComponent == "Torso" || pComponent == "Head")
1471 {
1472 impactBehaviour = GetGame().ConfigGetInt("cfgAmmo " + pAmmoType + " impactBehaviour");
1473 float fireDamage = pDamageResult.GetHighestDamage("Health");
1474 float shockDamage = pDamageResult.GetHighestDamage("Shock");
1475 if ((fireDamage > 80.0 || shockDamage > 40.0) && impactBehaviour == 1)
1476 pAnimHitFullbody = true;
1477 }
1478 }
1479
1480 break;
1481
1482 case DamageType.EXPLOSION:
1483 break;
1484
1485 case DamageType.CUSTOM:
1486 pAnimType = GetGame().ConfigGetInt("cfgAmmo " + pAmmoType + " hitAnimation");
1487 if (pAnimType == 1)
1488 pAnimHitFullbody = true;
1489 else if (pAmmoType != "HeatDamage" || IsSwimming() || IsInVehicle())
1490 return false;
1491
1492 break;
1493 }
1494
1496 vector targetDirection = GetDirection();
1497 vector toSourceDirection = (pSource.GetPosition() - GetPosition());
1498
1499 targetDirection[1] = 0;
1500 toSourceDirection[1] = 0;
1501
1502 targetDirection.Normalize();
1503 toSourceDirection.Normalize();
1504
1505 float cosFi = vector.Dot(targetDirection, toSourceDirection);
1506 vector cross = targetDirection * toSourceDirection;
1507
1508 pAnimHitDir = Math.Acos(cosFi) * Math.RAD2DEG;
1509
1510 // We will invert direction of the hit
1511 if (invertHitDir > 0)
1512 pAnimHitDir -= 180;
1513
1514 if (cross[1] < 0)
1515 pAnimHitDir = -pAnimHitDir;
1516
1517 return true;
1518 }
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:489
bool IsInVehicle()
Определения DayZPlayerImplement.c:484
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().