Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
Applevangelist 2024-05-19 12:48:09 +02:00
commit ce01534535

View File

@ -3076,9 +3076,25 @@ function ZONE_POLYGON:NewFromDrawing(DrawingName)
-- points for the drawings are saved in local space, so add the object's map x and y coordinates to get -- points for the drawings are saved in local space, so add the object's map x and y coordinates to get
-- world space points we can use -- world space points we can use
for _, point in UTILS.spairs(object["points"]) do for _, point in UTILS.spairs(object["points"]) do
-- check if we want to skip adding a point
local skip = false
local p = {x = object["mapX"] + point["x"], local p = {x = object["mapX"] + point["x"],
y = object["mapY"] + point["y"] } y = object["mapY"] + point["y"] }
table.add(points, p)
-- Check if the same coordinates already exist in the list, skip if they do
-- This can happen when drawing a Polygon in Free mode, DCS adds points on
-- top of each other that are in the `mission` file, but not visible in the
-- Mission Editor
for _, pt in pairs(points) do
if pt.x == p.x and pt.y == p.y then
skip = true
end
end
-- if it's a unique point, add it
if not skip then
table.add(points, p)
end
end end
elseif object["polygonMode"] == "rect" then elseif object["polygonMode"] == "rect" then
-- the points for a rect are saved as local coordinates with an angle. To get the world space points from this -- the points for a rect are saved as local coordinates with an angle. To get the world space points from this
@ -3096,6 +3112,7 @@ function ZONE_POLYGON:NewFromDrawing(DrawingName)
points = {p1, p2, p3, p4} points = {p1, p2, p3, p4}
else else
-- bring the Arrow code over from Shape/Polygon
-- something else that might be added in the future -- something else that might be added in the future
end end
end end