Merge pull request #2366 from shaji-Dev/master

[FIXED] Maintain valid unit positions
This commit is contained in:
Thomas 2025-08-24 16:35:43 +02:00 committed by GitHub
commit 3e095711f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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