Medical Engine - Exit early if incoming damage is 0 (#9733)

This commit is contained in:
Grim 2024-01-14 15:16:55 -03:00 committed by GitHub
parent caa4018623
commit a684e874fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,6 +32,11 @@ if (_hitPoint isEqualTo "") then {
if !(isDamageAllowed _unit && {_unit getVariable [QEGVAR(medical,allowDamage), true]}) exitWith {_oldDamage};
private _newDamage = _damage - _oldDamage;
// Happens occasionally for vehiclehit events (see line 80 onwards)
// Just exit early to save some frametime
if (_newDamage == 0) exitWith {_oldDamage};
// Get scaled armor value of hitpoint and calculate damage before armor
// We scale using passThrough to handle explosive-resistant armor properly (#9063)
// We need realDamage to determine which limb was hit correctly