mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
c4ed18f39f
Fix that findNearestVehicle dont return any time the nearest car Small Performance Improvement in getSizeItem/handleDestroyed/startUnload Enhance Some legibility
32 lines
806 B
Plaintext
32 lines
806 B
Plaintext
/*
|
|
* Author: Glowbal
|
|
* Get nearest vehicle, priority car, air, tank, ship
|
|
*
|
|
* Arguments:
|
|
* 0: Object <OBJECT>
|
|
*
|
|
* Return value:
|
|
* Vehicle that is in Distance <OBJECT>
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
private ["_loadCar", "_loadHelicopter", "_loadTank", "_loadShip"];
|
|
params ["_unit"];
|
|
|
|
_loadCar = nearestObject [_unit, "car"];
|
|
if (_unit distance _vehicle <= MAX_LOAD_DISTANCE) exitwith {_vehicle};
|
|
|
|
_loadHelicopter = nearestObject [_unit, "air"];
|
|
if (_unit distance _loadHelicopter <= MAX_LOAD_DISTANCE) exitwith {_loadHelicopter};
|
|
|
|
_loadTank = nearestObject [_unit, "tank"];
|
|
if (_unit distance _loadTank <= MAX_LOAD_DISTANCE) exitwith {_loadTank};
|
|
|
|
_loadShip = nearestObject [_unit, "ship"];
|
|
if (_unit distance _loadShip <= MAX_LOAD_DISTANCE) exitwith {_loadShip};
|
|
|
|
objNull;
|