mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix cargo find nearest vehicle (#4592)
* Inital Commit * read function call change added object to exclude to function call * Removed TODO comment
This commit is contained in:
@ -21,7 +21,7 @@ TRACE_2("params",_player,_object);
|
|||||||
|
|
||||||
if (!([_player, _object, []] call EFUNC(common,canInteractWith))) exitWith {false};
|
if (!([_player, _object, []] call EFUNC(common,canInteractWith))) exitWith {false};
|
||||||
|
|
||||||
private _nearestVehicle = [_player] call FUNC(findNearestVehicle);
|
private _nearestVehicle = [_player, _object] call FUNC(findNearestVehicle);
|
||||||
|
|
||||||
if (_nearestVehicle isKindOf "Cargo_Base_F" || isNull _nearestVehicle) then {
|
if (_nearestVehicle isKindOf "Cargo_Base_F" || isNull _nearestVehicle) then {
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,11 @@ params [["_item", "", [objNull,""]], "_vehicle"];
|
|||||||
|
|
||||||
if (speed _vehicle > 1 || {((getPos _vehicle) select 2) > 3}) exitWith {TRACE_1("vehicle not stable",_vehicle); false};
|
if (speed _vehicle > 1 || {((getPos _vehicle) select 2) > 3}) exitWith {TRACE_1("vehicle not stable",_vehicle); false};
|
||||||
|
|
||||||
|
if (_item isEqualType objNull && {{alive _x && {getText (configFile >> "CfgVehicles" >> typeOf _x >> "simulation") != "UAVPilot"}} count crew _item > 0}) exitWith {
|
||||||
|
TRACE_1("item is occupied",_item);
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
private _itemSize = [_item] call FUNC(getSizeItem);
|
private _itemSize = [_item] call FUNC(getSizeItem);
|
||||||
private _validItem = false;
|
private _validItem = false;
|
||||||
if (_item isEqualType "") then {
|
if (_item isEqualType "") then {
|
||||||
|
@ -1,35 +1,41 @@
|
|||||||
/*
|
/*
|
||||||
* Author: Glowbal
|
* Author: Glowbal
|
||||||
* Get nearest vehicle from unit, priority: Car-Air-Tank-Ship.
|
* Get nearest vehicle from unit that is not excluded, priority: Car-Air-Tank-Ship.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
|
* 1: Object to exclude <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Vehicle in Distance <OBJECT>
|
* Vehicle in Distance <OBJECT>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [unit] call ace_cargo_fnc_findNearestVehicle
|
* [unit, object] call ace_cargo_fnc_findNearestVehicle
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit"];
|
params ["_unit","_object"];
|
||||||
|
|
||||||
private _loadCar = nearestObject [_unit, "car"];
|
private _loadCar = nearestObjects [_unit, ["car"], MAX_LOAD_DISTANCE];
|
||||||
if (_unit distance _loadCar <= MAX_LOAD_DISTANCE) exitWith {_loadCar};
|
_loadCar deleteAt (_loadCar find _object);
|
||||||
|
if !(_loadCar isEqualTo []) exitWith {_loadCar select 0};
|
||||||
|
|
||||||
private _loadHelicopter = nearestObject [_unit, "air"];
|
private _loadHelicopter = nearestObjects [_unit, ["air"], MAX_LOAD_DISTANCE];
|
||||||
if (_unit distance _loadHelicopter <= MAX_LOAD_DISTANCE) exitWith {_loadHelicopter};
|
_loadHelicopter deleteAt (_loadHelicopter find _object);
|
||||||
|
if !(_loadHelicopter isEqualTo []) exitWith {_loadHelicopter select 0};
|
||||||
|
|
||||||
private _loadTank = nearestObject [_unit, "tank"];
|
private _loadTank = nearestObjects [_unit, ["tank"], MAX_LOAD_DISTANCE];
|
||||||
if (_unit distance _loadTank <= MAX_LOAD_DISTANCE) exitWith {_loadTank};
|
_loadTank deleteAt (_loadTank find _object);
|
||||||
|
if !(_loadTank isEqualTo []) exitWith {_loadTank select 0};
|
||||||
|
|
||||||
private _loadShip = nearestObject [_unit, "ship"];
|
private _loadShip = nearestObjects [_unit, ["ship"], MAX_LOAD_DISTANCE];
|
||||||
if (_unit distance _loadShip <= MAX_LOAD_DISTANCE) exitWith {_loadShip};
|
_loadShip deleteAt (_loadShip find _object);;
|
||||||
|
if !(_loadShip isEqualTo []) exitWith {_loadShip select 0};
|
||||||
|
|
||||||
private _loadContainer = nearestObject [_unit,"Cargo_base_F"];
|
private _loadContainer = nearestObjects [_unit, ["Cargo_base_F"], MAX_LOAD_DISTANCE];
|
||||||
if (_unit distance _loadContainer <= MAX_LOAD_DISTANCE) exitWith {_loadContainer};
|
_loadContainer deleteAt (_loadContainer find _object);
|
||||||
|
if !(_loadContainer isEqualTo []) exitWith {_loadContainer select 0};
|
||||||
|
|
||||||
objNull
|
objNull
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
params ["_player", "_object"];
|
params ["_player", "_object"];
|
||||||
TRACE_2("params",_player,_object);
|
TRACE_2("params",_player,_object);
|
||||||
|
|
||||||
private _vehicle = [_player] call FUNC(findNearestVehicle);
|
private _vehicle = [_player, _object] call FUNC(findNearestVehicle);
|
||||||
|
|
||||||
if ((isNull _vehicle) || {_vehicle isKindOf "Cargo_Base_F"}) then {
|
if ((isNull _vehicle) || {_vehicle isKindOf "Cargo_Base_F"}) then {
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user