From b06990293397d4b6d0374097f09d1cc5679216e3 Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 11 Jun 2026 19:55:04 +0300 Subject: init --- Common/Functions/Common_BuildingInRange.sqf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Common/Functions/Common_BuildingInRange.sqf (limited to 'Common/Functions/Common_BuildingInRange.sqf') diff --git a/Common/Functions/Common_BuildingInRange.sqf b/Common/Functions/Common_BuildingInRange.sqf new file mode 100644 index 0000000..49eb893 --- /dev/null +++ b/Common/Functions/Common_BuildingInRange.sqf @@ -0,0 +1,17 @@ +Private ['_buildings','_buildingType','_checks','_closest','_range','_side','_sorted','_unit']; +_buildingType = _this select 0; +_buildings = _this select 1; +_range = _this select 2; +_side = _this select 3; +_unit = _this select 4; + +_closest = objNull; + +_checks = [_side,Format ["WFBE_%1%2",str _side,_buildingType] Call GetNamespace,_buildings] Call GetFactories; +if (count _checks > 0) then { + _sorted = [_unit,_checks] Call SortByDistance; + _closest = _sorted select 0; + if (_unit distance _closest > _range) then {_closest = objNull}; +}; + +_closest \ No newline at end of file -- cgit v1.3.1