mirror of
https://github.com/IT07/a3_vemf_reloaded.git
synced 2024-08-30 16:52:11 +00:00
Overhaul
This commit is contained in:
parent
ad35d95c33
commit
afb1b741e2
@ -15,103 +15,60 @@
|
|||||||
private ["_done"];
|
private ["_done"];
|
||||||
_done = false;
|
_done = false;
|
||||||
if (_this isEqualType []) then
|
if (_this isEqualType []) then
|
||||||
{
|
{
|
||||||
private ["_unit"];
|
private ["_unit"];
|
||||||
_unit = param [0, objNull, [objNull]];
|
_unit = param [0, objNull, [objNull]];
|
||||||
if not isNull _unit then
|
if not isNull _unit then
|
||||||
{
|
{
|
||||||
if local _unit then
|
if local _unit then
|
||||||
{
|
{
|
||||||
if not(primaryWeapon _unit isEqualTo "") then
|
if not(primaryWeapon _unit isEqualTo "") then
|
||||||
{
|
{
|
||||||
if not(vest _unit isEqualTo "") then
|
private ["_weapon","_mag","_magMass","_vestMass","_itemMass"];
|
||||||
{
|
_weapon = primaryWeapon _unit;
|
||||||
private ["_weapon","_mag","_magMass","_vestMass","_itemMass"];
|
_mag = selectRandom (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"));
|
||||||
_weapon = primaryWeapon _unit;
|
for "_m" from 1 to 5 do
|
||||||
_mag = selectRandom (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"));
|
{
|
||||||
_magMass = getNumber (configFile >> "CfgMagazines" >> _mag >> "mass");
|
if not(_unit canAdd _mag) exitWith {};
|
||||||
_vestMass = getNumber (configFile >> "CfgWeapons" >> (vest _unit) >> "ItemInfo" >> "mass");
|
_unit addItem _mag;
|
||||||
{
|
};
|
||||||
_itemMass = getNumber (configFile >> "CfgMagazines" >> _x >> "ItemInfo" >> "mass");
|
};
|
||||||
if (_itemMass isEqualTo 0) then
|
if not (secondaryWeapon _unit isEqualTo "") then
|
||||||
{
|
{
|
||||||
_itemMass = getNumber (configFile >> "CfgWeapons" >> _x >> "WeaponSlotsInfo" >> "mass");
|
if not(backPack _unit isEqualTo "") then
|
||||||
};
|
{
|
||||||
_vestMass = _vestMass - _itemMass;
|
private ["_weapon","_mag","_magMass"];
|
||||||
} forEach (vestItems _unit);
|
_weapon = secondaryWeapon _unit;
|
||||||
if (_vestMass >= _magMass) then
|
_mag = selectRandom (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"));
|
||||||
{
|
for "_m" from 1 to 3 do
|
||||||
for "_m" from 1 to (round(_vestMass / _magMass)) do
|
{
|
||||||
{
|
if not(_unit canAdd _mag) exitWith {};
|
||||||
_unit addItemToVest _mag;
|
_unit addItem _mag;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
if not (handGunWeapon _unit isEqualTo "") then
|
||||||
if not (secondaryWeapon _unit isEqualTo "") then
|
{
|
||||||
{
|
private ["_weapon","_mag","_magMass","_uniformMass"];
|
||||||
if not(backPack _unit isEqualTo "") then
|
_weapon = handGunWeapon _unit;
|
||||||
{
|
_mag = selectRandom (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"));
|
||||||
private ["_weapon","_mag","_magMass"];
|
for "_m" from 1 to 4 do
|
||||||
_weapon = secondaryWeapon _unit;
|
{
|
||||||
_mag = selectRandom (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"));
|
if not(_unit canAdd _mag) exitWith {};
|
||||||
_magMass = getNumber (configFile >> "CfgMagazines" >> _mag >> "mass");
|
_unit addItem _mag;
|
||||||
if not(backpack _unit isEqualTo "") then
|
};
|
||||||
{
|
};
|
||||||
private ["_packMass"];
|
_done = true;
|
||||||
_packMass = getNumber (configFile >> "CfgVehicles" >> (backpack _unit) >> "mass");
|
} else // If unit is not local
|
||||||
{
|
{
|
||||||
private ["_itemMass"];
|
["fn_giveAmmo", 0, format["%1 is not local. Can not execute!", _unit]] spawn VEMfr_fnc_log;
|
||||||
_itemMass = getNumber (configFile >> "CfgMagazines" >> _x >> "mass");
|
};
|
||||||
if (_itemMass isEqualTo 0) then
|
} else // If unit isNull
|
||||||
{
|
{
|
||||||
_itemMass = getNumber (configFile >> "CfgWeapons" >> _x >> "WeaponSlotsInfo" >> "mass");
|
["fn_giveAmmo", 0, "_unit isNull. Can not execute!"] spawn VEMFr_fnc_log;
|
||||||
};
|
};
|
||||||
_packMass = _packMass - _itemMass;
|
} else
|
||||||
} forEach (backpackItems _unit);
|
{
|
||||||
if (_packMass >= _magMass) then
|
["fn_giveAmmo", 0, "_this is not an ARRAY"] spawn VEMFr_fnc_log;
|
||||||
{
|
};
|
||||||
for "_m" from 1 to (round(_packMass / _magMass)) do
|
|
||||||
{
|
|
||||||
_unit addItemToBackpack _mag;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if not (handGunWeapon _unit isEqualTo "") then
|
|
||||||
{
|
|
||||||
if not(uniform _unit isEqualTo "") then
|
|
||||||
{
|
|
||||||
private ["_weapon","_mag","_magMass","_uniformMass"];
|
|
||||||
_weapon = handGunWeapon _unit;
|
|
||||||
_mag = selectRandom (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"));
|
|
||||||
_magMass = getNumber (configFile >> "CfgMagazines" >> _mag >> "mass");
|
|
||||||
_uniformMass = getNumber (configFile >> "CfgWeapons" >> (uniform _unit) >> "ItemInfo" >> "mass");
|
|
||||||
{
|
|
||||||
private ["_itemMass"];
|
|
||||||
_itemMass = getNumber (configFile >> "CfgMagazines" >> _x >> "mass");
|
|
||||||
if (_itemMass isEqualTo 0) then
|
|
||||||
{
|
|
||||||
_itemMass = getNumber (configFile >> "CfgWeapons" >> _x >> "WeaponSlotsInfo" >> "mass");
|
|
||||||
};
|
|
||||||
_uniformMass = _uniformMass - _itemMass;
|
|
||||||
} forEach (uniformItems _unit);
|
|
||||||
for "_m" from 1 to (round(_uniformMass / _magMass)) do
|
|
||||||
{
|
|
||||||
_unit addItemToUniform _mag;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
_done = true;
|
|
||||||
} else // If unit is not local
|
|
||||||
{
|
|
||||||
["fn_giveAmmo", 0, format["%1 is not local. Can not execute!", _unit]] spawn VEMfr_fnc_log;
|
|
||||||
};
|
|
||||||
} else // If unit isNull
|
|
||||||
{
|
|
||||||
["fn_giveAmmo", 0, "_unit isNull. Can not execute!"] spawn VEMFr_fnc_log;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
_done
|
_done
|
||||||
|
Loading…
Reference in New Issue
Block a user