mirror of
https://github.com/rambo/arma3_missions.git
synced 2024-08-30 16:52:13 +00:00
Use @mija s lzselect code, probably fixes #4
This commit is contained in:
parent
33d53795d3
commit
e12d1702f0
@ -1,45 +1,16 @@
|
|||||||
//diag_log format["selectLZ called, _this: %1", _this];
|
params [["_excludeList", []]];
|
||||||
private _excludeList = _this select 0;
|
|
||||||
private _returnValue = false;
|
|
||||||
|
|
||||||
private _candidates = lzList;
|
private _candidates = lzList;
|
||||||
if (!(_excludeList isEqualTo false)) then
|
|
||||||
{
|
|
||||||
_candidates = _candidates - _excludeList;
|
|
||||||
};
|
|
||||||
private _taskLocations = [];
|
|
||||||
{
|
|
||||||
[_taskLocations, ([_x] call BIS_fnc_taskDestination)] call BIS_fnc_arrayPush;
|
|
||||||
} forEach ([west] call getSideActiveTasks);
|
|
||||||
|
|
||||||
scopeName "main";
|
if (_excludeList isEqualType []) then
|
||||||
private _i = 0;
|
|
||||||
while {true} do
|
|
||||||
{
|
{
|
||||||
scopeName "selectloop";
|
_candidates = _candidates - _excludeList;
|
||||||
private _usable = true;
|
|
||||||
private _candidate = _candidates call BIS_fnc_SelectRandom;
|
|
||||||
{
|
|
||||||
scopeName "checkloop";
|
|
||||||
private _dist = _candidate distance _x;
|
|
||||||
if (_dist < LZMinDistace) then
|
|
||||||
{
|
|
||||||
_usable = false;
|
|
||||||
breakOut "checkloop";
|
|
||||||
};
|
|
||||||
} forEach _taskLocations;
|
|
||||||
if (_usable) then
|
|
||||||
{
|
|
||||||
_returnValue = _candidate;
|
|
||||||
breakOut "selectloop";
|
|
||||||
};
|
|
||||||
_i = _i + 1;
|
|
||||||
if (_i > LZCOUNT) then
|
|
||||||
{
|
|
||||||
_returnValue = false;
|
|
||||||
breakOut "selectloop";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//diag_log format["selectLZ returning: %1", _returnValue];
|
private _taskLocations = [west] call getSideActiveTasks apply { [_x] call BIS_fnc_taskDestination };
|
||||||
_returnValue
|
|
||||||
|
for "_i" from 0 to LZCOUNT do {
|
||||||
|
private _candidate = selectRandom _candidates;
|
||||||
|
if (_taskLocations findIf { _x distance _candidate < LZMinDistace } == -1 && { allPlayers findIf { _x distance _candidate > LZMaxDistace } == -1 }) exitWith { _candidate };
|
||||||
|
false
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user