ACE3/addons/repair/functions/fnc_hasItems.sqf

35 lines
703 B
Plaintext
Raw Normal View History

/*
* Author: Glowbal
* Check if the engineer has all items.
*
* Arguments:
* 0: Unit that does the repairing <OBJECT>
* 1: Items required <ARRAY>
*
* Return Value:
* Has Items <BOOL>
*
* Example:
* [engineer, [items]] call ace_repair_fnc_hasItems
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_items"];
TRACE_2("params",_unit,_items);
2015-08-09 06:54:44 +00:00
private ["_return"];
_return = true;
{
if (typeName _x == "ARRAY" && {({[_unit, _x] call EFUNC(common,hasItem)} count _x == 0)}) exitwith {
_return = false;
};
if (typeName _x == "STRING" && {!([_unit, _x] call EFUNC(common,hasItem))}) exitwith {
_return = false;
};
2015-08-09 06:54:44 +00:00
} forEach _items;
_return;