2015-08-10 21:07:47 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Get nearest vehicle, priority car, air, tank, ship
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Object <OBJECT>
|
|
|
|
*
|
|
|
|
* Return value:
|
2015-08-14 16:07:31 +00:00
|
|
|
* Vehicle that is in Distance <OBJECT>
|
2015-08-10 21:07:47 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-14 20:01:14 +00:00
|
|
|
private ["_loadCar", "_loadHelicopter", "_loadTank", "_loadShip", "_loadContainer"];
|
2015-08-10 21:07:47 +00:00
|
|
|
params ["_unit"];
|
|
|
|
|
2015-08-14 16:07:31 +00:00
|
|
|
_loadCar = nearestObject [_unit, "car"];
|
2015-08-14 20:00:55 +00:00
|
|
|
if (_unit distance _loadCar <= MAX_LOAD_DISTANCE) exitwith {_loadCar};
|
2015-08-10 21:07:47 +00:00
|
|
|
|
2015-08-14 16:07:31 +00:00
|
|
|
_loadHelicopter = nearestObject [_unit, "air"];
|
|
|
|
if (_unit distance _loadHelicopter <= MAX_LOAD_DISTANCE) exitwith {_loadHelicopter};
|
2015-08-10 21:07:47 +00:00
|
|
|
|
2015-08-14 16:07:31 +00:00
|
|
|
_loadTank = nearestObject [_unit, "tank"];
|
|
|
|
if (_unit distance _loadTank <= MAX_LOAD_DISTANCE) exitwith {_loadTank};
|
2015-08-10 21:07:47 +00:00
|
|
|
|
2015-08-14 16:07:31 +00:00
|
|
|
_loadShip = nearestObject [_unit, "ship"];
|
|
|
|
if (_unit distance _loadShip <= MAX_LOAD_DISTANCE) exitwith {_loadShip};
|
2015-08-10 21:07:47 +00:00
|
|
|
|
2015-08-14 20:01:14 +00:00
|
|
|
_loadContainer = nearestObject [_unit,"Cargo_base_F"];
|
|
|
|
if (_unit distance _loadContainer <= MAX_LOAD_DISTANCE) exitwith {_loadContainer};
|
|
|
|
|
2015-08-10 21:07:47 +00:00
|
|
|
objNull;
|