Readd blacklist

This commit is contained in:
johnb432 2024-05-18 11:16:43 +02:00
parent 4f0c1671e6
commit e2dce5e102
3 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,4 @@
PREP(addBlackList);
PREP(dev_addRound); PREP(dev_addRound);
PREP(dev_clearTraces); PREP(dev_clearTraces);
PREP(dev_debugAmmo); PREP(dev_debugAmmo);

View File

@ -0,0 +1,21 @@
#include "..\script_component.hpp"
/*
* Author: Jaynus, NouberNou
* Adds a round to the blacklist (will be ignored).
*
* Arguments:
* 0: Projectile <OBJECT>
*
* Return Value:
* None
*
* Example:
* [_projectile] call ace_frag_fnc_addBlackList
*
* Public: No
*/
params ["_projectile"];
TRACE_1("addBlackList",_projectile);
_projectile setVariable [QGVAR(blacklisted), true, true];

View File

@ -25,11 +25,16 @@ if (_ammo isEqualTo "" || {isNull _projectile}) exitWith {
TRACE_2("bad ammo or projectile",_ammo,_projectile); TRACE_2("bad ammo or projectile",_ammo,_projectile);
}; };
if (_projectile getVariable [QGVAR(blacklisted), false]) exitWith {};
if (GVAR(enabled) && {_ammo call FUNC(shouldFrag)}) then { if (GVAR(enabled) && {_ammo call FUNC(shouldFrag)}) then {
_projectile addEventHandler [ _projectile addEventHandler [
"Explode", "Explode",
{ {
params ["_projectile", "_posASL", "_velocity"]; params ["_projectile", "_posASL", "_velocity"];
if (_projectile getVariable [QGVAR(blacklisted), false]) exitWith {};
private _shotParents = _projectile getVariable [QGVAR(shotParent), getShotParents _projectile]; private _shotParents = _projectile getVariable [QGVAR(shotParent), getShotParents _projectile];
private _ammo = typeOf _projectile; private _ammo = typeOf _projectile;
// wait for frag damage to kill units before spawning fragments // wait for frag damage to kill units before spawning fragments
@ -49,6 +54,9 @@ if (GVAR(spallEnabled) && {_ammo call FUNC(shouldSpall)}) then {
"HitPart", "HitPart",
{ {
params ["_projectile", "_hitObject", "", "_posASL", "_velocity", "_surfNorm", "", "", "_surfType"]; 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 // 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 // The "explode" EH does not get the same parameter
private _shotParent = getShotParents _projectile; private _shotParent = getShotParents _projectile;