diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index 4f187c01e..fdcdf5912 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -2726,6 +2726,29 @@ function AUFTRAG:GetMissionTypesText(MissionTypes) return text end +--- Get coordinate of target. First unit/group of the set is used. +-- @param #AUFTRAG self +-- @param Wrapper.Group#GROUP group Group. +-- @return Core.Point#COORDINATE Coordinate where the mission is executed. +function AUFTRAG:GetMissionWaypointCoord(group) + + -- Create waypoint coordinate half way between us and the target. + local waypointcoord=group:GetCoordinate():GetIntermediateCoordinate(self:GetTargetCoordinate(), self.missionFraction) + local alt=waypointcoord.y + + -- Add some randomization. + waypointcoord=ZONE_RADIUS:New("Temp", waypointcoord:GetVec2(), 1000):GetRandomCoordinate():SetAltitude(alt, false) + + -- Set altitude of mission waypoint. + if self.missionAltitude then + waypointcoord:SetAltitude(self.missionAltitude, true) + end + env.info(string.format("FF mission alt=%d meters", waypointcoord.y)) + + return waypointcoord +end + + --- Set log ID string. -- @param #AUFTRAG self -- @return #AUFTRAG self diff --git a/Moose Development/Moose/Ops/NavyGroup.lua b/Moose Development/Moose/Ops/NavyGroup.lua index 3bd2b97bd..b38ec5d4a 100644 --- a/Moose Development/Moose/Ops/NavyGroup.lua +++ b/Moose Development/Moose/Ops/NavyGroup.lua @@ -371,7 +371,7 @@ function NAVYGROUP:onafterUpdateRoute(From, Event, To, n, Speed, Depth) -- Set speed. wp.speed=UTILS.KmphToMps(speed) - wp.alt=-depth + wp.alt=-depth --Depth and -Depth or wp.alt -- Add waypoint. table.insert(waypoints, wp) diff --git a/Moose Development/Moose/Ops/OpsGroup.lua b/Moose Development/Moose/Ops/OpsGroup.lua index 052161a4a..bb6979c23 100644 --- a/Moose Development/Moose/Ops/OpsGroup.lua +++ b/Moose Development/Moose/Ops/OpsGroup.lua @@ -1630,18 +1630,8 @@ function OPSGROUP:RouteToMission(mission, delay) -- Next waypoint. local nextwaypoint=self.currentwp+1 - -- Create waypoint coordinate half way between us and the target. - local waypointcoord=self.group:GetCoordinate():GetIntermediateCoordinate(mission:GetTargetCoordinate(), mission.missionFraction) - local alt=waypointcoord.y - - -- Add some randomization. - waypointcoord=ZONE_RADIUS:New("Temp", waypointcoord:GetVec2(), 1000):GetRandomCoordinate():SetAltitude(alt, false) - - -- Set altitude of mission waypoint. - if mission.missionAltitude then - waypointcoord:SetAltitude(mission.missionAltitude, true) - end - env.info(string.format("FF mission alt=%d meters", waypointcoord.y)) + -- Get coordinate where the mission is executed. + local waypointcoord=mission:GetMissionWaypointCoord(self.group) -- Add enroute tasks. for _,task in pairs(mission.enrouteTasks) do