Advertisement
Faguss

f_in_forest

Jul 1st, 2020
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. comment {
  2. function f_in_forest extracted from DASH library 2.5 by SoldierEPilot
  3. addons\DASH_library.pbo\stringtable.csv
  4. https://www.ofpec.com/forum/index.php?topic=36435.0
  5. };
  6.  
  7. f_in_forest = {
  8. private [{_refpos},{_rad},{_radinc},{_x},{_y},{_z},{_r},{_refobj},{_oa},{_radcnt},{_inc},{_bad},{_dir},{_o},{_dis}];
  9.  
  10. _refpos = _this select 0;
  11. _rad = (_this select 1) + 36;
  12. _radinc = _rad / ((_rad/10) - ((_rad/10)%1));
  13. _X = _refpos select 0;
  14. _Y = _refpos select 1;
  15. _Z = 18;
  16. _r = false;
  17. _refobj = {dash.logic} call localize {f_db_get};
  18. _oA = [];
  19. _radcnt = 0;
  20. _inc = 0;
  21. _bad = {dash.fake_obstacles} call localize {f_db_get};
  22.  
  23. While {_radcnt <= _rad && !_r} Do {
  24. if (_radcnt>0) then {
  25. _inc = 360/((360/Asin(_radinc/_radcnt))-((360/Asin(_radinc/_radcnt))%1))
  26. };
  27.  
  28. _dir=0;
  29.  
  30. While {_dir<360 && !_r} Do {
  31. _o = nearestObject [(_X+(_radcnt*Sin _dir)),(_Y+(_radcnt*Cos _dir)),_Z];
  32.  
  33. if (format[""%1"",_o]!=""<NULL-object>""&&!(_o in _oA)&&!((typeOf _o)in _bad)) then {
  34. _oA = _oA + [_o];
  35. _dis = [getPos _o, _refpos] call localize {f_dist2d};
  36.  
  37. if (_dis<=_rad) then {
  38. _refobj setPos(getPos _o);
  39.  
  40. _dis = _refobj distance _o;
  41. _r = [[[6.8,6.9],[10.9,12.5],[13,1000],[6.18,6.2],[6.5,6.6],[6.95,7],[7.8,7.9],[8.3,8.4],[8.47,8.5],[9.08,10.42]],_dis] call localize {f_in_ranges};
  42. _r = _r || _dis == 2.02113;
  43.  
  44. _refobj setPos[0,0,1000];
  45. };
  46. };
  47.  
  48. if (_inc>0) then {_dir=_dir+_inc} else {_dir=360};
  49. };
  50.  
  51. _radcnt=_radcnt+_radinc;
  52. };
  53.  
  54. _refobj setPos[0,0,0];
  55. _r
  56. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement