From f1483c59c30dc978b8f9d5aa54344ca55cbbfd57 Mon Sep 17 00:00:00 2001 From: lambdatiger Date: Sun, 19 May 2024 13:40:02 -0500 Subject: [PATCH] Revert "Exposed projectile event handlers for both blacklist use and other shenanigans." This reverts commit eaff498f3f46c62fa9ebe8b4272a690f8870e93a. --- addons/frag/functions/fnc_addBlacklist.sqf | 2 -- addons/frag/functions/fnc_initRound.sqf | 17 ++++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/addons/frag/functions/fnc_addBlacklist.sqf b/addons/frag/functions/fnc_addBlacklist.sqf index 213d84ee32..40a3b1434c 100644 --- a/addons/frag/functions/fnc_addBlacklist.sqf +++ b/addons/frag/functions/fnc_addBlacklist.sqf @@ -19,5 +19,3 @@ params ["_projectile"]; TRACE_1("addBlackList",_projectile); _projectile setVariable [QGVAR(blacklisted), true, true]; -_projectile removeEventHandler ["HitPart", _projectile getVariable [QGVAR(hitPartEH), -1]]; -_projectile removeEventHandler ["Explode", _projectile getVariable [QGVAR(explodeEH), -1]]; \ No newline at end of file diff --git a/addons/frag/functions/fnc_initRound.sqf b/addons/frag/functions/fnc_initRound.sqf index b04408360b..46d4281c6a 100644 --- a/addons/frag/functions/fnc_initRound.sqf +++ b/addons/frag/functions/fnc_initRound.sqf @@ -21,17 +21,20 @@ if (!isServer) exitWith {}; params ["_projectile"]; private _ammo = typeOf _projectile; -if (_ammo isEqualTo "" || {isNull _projectile} - || {_projectile getVariable [QGVAR(blacklisted), false]}) exitWith { - TRACE_2("bad ammo or projectile, or blackList",_ammo,_projectile); +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 { - private _explodeEH = _projectile addEventHandler [ + _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 @@ -44,15 +47,16 @@ if (GVAR(enabled) && {_ammo call FUNC(shouldFrag)}) then { }; } ]; - _projectile setVariable [QGVAR(explodeEH), _explodeEH]; }; if (GVAR(spallEnabled) && {_ammo call FUNC(shouldSpall)}) then { - private _hitPartEH = _projectile addEventHandler [ + _projectile addEventHandler [ "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; @@ -68,7 +72,6 @@ if (GVAR(spallEnabled) && {_ammo call FUNC(shouldSpall)}) then { ] call CBA_fnc_execNextFrame; } ]; - _projectile setVariable [QGVAR(hitPartEH), _hitPartEH]; }; #ifdef DEBUG_MODE_DRAW if (GVAR(debugOptions) && {_ammo call FUNC(shouldFrag) || {_ammo call FUNC(shouldSpall)}}) then {