ACE3/addons/attach/functions/fnc_canAttach.sqf

28 lines
715 B
Plaintext
Raw Normal View History

2015-01-11 20:39:49 +00:00
/*
* Author: commy2
* Check if a unit can attach a specific item.
2015-02-01 20:56:19 +00:00
*
* Arguments:
* 0: unit doing the attach (player) <OBJECT>
* 1: vehicle that it will be attached to (player or vehicle) <OBJECT>
* 2: Name of the attachable item <STRING>
*
* Return Value:
* Boolean <BOOL>
*
* Example:
* Nothing
*
* Public: No
2015-01-11 20:39:49 +00:00
*/
2015-02-01 20:56:19 +00:00
#include "script_component.hpp"
2015-01-11 20:39:49 +00:00
PARAMS_3(_unit,_attachToVehicle,_item);
2015-01-11 20:39:49 +00:00
2015-02-15 14:31:09 +00:00
private ["_attachLimit", "_attachedObjects"];
2015-01-11 20:39:49 +00:00
2015-02-15 14:31:09 +00:00
_attachLimit = [10, 1] select (_unit == _attachToVehicle);
_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []];
canStand _unit && {alive _attachToVehicle} && {count _attachedObjects < _attachLimit} && {_item in (itemsWithMagazines _unit + [""])}