ACE3/addons/gunbag/functions/fnc_calculateMass.sqf

33 lines
698 B
Plaintext
Raw Normal View History

2016-05-04 07:56:33 +00:00
/*
* Author: Ir0n1E
* Calculate mass of weapon an items.
2016-05-04 07:56:33 +00:00
*
* Arguments:
* 0: Weapon <STRING>
* 1: Items <ARRAY>
2016-06-12 11:51:23 +00:00
* 2: Magazines <ARRAY>
2016-05-04 07:56:33 +00:00
*
* Return Value:
* Mass <NUMBER>
*
* Example:
* ["weapon", ["item1", "item2"], ["mag1", "mag2"]] call ace_gunbag_fnc_calculateMass
*
2016-05-04 07:56:33 +00:00
* Public: No
*/
#include "script_component.hpp"
2016-06-12 11:51:23 +00:00
params ["_weapon", "_items", "_magazines"];
2016-05-04 07:56:33 +00:00
private _mass = getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass");
{
2016-05-17 09:21:48 +00:00
_mass = _mass + getNumber (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> "mass");
2016-05-04 07:56:33 +00:00
} foreach _items;
2016-06-12 11:51:23 +00:00
{
_mass = _mass + getNumber (configFile >> "CfgMagazines" >> _x >> "mass");
2016-06-12 11:51:23 +00:00
} forEach _magazines;
2016-05-17 09:21:48 +00:00
_mass