diff --git a/addons/frag/XEH_PREP.hpp b/addons/frag/XEH_PREP.hpp index 845f59a38e..868931fa6f 100644 --- a/addons/frag/XEH_PREP.hpp +++ b/addons/frag/XEH_PREP.hpp @@ -1,3 +1,4 @@ +PREP(addBlackList); PREP(dev_addRound); PREP(dev_clearTraces); PREP(dev_debugAmmo); diff --git a/addons/frag/functions/fnc_addBlacklist.sqf b/addons/frag/functions/fnc_addBlacklist.sqf new file mode 100644 index 0000000000..40a3b1434c --- /dev/null +++ b/addons/frag/functions/fnc_addBlacklist.sqf @@ -0,0 +1,21 @@ +#include "..\script_component.hpp" +/* + * Author: Jaynus, NouberNou + * Adds a round to the blacklist (will be ignored). + * + * Arguments: + * 0: Projectile + * + * Return Value: + * None + * + * Example: + * [_projectile] call ace_frag_fnc_addBlackList + * + * Public: No + */ + +params ["_projectile"]; +TRACE_1("addBlackList",_projectile); + +_projectile setVariable [QGVAR(blacklisted), true, true]; diff --git a/addons/frag/functions/fnc_initRound.sqf b/addons/frag/functions/fnc_initRound.sqf index 22f5814470..46d4281c6a 100644 --- a/addons/frag/functions/fnc_initRound.sqf +++ b/addons/frag/functions/fnc_initRound.sqf @@ -25,11 +25,16 @@ if (_ammo isEqualTo "" || {isNull _projectile}) exitWith { TRACE_2("bad ammo or projectile",_ammo,_projectile); }; +if (_projectile getVariable [QGVAR(blacklisted), false]) exitWith {}; + if (GVAR(enabled) && {_ammo call FUNC(shouldFrag)}) then { _projectile addEventHandler [ "Explode", { params ["_projectile", "_posASL", "_velocity"]; + + if (_projectile getVariable [QGVAR(blacklisted), false]) exitWith {}; + private _shotParents = _projectile getVariable [QGVAR(shotParent), getShotParents _projectile]; private _ammo = typeOf _projectile; // wait for frag damage to kill units before spawning fragments @@ -49,6 +54,9 @@ if (GVAR(spallEnabled) && {_ammo call FUNC(shouldSpall)}) then { "HitPart", { params ["_projectile", "_hitObject", "", "_posASL", "_velocity", "_surfNorm", "", "", "_surfType"]; + + if (_projectile getVariable [QGVAR(blacklisted), false]) exitWith {}; + // starting v2.18 it may be faster to use the instigator parameter, the same as the second entry shotParents, to recreate _shotParent // The "explode" EH does not get the same parameter private _shotParent = getShotParents _projectile;