mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
use common addExplosionEventHandler
move from firedEH to use common's explode event
This commit is contained in:
parent
06b3aa25eb
commit
0642d3724d
@ -3,6 +3,39 @@
|
||||
[
|
||||
"CBA_settingsInitialized",
|
||||
{
|
||||
|
||||
[{
|
||||
params ["_projectile", "_posASL"];
|
||||
|
||||
if (_projectile getVariable [QGVAR(blacklisted), false]) exitWith {};
|
||||
|
||||
if (GVAR(reflectionsEnabled)) then {
|
||||
[_posASL, _ammo] call FUNC(doReflections);
|
||||
};
|
||||
|
||||
private _ammo = typeOf _projectile;
|
||||
if !(_ammo call FUNC(shouldFrag)) exitWith {};
|
||||
private _shotParents = getShotParents _projectile;
|
||||
|
||||
// only let a unit make a frag event once per second
|
||||
private _instigator = _shotParents#1;
|
||||
if (CBA_missionTime < (_instigator getVariable [QGVAR(nextFragEvent), -1])) exitWith {};
|
||||
_instigator setVariable [QGVAR(nextFragEvent), CBA_missionTime + ACE_FRAG_FRAG_UNIT_HOLDOFF];
|
||||
|
||||
// Wait a frame to make sure it doesn't target the dead
|
||||
[
|
||||
{ [QGVAR(frag_eh), _this] call CBA_fnc_serverEvent; },
|
||||
[_posASL, _ammo, [objNull, _instigator]]
|
||||
] call CBA_fnc_execNextFrame;
|
||||
|
||||
}] call EFUNC(common,addExplosionEventHandler);
|
||||
|
||||
|
||||
|
||||
#ifndef DEBUG_MODE_DRAW
|
||||
if (GVAR(spallEnabled)) exitWith {};
|
||||
#endif
|
||||
|
||||
["ace_firedPlayer", LINKFUNC(fired)] call CBA_fnc_addEventHandler;
|
||||
["ace_firedNonPlayer", LINKFUNC(fired)] call CBA_fnc_addEventHandler;
|
||||
["ace_firedPlayerVehicle", LINKFUNC(fired)] call CBA_fnc_addEventHandler;
|
||||
|
@ -19,11 +19,3 @@ params ["_projectile"];
|
||||
TRACE_2("addBlackList",_projectile,typeOf projectile);
|
||||
|
||||
_projectile setVariable [QGVAR(blacklisted), true];
|
||||
_projectile removeEventHandler [
|
||||
"HitPart",
|
||||
_projectile getVariable [QGVAR(hitPartEventHandler), -1]
|
||||
];
|
||||
_projectile removeEventHandler [
|
||||
"Explode",
|
||||
_projectile getVariable [QGVAR(explodeEventHandler), -1]
|
||||
];
|
||||
|
@ -53,34 +53,6 @@ if (GVAR(spallEnabled) && {_ammo call FUNC(shouldSpall)}) then {
|
||||
_projectile setVariable [QGVAR(hitPartEventHandler), _hitPartEventHandler];
|
||||
};
|
||||
|
||||
if (GVAR(reflectionsEnabled) || (GVAR(enabled) && {_ammo call FUNC(shouldFrag)})) then {
|
||||
private _explodeEventHandler = _projectile addEventHandler [
|
||||
"Explode",
|
||||
{
|
||||
params ["_projectile", "_posASL"];
|
||||
|
||||
if (GVAR(reflectionsEnabled)) then {
|
||||
[_posASL, _ammo] call FUNC(doReflections);
|
||||
};
|
||||
|
||||
private _shotParents = getShotParents _projectile;
|
||||
private _ammo = typeOf _projectile;
|
||||
|
||||
// only let a unit make a frag event once per second
|
||||
private _instigator = _shotParents#1;
|
||||
if (CBA_missionTime < (_instigator getVariable [QGVAR(nextFragEvent), -1])) exitWith {};
|
||||
_instigator setVariable [QGVAR(nextFragEvent), CBA_missionTime + ACE_FRAG_FRAG_UNIT_HOLDOFF];
|
||||
|
||||
// Wait a frame to make sure it doesn't target the dead
|
||||
[
|
||||
{ [QGVAR(frag_eh), _this] call CBA_fnc_serverEvent; },
|
||||
[_posASL, _ammo, [objNull, _instigator]]
|
||||
] call CBA_fnc_execNextFrame;
|
||||
}
|
||||
];
|
||||
_projectile setVariable [QGVAR(explodeEventHandler), _explodeEventHandler];
|
||||
};
|
||||
|
||||
#ifdef DEBUG_MODE_DRAW
|
||||
if (GVAR(debugOptions) && {_ammo call FUNC(shouldFrag) || {_ammo call FUNC(shouldSpall)}}) then {
|
||||
[_projectile, "red", true] call FUNC(dev_trackObj);
|
||||
|
Loading…
Reference in New Issue
Block a user