/*
 * Author: Hizumi
 *
 * Create Ammo resupply box for the 17th Batallion
 *
 * Arguments:
 * 0: Vehicle - <OBJECT>
 * 1: Position - <ARRAY>
 *
 * Return Value:
 * Function executed <BOOL>
 *
 * Example:
 * [box] call milsim_fnc_createAmmoBox; 			// create ammo box via init line of editor object
 * [objNull, pos] call milsim_fnc_createAmmoBox		// create ammo box via zeus module
 *
 * Public: Yes
 */


params [
	["_box", objNull, [objNull]],
	["_pos", [0,0,0], [[]], 3]
];

if (isNull _box) then {
	_box = "Box_Syndicate_Ammo_F" createVehicle _pos;
};

clearBackpackCargoGlobal _box;
clearItemCargoGlobal _box;
clearMagazineCargoGlobal _box;
clearWeaponCargoGlobal _box;

_packs = [];

_items = [];

_magazines = [
	["1Rnd_SmokePurple_Grenade_shell",12],
	["1Rnd_SmokeBlue_Grenade_shell",24],
	["1Rnd_SmokeOrange_Grenade_shell",12],
	["rhs_mag_M441_HE",25],
	["rhs_mag_M433_HEDP",15],
	["ACE_40mm_Flare_ir",12],
	["rhsusf_200Rnd_556x45_mixed_soft_pouch_coyote",25],
	["rhsusf_20Rnd_762x51_m993_Mag",25],
	["SmokeShell",12],
	["rhs_mag_m67",12],
	["1Rnd_Smoke_Grenade_shell",24],
	["1Rnd_SmokeRed_Grenade_shell",24],
	["1Rnd_SmokeGreen_Grenade_shell",24],
	["1Rnd_SmokeYellow_Grenade_shell",12],
	["Tier1_30Rnd_556x45_M856A1_EMag",25],
	["Tier1_30Rnd_556x45_Mk318Mod0_EMag",75],
	["ACE_30Rnd_65_Creedmor_mag",25],
	["SMA_30Rnd_762x35_BLK_EPR",25],
	["Tier1_30Rnd_762x35_300BLK_SMK_PMAG",25],
	["SMA_30Rnd_68x43_SPC_FMJ",25],
	["SMA_30Rnd_68x43_SPC_FMJ_Tracer",25],
	["SMA_20Rnd_762x51mm_M80A1_EPR",25],
	["SMA_20Rnd_762x51mm_M80A1_EPR_Tracer",25],
	["SMA_20Rnd_762x51mm_Mk316_Mod_0_Special_Long_Range",25],
	["SMA_20Rnd_762x51mm_Mk316_Mod_0_Special_Long_Range_Tracer",25],
	["Tier1_250Rnd_762x51_Belt_M993_AP",15],
	["ACE_20Rnd_762x51_Mag_Tracer",25],
	["ACE_20Rnd_762x51_M993_AP_Mag",25],
	["rhsusf_20Rnd_762x51_SR25_m993_Mag",25],
	["Tier1_20Rnd_762x51_M993_SR25_Mag",25],
	["Tier1_20Rnd_65x48_Creedmoor_SR25_Mag",25],
	["rhssaf_30rnd_556x45_EPR_G36", 25],
	["DemoCharge_Remote_Mag",16]
];

_weapons = [
	["rhs_weap_M136",4],
	["rhs_weap_M136_hp",4],
	["rhs_weap_m72a7",2]
];

{
	_x params ["_class", "_qty"];
	
	_box addBackpackCargoGlobal [_class, _qty]
	
} foreach _packs;

{
	_x params ["_class", "_qty"];
	
	_box addItemCargoGlobal [_class, _qty]
	
} foreach _items;

{
	_x params ["_class", "_qty"];
	
	_box addMagazineCargoGlobal [_class, _qty]
	
} foreach _magazines;

{
	_x params ["_class", "_qty"];
	
	_box addWeaponCargoGlobal [_class, _qty]
	
} foreach _weapons;

[_box,1] call ace_cargo_fnc_setSize;

true;