From cca5a5d55d8a4429f8a79843c79120681b9ecc29 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 3 Dec 2023 20:51:19 +0100 Subject: [PATCH 1/3] Fixes - Fixed A/C starting on ALERT5 - Fixed nil check for DrawID in UndrawZone --- Moose Development/Moose/Core/Zone.lua | 10 ++++++---- Moose Development/Moose/Ops/FlightGroup.lua | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Core/Zone.lua b/Moose Development/Moose/Core/Zone.lua index cb2648d0d..229356455 100644 --- a/Moose Development/Moose/Core/Zone.lua +++ b/Moose Development/Moose/Core/Zone.lua @@ -480,12 +480,14 @@ function ZONE_BASE:UndrawZone(Delay) if Delay and Delay>0 then self:ScheduleOnce(Delay, ZONE_BASE.UndrawZone, self) else - if self.DrawID and type(self.DrawID) ~= "table" then - UTILS.RemoveMark(self.DrawID) - else -- DrawID is a table with a collections of mark ids, as used in ZONE_POLYGON + if self.DrawID then + if type(self.DrawID) ~= "table" then + 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 - UTILS.RemoveMark(mark_id) + UTILS.RemoveMark(mark_id) end + end end end return self diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index ad115cdc2..25a6b8ef2 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -2863,8 +2863,11 @@ function FLIGHTGROUP:_CheckGroupDone(delay, waittime) end 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:__Wait(-1) + end end 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))) From bc3a5271dc8ac91304862a21f55b5a4fb574b0ff Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 4 Dec 2023 22:19:31 +0100 Subject: [PATCH 2/3] Update OpsGroup.lua - Fixed group returning to legion when told not to --- Moose Development/Moose/Ops/OpsGroup.lua | 28 ++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Ops/OpsGroup.lua b/Moose Development/Moose/Ops/OpsGroup.lua index b5eb4079c..d7cbe4ab6 100644 --- a/Moose Development/Moose/Ops/OpsGroup.lua +++ b/Moose Development/Moose/Ops/OpsGroup.lua @@ -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. if (self.adinfinitum or istemp) then - self:_PassedFinalWaypoint(false, "Removed PASSED temporary waypoint ") - end - - + self:_PassedFinalWaypoint(false, "Removed PASSED temporary waypoint") + end + end end @@ -5801,6 +5800,27 @@ function OPSGROUP:onafterMissionDone(From, Event, To, Mission) 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. self:_CheckGroupDone(delay) From f789fbac709d5127e068ac09b8f52433f062c57a Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 5 Dec 2023 17:48:34 +0100 Subject: [PATCH 3/3] Update Zone.lua - Fixed ZONE_POLYGON:New called without initial points --- Moose Development/Moose/Core/Zone.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Moose Development/Moose/Core/Zone.lua b/Moose Development/Moose/Core/Zone.lua index 229356455..26a164c83 100644 --- a/Moose Development/Moose/Core/Zone.lua +++ b/Moose Development/Moose/Core/Zone.lua @@ -2380,13 +2380,13 @@ function ZONE_POLYGON_BASE:New( ZoneName, PointsArray ) self._.Polygon[i].y = PointsArray[i].y 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 - -- 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 end