SOG Compat - Add isDamageAllowed check to punji damage handler (#8670)

* SOG Compat - Exclude invulnerable units from punji damage handler

Title. Previously, even units with damage disabled would still have wounds added upon triggering punji traps.

* Implement lazy select

Co-authored-by: commy2 <commy-2@gmx.de>

Co-authored-by: commy2 <commy-2@gmx.de>
This commit is contained in:
Zman6258 2021-11-09 14:49:36 -05:00 committed by GitHub
parent d73f0f3db4
commit f8e06b49a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,7 @@ params ["_trap"];
if (isNull (configFile >> "CfgPatches" >> "ace_medical")) exitWith {};
private _radius = getNumber (configOf _trap >> "indirectHitRange");
private _affectedUnits = (_trap nearEntities ["CAManBase", _radius]) select {local _x};
private _affectedUnits = (_trap nearEntities ["CAManBase", _radius]) select {local _x} select {isDamageAllowed _x};
(getShotParents _trap) params ["", "_instigator"];
if (_affectedUnits isEqualTo []) exitWith {};