diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/ied/initArea.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/ied/initArea.sqf index 86012caec..d73f25a2a 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/ied/initArea.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/ied/initArea.sqf @@ -31,19 +31,38 @@ params [ private _pos = getPos _city; private _array = _city getVariable ["ieds", []]; +private _cities = (values btc_city_all) - [_city]; +_cities = _cities inAreaArray [_city, _area * 2, _area * 2]; +private _blackListCities = _cities select { + _x getVariable ["ieds", []] isNotEqualTo [] +}; +private _blackListPos = []; +{ + _blackListPos append ((_x getVariable "ieds") apply {_x select 0}); +} forEach _blackListCities; +_blackListPos = _blackListPos inAreaArray [_city, _area, _area]; + +private _blackListRoads = []; { for "_i" from 1 to _n do { private _sel_pos = [_pos, _area] call btc_fnc_randomize_pos; private _dir = random 360; private _roads = _sel_pos nearRoads 50; - if (_roads isEqualTo []) then { - _sel_pos = [_sel_pos, 0, 100, 1, false] call btc_fnc_findsafepos; - } else { - private _arr = (selectRandom _roads) call btc_ied_fnc_randomRoadPos; + _roads = _roads - _blackListRoads; + if (_roads isNotEqualTo []) then { + private _road = selectRandom _roads; + _blackListRoads pushBack _road; + private _arr = _road call btc_ied_fnc_randomRoadPos; _sel_pos = _arr select 0; _dir = _arr select 1; }; + if ( + _roads isEqualTo [] || + {_blackListPos inAreaArray [_sel_pos, 3, 3] isNotEqualTo []} + ) then { + _sel_pos = [_sel_pos, 0, 100, 1, false] call btc_fnc_findsafepos; + }; _array pushBack [_sel_pos, selectRandom btc_model_ieds, _dir, _x];