ACE3/addons/cargo/functions/fnc_getSizeItem.sqf

39 lines
854 B
Plaintext
Raw Normal View History

2015-08-10 21:07:47 +00:00
/*
* Author: Glowbal
2015-08-16 20:41:35 +00:00
* Get the cargo size of an object.
2015-08-10 21:07:47 +00:00
*
* Arguments:
* 0: Item <OBJECT or STRING>
2015-08-10 21:07:47 +00:00
*
* Return value:
2015-08-16 20:41:35 +00:00
* Cargo size <NUMBER> (default: -1)
*
* Example:
* [object] call ace_cargo_fnc_getSizeItem
2015-08-10 21:07:47 +00:00
*
* Public: No
*/
#include "script_component.hpp"
2015-08-14 16:42:22 +00:00
params ["_item"];
private ["_isVirtual","_itemClass","_config"];
scopeName "return";
_isVirtual = (_item isEqualType "");
_itemClass = if (_isVirtual) then {_item} else {typeOf _item};
_config = (configFile >> "CfgVehicles" >> _itemClass >> QGVAR(size));
2015-08-16 20:41:35 +00:00
if (_isVirtual) then {
if (isNumber _config) then {
(getNumber _config) breakOut "return";
};
} else {
_config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size));
2015-08-16 20:41:35 +00:00
if (isNumber _config) then {
(_item getVariable [QGVAR(size), getNumber _config]) breakOut "return";
};
2015-08-10 21:07:47 +00:00
};
2015-08-16 20:41:35 +00:00
-1