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:
|
2015-09-27 16:19:40 +00:00
|
|
|
* 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"];
|
2015-09-27 16:19:40 +00:00
|
|
|
private ["_isVirtual","_itemClass","_config"];
|
|
|
|
scopeName "return";
|
|
|
|
|
2015-11-20 17:40:31 +00:00
|
|
|
_isVirtual = (_item isEqualType "");
|
2015-09-27 16:19:40 +00:00
|
|
|
_itemClass = if (_isVirtual) then {_item} else {typeOf _item};
|
|
|
|
_config = (configFile >> "CfgVehicles" >> _itemClass >> QGVAR(size));
|
2015-08-16 20:41:35 +00:00
|
|
|
|
2015-09-27 16:19:40 +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
|
|
|
|
2015-09-27 16:19:40 +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
|
|
|
|
2015-08-14 16:07:31 +00:00
|
|
|
-1
|