ACE3/addons/captives/functions/fnc_doLoadCaptive.sqf

40 lines
1.2 KiB
Plaintext
Raw Normal View History

/*
* Author: commy2
* Unit loads the target object into a vehicle.
2015-02-03 02:04:50 +00:00
*
* Arguments:
* 0: Unit that wants to load a captive <OBJECT>
* 1: A captive. ObjNull for the first escorted captive <OBJECT>
* 2: Vehicle to load the captive into. ObjNull for the nearest vehicle <OBJECT>
*
* Return Value:
* Nothing
2015-02-03 02:04:50 +00:00
*
* Example:
2015-02-06 23:03:56 +00:00
* [bob, tom, car] call ACE_captives_fnc_doLoadCaptive
2015-02-03 02:04:50 +00:00
*
* Public: No
*/
2015-02-03 02:04:50 +00:00
#include "script_component.hpp"
2015-02-04 05:56:51 +00:00
PARAMS_3(_unit,_target,_vehicle);
2015-04-16 17:36:12 +00:00
private "_objects";
if (isNull _target) then {
2015-02-04 05:13:44 +00:00
_objects = attachedObjects _unit;
2015-02-05 22:39:45 +00:00
_objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);
if ((count _objects) > 0) then {_target = _objects select 0;};
};
2015-02-05 22:39:45 +00:00
if (isNull _target) exitWith {};
if (isNull _vehicle) then {
2015-02-04 05:13:44 +00:00
_objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10];
2015-02-05 22:39:45 +00:00
if ((count _objects) > 0) then {_vehicle = _objects select 0;};
};
2015-02-05 22:39:45 +00:00
if (isNull _vehicle) exitWith {};
2015-02-04 05:13:44 +00:00
if ((!isNil "_target") && {!isNil "_vehicle"}) then {
2015-02-04 19:16:19 +00:00
_unit setVariable [QGVAR(isEscorting), false, true];
2015-02-04 05:56:51 +00:00
["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent);
};