2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-08-10 21:07:47 +00:00
|
|
|
/*
|
2017-05-31 22:54:57 +00:00
|
|
|
* Author: Glowbal, SilentSpike
|
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
|
|
|
*
|
2016-06-18 09:50:41 +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
|
|
|
|
*/
|
|
|
|
|
2015-08-14 16:42:22 +00:00
|
|
|
params ["_item"];
|
2016-01-19 03:53:48 +00:00
|
|
|
|
2017-05-31 22:54:57 +00:00
|
|
|
// Virtual items are much easier to deal with
|
|
|
|
if (_item isEqualType "") then {
|
|
|
|
CARGO_SIZE(_item)
|
2015-09-27 16:19:40 +00:00
|
|
|
} else {
|
2017-05-31 22:54:57 +00:00
|
|
|
if (isNil {_item getVariable QGVAR(size)}) then {
|
|
|
|
CARGO_SIZE(typeOf _item)
|
|
|
|
} else {
|
|
|
|
_item getVariable QGVAR(size)
|
2015-09-27 16:19:40 +00:00
|
|
|
};
|
2015-08-10 21:07:47 +00:00
|
|
|
};
|