mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
speed up fnc_getClaimObjects (#8459)
This commit is contained in:
parent
40ec4e9137
commit
82f705b5a1
@ -24,22 +24,17 @@ private _return = [];
|
|||||||
|
|
||||||
{
|
{
|
||||||
private _requiredList = _x; //eg ["ace_track", "ace_track"]
|
private _requiredList = _x; //eg ["ace_track", "ace_track"]
|
||||||
private _ableToAquire = []; //will be array of ojbects
|
private _ableToAquire = []; //will be array of objects
|
||||||
{
|
{
|
||||||
private _nearObjects = nearestObjects [_unit, [_x], _maxRange];
|
private _nearObjects = _unit nearEntities [_x, _maxRange];
|
||||||
private _canClaimObject = objNull;
|
|
||||||
{
|
{
|
||||||
if ((!(_x in _ableToAquire))
|
if (!(_x in _ableToAquire) && {(_x getVariable [QEGVAR(common,owner), objNull]) in [objNull, _unit]}) exitWith { // skip claimed objects
|
||||||
&& {[_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)}
|
_ableToAquire pushBack _x
|
||||||
&&{(damage _x) < 1}
|
};
|
||||||
) exitWith { _canClaimObject = _x; };
|
|
||||||
} forEach _nearObjects;
|
} forEach _nearObjects;
|
||||||
if (isNull _canClaimObject) exitWith {};
|
} forEach _requiredList;
|
||||||
_ableToAquire pushBack _canClaimObject;
|
|
||||||
} forEach _x;
|
|
||||||
TRACE_2("Check required equals available",_requiredList,_ableToAquire);
|
TRACE_2("Check required equals available",_requiredList,_ableToAquire);
|
||||||
if ((count _ableToAquire) == (count _requiredList)) exitWith {_return = _ableToAquire};
|
if ((count _ableToAquire) == (count _requiredList)) exitWith {_return = _ableToAquire};
|
||||||
false
|
} forEach _objectsToClaim;
|
||||||
} count _objectsToClaim;
|
|
||||||
|
|
||||||
_return
|
_return
|
||||||
|
Loading…
Reference in New Issue
Block a user