mirror of
https://github.com/Teh-Dango/Sarge-AI.git
synced 2024-08-30 16:32:11 +00:00
c5e98f17e6
Epoch Update
19 lines
405 B
Plaintext
19 lines
405 B
Plaintext
// Return the closest position from array to the positionA.
|
|
// In: [positionA,[array of positions]]
|
|
// Out: positionB
|
|
private ["_pA","_ps","_p1","_p2"];
|
|
_pA = _this select 0;
|
|
_ps = _this select 1;
|
|
|
|
_p1 = _ps select 0;
|
|
|
|
if (count _ps > 1) then {
|
|
for "_i" from 1 to (count _ps - 1) do {
|
|
_p2 = _ps select _i;
|
|
if ((_p2 distance _pA) < (_p1 distance _pA)) then {
|
|
_p1 = _p2;
|
|
};
|
|
};
|
|
};
|
|
|
|
_p1 |