mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge pull request #2366 from shaji-Dev/master
[FIXED] Maintain valid unit positions
This commit is contained in:
commit
3e095711f4
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user