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

This commit is contained in:
Applevangelist 2023-12-06 08:44:15 +01:00
commit 69c20e78fb
3 changed files with 38 additions and 13 deletions

View File

@ -480,12 +480,14 @@ function ZONE_BASE:UndrawZone(Delay)
if Delay and Delay>0 then if Delay and Delay>0 then
self:ScheduleOnce(Delay, ZONE_BASE.UndrawZone, self) self:ScheduleOnce(Delay, ZONE_BASE.UndrawZone, self)
else else
if self.DrawID and type(self.DrawID) ~= "table" then if self.DrawID then
UTILS.RemoveMark(self.DrawID) if type(self.DrawID) ~= "table" then
else -- DrawID is a table with a collections of mark ids, as used in ZONE_POLYGON UTILS.RemoveMark(self.DrawID)
else -- DrawID is a table with a collections of mark ids, as used in ZONE_POLYGON
for _, mark_id in pairs(self.DrawID) do for _, mark_id in pairs(self.DrawID) do
UTILS.RemoveMark(mark_id) UTILS.RemoveMark(mark_id)
end end
end
end end
end end
return self return self
@ -2378,13 +2380,13 @@ function ZONE_POLYGON_BASE:New( ZoneName, PointsArray )
self._.Polygon[i].y = PointsArray[i].y self._.Polygon[i].y = PointsArray[i].y
end end
-- triangulate the polygon so we can work with it
self._Triangles = self:_Triangulate()
-- set the polygon's surface area
self.SurfaceArea = self:_CalculateSurfaceArea()
end end
-- triangulate the polygon so we can work with it
self._Triangles = self:_Triangulate()
-- set the polygon's surface area
self.SurfaceArea = self:_CalculateSurfaceArea()
return self return self
end end

View File

@ -2863,8 +2863,11 @@ function FLIGHTGROUP:_CheckGroupDone(delay, waittime)
end end
else else
-- Check if not parking (could be on ALERT5 and just spawned (current mission=nil)
if not self:IsParking() then
self:T(self.lid..string.format("Passed Final WP but Tasks=%d or Missions=%d left in the queue. Wait!", nTasks, nMissions)) self:T(self.lid..string.format("Passed Final WP but Tasks=%d or Missions=%d left in the queue. Wait!", nTasks, nMissions))
self:__Wait(-1) self:__Wait(-1)
end
end end
else else
self:T(self.lid..string.format("Passed Final WP but still have current Task (#%s) or Mission (#%s) left to do", tostring(self.taskcurrent), tostring(self.currentmission))) self:T(self.lid..string.format("Passed Final WP but still have current Task (#%s) or Mission (#%s) left to do", tostring(self.taskcurrent), tostring(self.currentmission)))

View File

@ -3472,10 +3472,9 @@ function OPSGROUP:RemoveWaypoint(wpindex)
-- Could be that the waypoint we are currently moving to was the LAST waypoint. Then we now passed the final waypoint. -- Could be that the waypoint we are currently moving to was the LAST waypoint. Then we now passed the final waypoint.
if (self.adinfinitum or istemp) then if (self.adinfinitum or istemp) then
self:_PassedFinalWaypoint(false, "Removed PASSED temporary waypoint ") self:_PassedFinalWaypoint(false, "Removed PASSED temporary waypoint")
end end
end end
end end
@ -5801,6 +5800,27 @@ function OPSGROUP:onafterMissionDone(From, Event, To, Mission)
end end
end end
if self.legion and self.legionReturn==false and self.waypoints and #self.waypoints==1 then
---
-- This is the case where a group was send on a mission (which is over now), has no addional
-- waypoints or tasks and should NOT return to its legion.
-- We create a new waypoint at the current position and let it hold here.
---
local Coordinate=self:GetCoordinate()
if self.isArmygroup then
ARMYGROUP.AddWaypoint(self, Coordinate, 0, nil, nil, false)
elseif self.isNavygroup then
NAVYGROUP.AddWaypoint(self,Coordinate, 0, nil, nil, false)
end
-- Remove original waypoint.
self:RemoveWaypoint(1)
self:_PassedFinalWaypoint(true, "Passed final waypoint as group is done with mission but should NOT return to its legion")
end
-- Check if group is done. -- Check if group is done.
self:_CheckGroupDone(delay) self:_CheckGroupDone(delay)