Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Pos_fnc7.sqf
- * Author: Dimon UA
- *
- Description:
- The function of the search positions with a variety of additional conditions
- *
- Example:
- arx=[arrays,[4, 50, 60], [["Static"],20]] call POS_FNC7;
- * _onroad:
- [0,objNull,objNull] - дороги не должно быть
- [1,objNull,objNull] - все равно
- [2,objNull,objNull] - только на дороге
- [3,20,objNull] - дороги не должно быть, но в пределах радиус от дороги
- [4,20,objNull] - дорога должна быть или допустимый радиус от дороги.
- [5,20,60] - дороги не должно быть и мин радиус от дороги где не должно быть, + радиус от дороги где можно разместить
- [6,40,objNull] - дороги не должно быть и радиус от дороги где не должно быть
- Returns:
- Array - format PositionATL
- */
- #define cn !(isOnRoad _testPos)
- #define ucn (isOnRoad _testPos)
- #define tn (count (_testPos nearRoads _xr) == 0)
- #define utn (count (_testPos nearRoads _xr) > 0)
- #define uctn (count (_testPos nearRoads _xrm) > 0)
- #define mn (count (nearestObjects [ _testPos , _neartype, _xdistance]) == 0)
- #define sw (surfaceIsWater _testPos)
- private["_ar","_onroad","_xr","_xrm","_neartype","_xdistance","_newPos","_testPos","_arx","_debug","_i"];
- _ar = _this select 0; //arrays
- _onroad=((_this select 1) select 0);
- _xr=((_this select 1) select 1); // 1 радиус в котором ищется наличие дороги.
- _xrm=((_this select 1) select 2);
- _neartype=((_this select 2) select 0); // массив обьектов возле которых при заданной дистанции от обьекта нельзя ставить обьект.
- _xdistance=((_this select 2) select 1); // дистанция до обьектов возле которых нельзя ставить нужный нам обьект(ы).
- _debug =false;// debug
- _arx = [];
- for "_i" from 0 to (count _ar) -1 do
- {
- _testPos = ASLToATL (_ar select _i);
- call
- {
- if ((_onroad == 1) && {mn}) exitwith
- {
- _newPos = _testPos;
- _arx set [count _arx,_newPos];
- };
- if ( (_onroad == 0) && {cn} && {tn} && {mn}) exitwith
- {
- _newPos = _testPos;
- _arx set [count _arx,_newPos];
- };
- if ( (_onroad == 2) && {ucn} && {mn}) exitwith
- {
- _newPos = _testPos;
- _arx set [count _arx,_newPos];
- };
- if ( (_onroad == 3) && {cn} && {utn} && {mn}) exitwith
- {
- _newPos = _testPos;
- _arx set [count _arx,_newPos];
- };
- if ( (_onroad == 4) && {( ucn || {utn})} && {mn}) exitwith
- {
- _newPos = _testPos;
- _arx set [count _arx,_newPos];
- };
- if ( (_onroad == 5) && {cn} && {tn} && {uctn} && {mn}) exitwith
- {
- _newPos = _testPos;
- _arx set [count _arx,_newPos];
- };
- if ( (_onroad == 6) && {cn} && {tn} && {mn}) exitwith
- {
- _newPos = _testPos;
- _arx set [count _arx,_newPos];
- };
- };
- };
- if _debug then
- {
- {
- call compile format ["
- _m%1 = createMarker[""markerblack%1"",[ _x select 0,_x select 1]];
- _m%1 setMarkerShape ""ICON"";
- _m%1 setMarkerType ""DOT"";
- _m%1 setmarkercolor ""Colorblack""; ",_forEachIndex];
- } foreach _arx;
- };
- _arx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement