From 2092d4fd71c31bf0bd7f103f9d775c92b316a806 Mon Sep 17 00:00:00 2001 From: Cyruz Date: Sat, 18 Mar 2023 19:24:27 +0000 Subject: [PATCH] Cookoff - Remove flares from cookoff (#9146) * Framework for removing flares * Seperate fnc and strings etc * Improvements from @mharis001 * Fix incorrect header fnc * Clean-up return * Remove setting --- addons/cookoff/XEH_PREP.hpp | 2 +- .../cookoff/functions/fnc_getVehicleAmmo.sqf | 2 ++ .../cookoff/functions/fnc_isMagazineFlare.sqf | 24 +++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 addons/cookoff/functions/fnc_isMagazineFlare.sqf diff --git a/addons/cookoff/XEH_PREP.hpp b/addons/cookoff/XEH_PREP.hpp index b9708b7c58..2cd87efaa7 100644 --- a/addons/cookoff/XEH_PREP.hpp +++ b/addons/cookoff/XEH_PREP.hpp @@ -7,4 +7,4 @@ PREP(cookOffEffect); PREP(cookOffBox); PREP(detonateAmmunition); PREP(getVehicleAmmo); - +PREP(isMagazineFlare); diff --git a/addons/cookoff/functions/fnc_getVehicleAmmo.sqf b/addons/cookoff/functions/fnc_getVehicleAmmo.sqf index 295d54a54f..95caf09dd5 100644 --- a/addons/cookoff/functions/fnc_getVehicleAmmo.sqf +++ b/addons/cookoff/functions/fnc_getVehicleAmmo.sqf @@ -29,6 +29,7 @@ private _totalAmmo = 0; _x params ["_mag", "_turret", "_count"]; // if the turret is an FFV seat, it takes magazines from the soldier if (_count > 0) then { + if (_mag call FUNC(isMagazineFlare)) then {continue}; private _ammo = getText (configFile >> "CfgMagazines" >> _mag >> "ammo"); private _model = getText (configFile >> "CfgAmmo" >> _ammo >> "model"); if (_model == "\A3\weapons_f\empty") exitWith {TRACE_3("skipping",_mag,_ammo,_model);}; @@ -41,6 +42,7 @@ private _totalAmmo = 0; { _x params ["_mag", "_count"]; if (_count > 0) then { + if (_mag call FUNC(isMagazineFlare)) then {continue}; _ammoToDetonate pushBack [_mag, _count]; _totalAmmo = _totalAmmo + _count; }; diff --git a/addons/cookoff/functions/fnc_isMagazineFlare.sqf b/addons/cookoff/functions/fnc_isMagazineFlare.sqf new file mode 100644 index 0000000000..6b43824946 --- /dev/null +++ b/addons/cookoff/functions/fnc_isMagazineFlare.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" +/* + * Author: Cyruz + * Checks if the magazine has ammo which is a flare + * + * Arguments: + * 0: Magazine + * + * Return Value: + * 0: If magazine is type of flare + * + * Example: + * ["3Rnd_UGL_FlareWhite_F"] call ace_cookoff_fnc_isMagazineFlare + * + * Public: No + */ + +params ["_magazine"]; + +private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"); +private _intensity = getNumber (configFile >> "CfgAmmo" >> _ammo >> "intensity"); +private _flare = getNumber (configFile >> "CfgAmmo" >> _ammo >> QEGVAR(grenades,flare)); + +_intensity != 0 || _flare == 1