Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. /*
  2. * Pos_fnc7.sqf
  3.  
  4. * Author: Dimon UA
  5.  
  6. *
  7. Description:
  8. The function of the search positions with a variety of additional conditions
  9.  
  10. *
  11. Example:
  12. arx=[arrays,[4, 50, 60], [["Static"],20]] call POS_FNC7;
  13.  
  14.  
  15. * _onroad:
  16. [0,objNull,objNull] - дороги не должно быть
  17. [1,objNull,objNull] - все равно
  18. [2,objNull,objNull] - только на дороге
  19. [3,20,objNull] - дороги не должно быть, но в пределах радиус от дороги
  20. [4,20,objNull] - дорога должна быть или допустимый радиус от дороги.
  21. [5,20,60] - дороги не должно быть и мин радиус от дороги где не должно быть, + радиус от дороги где можно разместить
  22. [6,40,objNull] - дороги не должно быть и радиус от дороги где не должно быть
  23.  
  24. Returns:
  25. Array - format PositionATL
  26. */
  27.  
  28. #define cn !(isOnRoad _testPos)
  29. #define ucn (isOnRoad _testPos)
  30. #define tn (count (_testPos nearRoads _xr) == 0)
  31. #define utn (count (_testPos nearRoads _xr) > 0)
  32. #define uctn (count (_testPos nearRoads _xrm) > 0)
  33. #define mn (count (nearestObjects [ _testPos , _neartype, _xdistance]) == 0)
  34. #define sw (surfaceIsWater _testPos)
  35.  
  36. private["_ar","_onroad","_xr","_xrm","_neartype","_xdistance","_newPos","_testPos","_arx","_debug","_i"];
  37.  
  38. _ar = _this select 0; //arrays
  39. _onroad=((_this select 1) select 0);
  40. _xr=((_this select 1) select 1); // 1 радиус в котором ищется наличие дороги.
  41. _xrm=((_this select 1) select 2);
  42. _neartype=((_this select 2) select 0); // массив обьектов возле которых при заданной дистанции от обьекта нельзя ставить обьект.
  43. _xdistance=((_this select 2) select 1); // дистанция до обьектов возле которых нельзя ставить нужный нам обьект(ы).
  44. _debug =false;// debug
  45.  
  46. _arx = [];
  47. for "_i" from 0 to (count _ar) -1 do
  48. {
  49. _testPos = ASLToATL (_ar select _i);
  50. call
  51. {
  52. if ((_onroad == 1) && {mn}) exitwith
  53. {
  54. _newPos = _testPos;
  55. _arx set [count _arx,_newPos];
  56. };
  57. if ( (_onroad == 0) && {cn} && {tn} && {mn}) exitwith
  58. {
  59. _newPos = _testPos;
  60. _arx set [count _arx,_newPos];
  61. };
  62. if ( (_onroad == 2) && {ucn} && {mn}) exitwith
  63. {
  64. _newPos = _testPos;
  65. _arx set [count _arx,_newPos];
  66. };
  67. if ( (_onroad == 3) && {cn} && {utn} && {mn}) exitwith
  68. {
  69. _newPos = _testPos;
  70. _arx set [count _arx,_newPos];
  71. };
  72. if ( (_onroad == 4) && {( ucn || {utn})} && {mn}) exitwith
  73. {
  74. _newPos = _testPos;
  75. _arx set [count _arx,_newPos];
  76. };
  77. if ( (_onroad == 5) && {cn} && {tn} && {uctn} && {mn}) exitwith
  78. {
  79. _newPos = _testPos;
  80. _arx set [count _arx,_newPos];
  81. };
  82. if ( (_onroad == 6) && {cn} && {tn} && {mn}) exitwith
  83. {
  84. _newPos = _testPos;
  85. _arx set [count _arx,_newPos];
  86. };
  87. };
  88. };
  89. if _debug then
  90. {
  91. {
  92. call compile format ["
  93. _m%1 = createMarker[""markerblack%1"",[ _x select 0,_x select 1]];
  94. _m%1 setMarkerShape ""ICON"";
  95. _m%1 setMarkerType ""DOT"";
  96. _m%1 setmarkercolor ""Colorblack""; ",_forEachIndex];
  97. } foreach _arx;
  98. };
  99. _arx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement