Revert "Exposed projectile event handlers for both blacklist use and other shenanigans."

This reverts commit eaff498f3f.
This commit is contained in:
lambdatiger 2024-05-19 13:40:02 -05:00
parent eaff498f3f
commit f1483c59c3
2 changed files with 10 additions and 9 deletions

View File

@ -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]];

View File

@ -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 {