mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
742626ff1a
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
32 lines
977 B
Plaintext
32 lines
977 B
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: commy2
|
|
* Check if a unit can attach a specific item.
|
|
*
|
|
* Arguments:
|
|
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
|
|
* 1: unit doing the attach (player) <OBJECT>
|
|
* 2: Array empty or containing a string of the attachable item <ARRAY>
|
|
*
|
|
* Return Value:
|
|
* Can Attach <BOOL>
|
|
*
|
|
* Example:
|
|
* [bob, bob, ["light"]] call ace_attach_fnc_canAttach;
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_attachToVehicle","_player","_args"];
|
|
_args params [["_itemClassname","", [""]]];
|
|
TRACE_3("params",_attachToVehicle,_player,_itemClassname);
|
|
|
|
private _attachLimit = [6, 1] select (_player == _attachToVehicle);
|
|
private _attachedObjects = _attachToVehicle getVariable [QGVAR(attached), []];
|
|
|
|
((_player == _attachToVehicle) || {canStand _player}) &&
|
|
{(_attachToVehicle distance _player) < 10} &&
|
|
{alive _attachToVehicle} &&
|
|
{(count _attachedObjects) < _attachLimit} &&
|
|
{_itemClassname in ((itemsWithMagazines _player) + [""])};
|