Fixed of m_lastDamageAmount recording during armor calculation (#857)

This commit is contained in:
Javekson 2023-09-05 07:53:22 +04:00 committed by GitHub
parent e8bff71475
commit 728f1fcc67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1153,9 +1153,6 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
}
}
// keep track of amount of damage last sustained
m_lastDamageAmount = flDamage;
// Armor
// armor doesn't protect against fall or drown damage!
if (pev->armorvalue != 0.0f && !(bitsDamageType & (DMG_DROWN | DMG_FALL)) && IsArmored(m_LastHitGroup))
@ -1195,6 +1192,9 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
Pain(m_LastHitGroup, false);
}
// keep track of amount of damage last sustained
m_lastDamageAmount = flDamage;
LogAttack(pAttack, this, bTeamAttack, flDamage, armorHit, pev->health - flDamage, pev->armorvalue, GetWeaponName(pevInflictor, pevAttacker));
// this cast to INT is critical!!! If a player ends up with 0.5 health, the engine will get that