From d2b60a52258b488d3f7465492a9542ac6b8485f0 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 13 Oct 2024 13:18:59 -0500 Subject: [PATCH] Medical & Vehicle Damage - Only detect end key if dmg is exactly 1 (#10416) --- addons/medical_engine/functions/fnc_handleDamage.sqf | 3 +-- addons/vehicle_damage/functions/fnc_handleDamage.sqf | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/addons/medical_engine/functions/fnc_handleDamage.sqf b/addons/medical_engine/functions/fnc_handleDamage.sqf index 422daffcc14..cf891f5e532 100644 --- a/addons/medical_engine/functions/fnc_handleDamage.sqf +++ b/addons/medical_engine/functions/fnc_handleDamage.sqf @@ -35,9 +35,8 @@ if !(isDamageAllowed _unit && {_unit getVariable [QEGVAR(medical,allowDamage), t // Killing units via End key is an edge case (#10375) // This didn't matter pre-Arma 3 2.18 but now this goes through the event handler // TODO: Structural fire damage >= 1 in a single damage event could still be caught here and we don't want that, but we haven't found a better way to catch this, fire damage should be small most of the time anyway -if (_structuralDamage && {_damage >= 1 && _ammo == "" && isNull _shooter && isNull _instigator}) exitWith {_damage}; - private _newDamage = _damage - _oldDamage; +if (_structuralDamage && {(abs (_newDamage - 1)) < 0.001 && _ammo == "" && isNull _shooter && isNull _instigator}) exitWith {_damage}; // _newDamage == 0 happens occasionally for vehiclehit events (see line 80 onwards), just exit early to save some frametime // context 4 is engine "bleeding". For us, it's just a duplicate event for #structural which we can ignore without any issues diff --git a/addons/vehicle_damage/functions/fnc_handleDamage.sqf b/addons/vehicle_damage/functions/fnc_handleDamage.sqf index 6436c4fe7df..11d06f454fd 100644 --- a/addons/vehicle_damage/functions/fnc_handleDamage.sqf +++ b/addons/vehicle_damage/functions/fnc_handleDamage.sqf @@ -27,17 +27,17 @@ TRACE_9("handleDamage",_vehicle,_selection,_newDamage,_source,_projectile,_hitIn if (!local _vehicle) exitWith {}; -// Killing units via End key is an edge case (#10375) -// This didn't matter pre-Arma 3 2.18 but now this goes through the event handler -// TODO: Structural fire damage >= 1 in a single damage event could still be caught here and we don't want that, but we haven't found a better way to catch this, fire damage should be small most of the time anyway -if (_context == 0 && {_newDamage >= 1 && _projectile == "" && isNull _source && isNull _instigator}) exitWith {_newDamage}; - private _currentDamage = if (_selection != "") then { _vehicle getHitIndex _hitIndex } else { damage _vehicle }; +// Killing units via End key is an edge case (#10375) +// This didn't matter pre-Arma 3 2.18 but now this goes through the event handler +// TODO: Structural fire damage >= 1 in a single damage event could still be caught here and we don't want that, but we haven't found a better way to catch this, fire damage should be small most of the time anyway +if (_context == 0 && {(abs (_newDamage - _currentDamage - 1)) < 0.001 && _projectile == "" && isNull _source && isNull _instigator}) exitWith {_newDamage}; + if !(_projectile in ["ace_ammoExplosion", "ACE_ammoExplosionLarge"]) then { // If an invalid hit, don't process it if (_newDamage <= 0 || {"#light" in _hitPoint}) exitWith {};