From 3eef8d9a5d5adeeff27b04b9a395b1ddccb03f85 Mon Sep 17 00:00:00 2001 From: FullGas1 Date: Mon, 31 Mar 2025 12:22:39 +0200 Subject: [PATCH] ctld.getNearbyUnits : sort by distance --- CTLD.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CTLD.lua b/CTLD.lua index fac9a31..3590d43 100644 --- a/CTLD.lua +++ b/CTLD.lua @@ -1989,7 +1989,7 @@ function ctld.getNearbyUnits(_point, _radius, _coalition) end end - table.sort(unitsByDistance, function(a,b) return a.dist < b.dist end) -- sort the table by distance + table.sort(unitsByDistance, function(a,b) return a.dist < b.dist end) -- sort the table by distance (the nearest first) for i, v in ipairs(unitsByDistance) do table.insert(_units, v.unit) -- insert nearby unitName end