2015-09-21 11:08:10 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Count magazines of unit.
|
2015-01-16 23:21:47 +00:00
|
|
|
*
|
2015-09-21 11:08:10 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Magazine <STRING>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Magazine amount <NUMBER>
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-21 11:08:10 +00:00
|
|
|
params ["_unit", "_magazine"];
|
2015-05-14 22:12:40 +00:00
|
|
|
|
2015-09-21 11:08:10 +00:00
|
|
|
private "_return";
|
2015-01-16 23:21:47 +00:00
|
|
|
_return = 0;
|
2015-09-21 11:08:10 +00:00
|
|
|
|
2015-01-16 23:21:47 +00:00
|
|
|
if (_unit isKindOf "CAManBase") then {
|
2015-01-18 19:09:19 +00:00
|
|
|
_return = {_x == _magazine} count magazines _unit;
|
2015-01-16 23:21:47 +00:00
|
|
|
} else {
|
2015-01-18 19:09:19 +00:00
|
|
|
{
|
|
|
|
_return = _return + {_x == _magazine} count magazines _x;
|
2015-09-21 11:08:10 +00:00
|
|
|
false
|
|
|
|
} count crew _unit;
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2015-01-18 19:09:19 +00:00
|
|
|
_return = _return + ({_x == _magazine} count getMagazineCargo _unit);
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
|
|
|
|
2015-05-14 22:12:40 +00:00
|
|
|
_return
|