Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: IED overlap sometimes #1657

Merged
merged 4 commits into from
Oct 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/ied/initArea.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
Loading