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
This commit is contained in:
Cyruz 2023-03-18 19:24:27 +00:00 committed by GitHub
parent 4997a4c102
commit 2092d4fd71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 1 deletions

View File

@ -7,4 +7,4 @@ PREP(cookOffEffect);
PREP(cookOffBox); PREP(cookOffBox);
PREP(detonateAmmunition); PREP(detonateAmmunition);
PREP(getVehicleAmmo); PREP(getVehicleAmmo);
PREP(isMagazineFlare);

View File

@ -29,6 +29,7 @@ private _totalAmmo = 0;
_x params ["_mag", "_turret", "_count"]; _x params ["_mag", "_turret", "_count"];
// if the turret is an FFV seat, it takes magazines from the soldier // if the turret is an FFV seat, it takes magazines from the soldier
if (_count > 0) then { if (_count > 0) then {
if (_mag call FUNC(isMagazineFlare)) then {continue};
private _ammo = getText (configFile >> "CfgMagazines" >> _mag >> "ammo"); private _ammo = getText (configFile >> "CfgMagazines" >> _mag >> "ammo");
private _model = getText (configFile >> "CfgAmmo" >> _ammo >> "model"); private _model = getText (configFile >> "CfgAmmo" >> _ammo >> "model");
if (_model == "\A3\weapons_f\empty") exitWith {TRACE_3("skipping",_mag,_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"]; _x params ["_mag", "_count"];
if (_count > 0) then { if (_count > 0) then {
if (_mag call FUNC(isMagazineFlare)) then {continue};
_ammoToDetonate pushBack [_mag, _count]; _ammoToDetonate pushBack [_mag, _count];
_totalAmmo = _totalAmmo + _count; _totalAmmo = _totalAmmo + _count;
}; };

View File

@ -0,0 +1,24 @@
#include "script_component.hpp"
/*
* Author: Cyruz
* Checks if the magazine has ammo which is a flare
*
* Arguments:
* 0: Magazine <STRING>
*
* Return Value:
* 0: If magazine is type of flare <BOOL>
*
* 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