diff options
| author | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:57:23 +0300 |
|---|---|---|
| committer | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:57:23 +0300 |
| commit | 3533c3aa9393fc6350178b196c813dc636ec9cf6 (patch) | |
| tree | 2f96a879c3935dea18e73410926b03c7eef1a751 /Common/Functions/Common_PlaceSafe.sqf | |
| download | a2wf_isladuala-3533c3aa9393fc6350178b196c813dc636ec9cf6.tar.gz a2wf_isladuala-3533c3aa9393fc6350178b196c813dc636ec9cf6.tar.bz2 a2wf_isladuala-3533c3aa9393fc6350178b196c813dc636ec9cf6.zip | |
init
Diffstat (limited to '')
| -rw-r--r-- | Common/Functions/Common_PlaceSafe.sqf | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Common/Functions/Common_PlaceSafe.sqf b/Common/Functions/Common_PlaceSafe.sqf new file mode 100644 index 0000000..45176c2 --- /dev/null +++ b/Common/Functions/Common_PlaceSafe.sqf @@ -0,0 +1,28 @@ +Private["_count","_currentPosition","_direction","_object","_obstacles","_placed","_position","_radius","_vehicles"];
+scopeName "PlaceSafe";
+
+_object = _this select 0;
+_position = _this select 1;
+_radius = if (count _this > 2) then {_this select 2} else {35};
+
+_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 {
+ _object setPos _currentPosition;
+ _object setVelocity [0,0,-0.5];
+ _placed = true;
+ breakTo "PlaceSafe";
+ };
+};
+
+if (!_placed) then {_object setPos _position;_object setVelocity [0,0,-0.5]};
|
