[FIXED] Maintain valid unit positions

This commit is contained in:
smiki 2025-08-24 16:27:55 +02:00
parent 78b3efcf00
commit 8169235d2f

View File

@ -4921,20 +4921,9 @@ function UTILS.ValidateAndRepositionGroundUnits(Anchor, Positions, MaxRadius, Sp
for _, spot in pairs(spots) do for _, spot in pairs(spots) do
local dist = UTILS.VecDist2D(pos, spot) local dist = UTILS.VecDist2D(pos, spot)
if dist < closestDist then if dist < closestDist then
local skip = false closestDist = dist
for _, unit2 in pairs(units) do closestSpot = spot
local pos2 = { x = unit2.x, y = unit2.z or unit2.y } sid = si
local dist2 = UTILS.VecDist2D(spot, pos2)
if dist2 < spacing and isOnLand then
skip = true
break
end
end
if not skip then
closestDist = dist
closestSpot = spot
sid = si
end
end end
si = si + 1 si = si + 1
end end