diff options
| author | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:53:22 +0300 |
|---|---|---|
| committer | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:53:22 +0300 |
| commit | c055d44dcdb87e8db49fb23e632fc086aa44cce6 (patch) | |
| tree | 7ac98d865915930bebc86b36b512a859c31538e5 /Common/Functions/Common_GetSafePlace.sqf | |
| download | a2wf_zargabad-c055d44dcdb87e8db49fb23e632fc086aa44cce6.tar.gz a2wf_zargabad-c055d44dcdb87e8db49fb23e632fc086aa44cce6.tar.bz2 a2wf_zargabad-c055d44dcdb87e8db49fb23e632fc086aa44cce6.zip | |
init
Diffstat (limited to '')
| -rw-r--r-- | Common/Functions/Common_GetSafePlace.sqf | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Common/Functions/Common_GetSafePlace.sqf b/Common/Functions/Common_GetSafePlace.sqf new file mode 100644 index 0000000..fe0024c --- /dev/null +++ b/Common/Functions/Common_GetSafePlace.sqf @@ -0,0 +1,27 @@ +Private["_count","_currentPosition","_direction","_obstacles","_placed","_position","_radius","_retPos","_vehicles"];
+scopeName "PlaceSafe";
+
+_position = _this select 0;
+_radius = if (count _this > 1) then {_this select 1} else {35};
+_retPos = [];
+
+_currentPosition = _position;
+_placed = false;
+_direction = 0;
+
+for [{_count = 0},{_count < 30 && !_placed},{_count = _count + 1}] do {
+ _obstacles = nearestObjects [_currentPosition, ["Building"], 15];
+ _vehicles = _currentPosition nearEntities [["Building","Car","Tank","Air"], 7];
+
+ if (count _obstacles > 0 || count _vehicles > 0 || surfaceIsWater _currentPosition) then {
+ _currentPosition = [(_position select 0)+((sin _direction)*_radius),(_position select 1)+((cos _direction)*_radius),0];
+ _direction = _direction + 36;
+ if (_count > 15) then {_radius = _radius + 25};
+ } else {
+ _retPos = _currentPosition;
+ _placed = true;
+ breakTo "PlaceSafe";
+ };
+};
+
+_retPos
\ No newline at end of file |
