Skip to content

Commit

Permalink
[UPDATE] Handle case where site marker discovery job is on/off.
Browse files Browse the repository at this point in the history
  • Loading branch information
dijksterhuis committed Apr 26, 2023
1 parent e82f42e commit f0b67ca
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ private _radioPos = getPos _radioObj;
private _sitesArr = missionNamespace getVariable ["sites",[]];
private _sitesUndiscoveredArr = _sitesArr select {!(_x getVariable ["discovered", false])};

// randomised number of sites to reveal on map to make life interesting
private _nSitesToReveal = (selectRandom [2, 1]);

/*
nested arrays of [site distance from radio, site object]
sorted by ascending distance
Expand All @@ -36,7 +33,12 @@ then resize to the random N sites to reveal
*/
private _sitesDistanceSortedAscArr = _sitesUndiscoveredArr apply {[_x distance2d _radioPos, _x]};
_sitesDistanceSortedAscArr sort true;
_sitesDistanceSortedAscArr deleteAt 0;

// randomised number of sites to reveal on map to make life interesting
// this is set to two or three to cover the case where
// - the marker discovery system is disabled (BN MF#1 and MF#2) -- reveals current + 1 or 2 others
// - the marker discovery system is enabled (others) -- reveals 2 or 3 others
private _nSitesToReveal = (selectRandom [2, 3]);

// we can end up trying to select too many and ending up with null values
if (_nSitesToReveal > count _sitesDistanceSortedAscArr) then {
Expand All @@ -48,7 +50,6 @@ _sitesDistanceSortedAscArr resize _nSitesToReveal;
// no need for messy forEach loops or multiple searches
// as we can do one apply call
_sitesDistanceSortedAscArr apply {
// private _candidateSiteDistance = _x # 0;
private _candidateSiteObj = _x # 1;
private _markersArr = _candidateSiteObj getVariable ["markers", []];
_markersArr apply {_x setMarkerAlpha 0.5};
Expand Down

0 comments on commit f0b67ca

Please sign in to comment.