2015-08-10 21:07:47 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
2016-11-12 23:52:17 +00:00
|
|
|
* Get nearest vehicle from unit that is not excluded, priority: Car-Air-Tank-Ship.
|
2015-08-10 21:07:47 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-16 20:41:35 +00:00
|
|
|
* 0: Unit <OBJECT>
|
2016-11-12 23:52:17 +00:00
|
|
|
* 1: Object to exclude <OBJECT>
|
2015-08-10 21:07:47 +00:00
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2015-08-16 20:41:35 +00:00
|
|
|
* Vehicle in Distance <OBJECT>
|
|
|
|
*
|
|
|
|
* Example:
|
2016-11-12 23:52:17 +00:00
|
|
|
* [unit, object] call ace_cargo_fnc_findNearestVehicle
|
2015-08-10 21:07:47 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2016-11-12 23:52:17 +00:00
|
|
|
params ["_unit","_object"];
|
2015-08-10 21:07:47 +00:00
|
|
|
|
2016-11-12 23:52:17 +00:00
|
|
|
private _loadCar = nearestObjects [_unit, ["car"], MAX_LOAD_DISTANCE];
|
|
|
|
_loadCar deleteAt (_loadCar find _object);
|
|
|
|
if !(_loadCar isEqualTo []) exitWith {_loadCar select 0};
|
2015-08-10 21:07:47 +00:00
|
|
|
|
2016-11-12 23:52:17 +00:00
|
|
|
private _loadHelicopter = nearestObjects [_unit, ["air"], MAX_LOAD_DISTANCE];
|
|
|
|
_loadHelicopter deleteAt (_loadHelicopter find _object);
|
|
|
|
if !(_loadHelicopter isEqualTo []) exitWith {_loadHelicopter select 0};
|
2015-08-10 21:07:47 +00:00
|
|
|
|
2016-11-12 23:52:17 +00:00
|
|
|
private _loadTank = nearestObjects [_unit, ["tank"], MAX_LOAD_DISTANCE];
|
|
|
|
_loadTank deleteAt (_loadTank find _object);
|
|
|
|
if !(_loadTank isEqualTo []) exitWith {_loadTank select 0};
|
2015-08-10 21:07:47 +00:00
|
|
|
|
2016-11-12 23:52:17 +00:00
|
|
|
private _loadShip = nearestObjects [_unit, ["ship"], MAX_LOAD_DISTANCE];
|
|
|
|
_loadShip deleteAt (_loadShip find _object);;
|
|
|
|
if !(_loadShip isEqualTo []) exitWith {_loadShip select 0};
|
2015-08-10 21:07:47 +00:00
|
|
|
|
2016-11-12 23:52:17 +00:00
|
|
|
private _loadContainer = nearestObjects [_unit, ["Cargo_base_F"], MAX_LOAD_DISTANCE];
|
|
|
|
_loadContainer deleteAt (_loadContainer find _object);
|
|
|
|
if !(_loadContainer isEqualTo []) exitWith {_loadContainer select 0};
|
2015-08-14 20:01:14 +00:00
|
|
|
|
2015-08-16 20:48:52 +00:00
|
|
|
objNull
|