2016-07-14 14:16:53 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
[QGVAR(engineFire), FUNC(engineFire)] call CBA_fnc_addEventHandler;
|
2021-10-14 15:49:27 +00:00
|
|
|
[QGVAR(cookOff), {
|
2016-08-23 07:57:54 +00:00
|
|
|
params ["_vehicle"];
|
2021-10-14 15:49:27 +00:00
|
|
|
if (local _vehicle) then {
|
|
|
|
_this call FUNC(cookOff);
|
2016-08-23 07:57:54 +00:00
|
|
|
};
|
2021-10-14 15:49:27 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
[QGVAR(cookOffEffect), FUNC(cookOffEffect)] call CBA_fnc_addEventHandler;
|
|
|
|
[QGVAR(smoke), FUNC(smoke)] call CBA_fnc_addEventHandler;
|
|
|
|
[QGVAR(cookOffBox), FUNC(cookOffBox)] call CBA_fnc_addEventHandler;
|
2016-08-23 07:57:54 +00:00
|
|
|
|
2022-07-15 14:59:49 +00:00
|
|
|
// handle cleaning up effects when vehicle is deleted mid-cookoff
|
|
|
|
[QGVAR(addCleanupHandlers), {
|
|
|
|
params ["_vehicle"];
|
|
|
|
|
|
|
|
// Don't add a new EH if cookoff is run multiple times
|
|
|
|
if ((_vehicle getVariable [QGVAR(deletedEH), -1]) == -1) then {
|
|
|
|
private _deletedEH = _vehicle addEventHandler ["Deleted", {
|
|
|
|
params ["_vehicle"];
|
|
|
|
|
2022-08-20 21:38:06 +00:00
|
|
|
[QGVAR(cleanupEffects), [_vehicle]] call CBA_fnc_localEvent;
|
2022-07-15 14:59:49 +00:00
|
|
|
}];
|
|
|
|
|
|
|
|
_vehicle setVariable [QGVAR(deletedEH), _deletedEH];
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2021-10-14 15:49:27 +00:00
|
|
|
[QGVAR(cleanupEffects), {
|
|
|
|
params ["_vehicle", ["_effects", []]];
|
2021-10-30 21:42:03 +00:00
|
|
|
|
2021-10-14 15:49:27 +00:00
|
|
|
_effects = _effects + (_vehicle getVariable [QGVAR(effects), []]);
|
2021-12-18 23:15:32 +00:00
|
|
|
if (_effects isNotEqualTo []) then {
|
2021-10-14 15:49:27 +00:00
|
|
|
{ deleteVehicle _x } count _effects;
|
2016-10-28 20:10:40 +00:00
|
|
|
};
|
2021-10-14 15:49:27 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
2016-10-28 20:10:40 +00:00
|
|
|
|
2016-10-06 20:37:38 +00:00
|
|
|
["ReammoBox_F", "init", {
|
|
|
|
(_this select 0) addEventHandler ["HandleDamage", {
|
2017-12-06 19:13:10 +00:00
|
|
|
if ((_this select 0) getVariable [QGVAR(enableAmmoCookoff), GVAR(enableAmmobox)]) then {
|
2021-10-17 20:01:41 +00:00
|
|
|
_this call FUNC(handleDamageBox);
|
2016-10-06 20:37:38 +00:00
|
|
|
};
|
|
|
|
}];
|
|
|
|
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
|
|
|
|
|
2016-07-14 14:16:53 +00:00
|
|
|
// secondary explosions
|
2016-08-13 10:12:34 +00:00
|
|
|
["AllVehicles", "killed", {
|
2021-02-23 17:42:15 +00:00
|
|
|
params ["_vehicle", "", "", "_useEffects"];
|
|
|
|
if (
|
|
|
|
_useEffects &&
|
|
|
|
_vehicle getVariable [QGVAR(enableAmmoCookoff), GVAR(enableAmmoCookoff)]
|
|
|
|
) then {
|
2017-01-23 18:13:02 +00:00
|
|
|
if (GVAR(ammoCookoffDuration) == 0) exitWith {};
|
2017-01-04 21:35:54 +00:00
|
|
|
([_vehicle] call FUNC(getVehicleAmmo)) params ["_mags", "_total"];
|
2022-08-20 21:36:37 +00:00
|
|
|
|
|
|
|
private _delay = (random MAX_AMMO_DETONATION_START_DELAY) max MIN_AMMO_DETONATION_START_DELAY;
|
|
|
|
[FUNC(detonateAmmunition), [_vehicle, _mags, _total], _delay] call CBA_fnc_waitAndExecute;
|
2016-08-13 10:12:34 +00:00
|
|
|
};
|
2016-10-06 20:37:38 +00:00
|
|
|
}, nil, ["Man","StaticWeapon"]] call CBA_fnc_addClassEventHandler;
|