cookOff - Fix: Disable ammunition cookoff and turret effect when skipping destruction effects (#8122)

* Disable ammunition cookoff and turret effect when skiping destruction effects

* Improve readability
This commit is contained in:
Vdauphin 2021-02-23 18:42:15 +01:00 committed by GitHub
parent 61e8ae3c8b
commit d00e7a17a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,8 +73,11 @@ GVAR(cacheTankDuplicates) = call CBA_fnc_createNamespace;
// secondary explosions
["AllVehicles", "killed", {
params ["_vehicle"];
if (_vehicle getVariable [QGVAR(enableAmmoCookoff), GVAR(enableAmmoCookoff)]) then {
params ["_vehicle", "", "", "_useEffects"];
if (
_useEffects &&
_vehicle getVariable [QGVAR(enableAmmoCookoff), GVAR(enableAmmoCookoff)]
) then {
if (GVAR(ammoCookoffDuration) == 0) exitWith {};
([_vehicle] call FUNC(getVehicleAmmo)) params ["_mags", "_total"];
[_vehicle, _mags, _total] call FUNC(detonateAmmunition);
@ -83,9 +86,13 @@ GVAR(cacheTankDuplicates) = call CBA_fnc_createNamespace;
// blow off turret effect
["Tank", "killed", {
if ((_this select 0) getVariable [QGVAR(enable), GVAR(enable)] in [1, 2, true]) then {
params ["_vehicle", "", "", "_useEffects"];
if (
_useEffects &&
_vehicle getVariable [QGVAR(enable), GVAR(enable)] in [1, 2, true]
) then {
if (random 1 < 0.15) then {
(_this select 0) call FUNC(blowOffTurret);
_vehicle call FUNC(blowOffTurret);
};
};
}] call CBA_fnc_addClassEventHandler;