Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- comment {
- function EXT_fnc_inForest extracted from WW4_EXT by Kenoxite
- WW4_EXT\addons\ww4ext_scripts.pbo\lib\terrain.sqf
- https://forums.bohemia.net/forums/topic/145818-ww4-extended-unofficial-expansion-for-ww4-25/
- };
- comment{
- IN FOREST
- Returns if the location is inside a forest.
- Result in forest corners, borders and between forest tiles is unreliable.
- Uses measurements of vanilla forests done by Rellikki.
- Parameters:
- - Required:
- * _p: position
- - Optional:
- * _v: check for vanilla forests only. If false, glades will also be detected. Default is true
- * _r: radius. Default is 20
- * _s: step. Default is 5
- };
- EXT_fnc_inForest = {
- private ["_p","_f","_ss","_z","_nO","_r","_x","_y","_i","_d","_v","_s"];
- _p=_this select 0;
- _v=if(count _this > 1)then{_this select 1}else{true};
- _r=if(count _this > 2)then{_this select 2}else{20};
- _s=if(count _this > 3)then{_this select 3}else{5};
- _x=_p select 0;
- _y=_p select 1;
- _f=false;
- _i=_s;
- while {_i<_r && !_f} do {
- _d=0;
- while {_d<360 && !_f} do {
- _nO=nearestObject [_x+_i *sin(_d),_y+_i *cos(_d)];
- _z=getPos _nO select 2;
- _ss="logic" camcreate [_x,_y,0];
- if((_nO distance _ss)<=40)then{if(_v)then{if((_z >= 18.0418 && _z <= 23.1900) || (_z >= 25.8946 && _z <= 28.5844) || (_z >= 23.4063 && _z <= 24.344) || (_z >= 11.6016 && _z <= 12.7339))then{_f=true}}else{if(_z>12)then{_f=true}}};
- camdestroy _ss;
- _d=_d+30;
- };
- _i=_i+_s;
- };
- _f
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement