Cookoff - Fix ammo not being removed from turrets with additional FFV (#8928)

This commit is contained in:
Filip Maciejewski 2022-06-06 13:50:53 +02:00 committed by GitHub
parent 3f7530d89e
commit d8af7b34b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,21 +24,18 @@ TRACE_1("getVehicleAmmo",_vehicle);
private _ammoToDetonate = []; private _ammoToDetonate = [];
private _totalAmmo = 0; private _totalAmmo = 0;
// from ace_common, tweaked becasue command is busted
private _ffvTurrets = fullCrew [_vehicle, "", true] select {_x select 4} apply {_x select 3};
// Get ammo from turrets // Get ammo from turrets
{ {
_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 (!(_turret in _ffvTurrets) && {_count > 0}) then { if (_count > 0) then {
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);};
_ammoToDetonate pushBack [_mag, _count]; _ammoToDetonate pushBack [_mag, _count];
_totalAmmo = _totalAmmo + _count; _totalAmmo = _totalAmmo + _count;
}; };
} forEach (magazinesAllTurrets _vehicle); } forEach (magazinesAllTurrets [_vehicle, true]);
// Get ammo from cargo space // Get ammo from cargo space
{ {