ACE3/addons/cargo/functions/fnc_findNearestVehicle.sqf

32 lines
722 B
Plaintext
Raw Normal View History

2015-08-10 21:07:47 +00:00
/*
* Author: Glowbal
* Get nearest vehicle, priority car, air, tank, ship
*
* Arguments:
* 0: Object <OBJECT>
*
* Return value:
* Can load <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
private ["_vehicle"];
params ["_unit"];
_vehicle = nearestObject [_unit, "car"];
if (_unit distance _vehicle <= MAX_LOAD_DISTANCE) exitwith {_vehicle};
_loadhelicopter = nearestObject [_unit, "air"];
if (_unit distance _vehicle <= MAX_LOAD_DISTANCE) exitwith {_vehicle};
_loadtank = nearestObject [_unit, "tank"];
if (_unit distance _vehicle <= MAX_LOAD_DISTANCE) exitwith {_vehicle};
_loadtank = nearestObject [_unit, "ship"];
if (_unit distance _vehicle <= MAX_LOAD_DISTANCE) exitwith {_vehicle};
objNull;