2015-02-03 02:04:50 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Check if the unit can load the target object into a vehicle.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit that wants to load a captive <OBJECT>
|
2015-02-06 09:38:27 +00:00
|
|
|
* 1: A captive. ObjNull for the first escorted captive (may be null) <OBJECT>
|
|
|
|
* 2: Vehicle to load the captive into. ObjNull for the nearest vehicle (may be null) <OBJECT>
|
2015-02-03 02:04:50 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* The return value <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
2015-02-06 23:03:56 +00:00
|
|
|
* [player, bob] call ACE_captives_fnc_canLoadCaptive
|
2015-02-03 02:04:50 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
private ["_objects"];
|
2015-08-04 23:15:20 +00:00
|
|
|
params ["_unit", "_target","_vehicle"];
|
2015-02-03 02:04:50 +00:00
|
|
|
|
|
|
|
if (isNull _target) then {
|
|
|
|
_objects = attachedObjects _unit;
|
2015-02-05 22:39:45 +00:00
|
|
|
_objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);
|
2015-02-06 09:38:27 +00:00
|
|
|
if ((count _objects) > 0) then {_target = _objects select 0;};
|
2015-02-03 02:04:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (isNull _vehicle) then {
|
2015-08-13 04:32:57 +00:00
|
|
|
_objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10];
|
2015-02-06 09:38:27 +00:00
|
|
|
if ((count _objects) > 0) then {_vehicle = _objects select 0;};
|
2015-02-03 02:04:50 +00:00
|
|
|
};
|
|
|
|
|
2015-02-06 09:38:27 +00:00
|
|
|
(!isNull _target)
|
|
|
|
&& {!isNull _vehicle}
|
|
|
|
&& {_unit getVariable [QGVAR(isEscorting), false]}
|
|
|
|
&& {_target getVariable [QGVAR(isHandcuffed), false]}
|
2015-08-15 02:29:01 +00:00
|
|
|
&& {([_vehicle] call FUNC(findEmptyNonFFVCargoSeat)) != -1}
|