From 4ae4f76ce0c1c47281e718dc921d4f1801e4ec91 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 28 Mar 2020 20:47:49 +0100 Subject: [PATCH] Ops --- Moose Development/Moose/Ops/Auftrag.lua | 26 +++++++++++++++++++- Moose Development/Moose/Ops/FlightGroup.lua | 9 +++++-- Moose Development/Moose/Ops/Intelligence.lua | 4 +++ Moose Development/Moose/Ops/Squadron.lua | 12 ++++++--- 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index 3f87929ea..eb10a6512 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -1078,9 +1078,11 @@ function AUFTRAG:onafterStatus(From, Event, To) -- Mission start stop time. local Cstart=UTILS.SecondsToClock(self.Tstart, true) local Cstop=self.Tstop and UTILS.SecondsToClock(self.Tstop, true) or "INF" + + local targetname=self:GetTargetName() or "unknown" -- Info message. - self:I(self.lid..string.format("Status \"%s\": T=%s-%s assets=%d, flights=%d, targets=%d", self.status, Cstart, Cstop, #self.assets, Nflights, Ntargets)) + self:I(self.lid..string.format("Status %s: Target=%s, T=%s-%s, assets=%d, flights=%d, targets=%d", targetname, self.status, Cstart, Cstop, #self.assets, Nflights, Ntargets)) -- Check for error. if fsmstate~=self.status then @@ -1698,6 +1700,28 @@ function AUFTRAG:GetTargetCoordinate() return nil end +--- Get coordinate of target. +-- @param #AUFTRAG self +-- @return #string +function AUFTRAG:GetTargetName() + + if self.engageTarget then + if self.engageTarget.Type==AUFTRAG.TargetType.COORDINATE then + local coord=self.engageTarget.Target --Core.Point#COORDINATE + return coord:ToStringLLDMS() + else + return self.engageTarget.Target:GetName() + end + elseif self.orbitCoord then + return self.orbitCoord:ToStringLLDMS() + elseif self.escortGroup then + return self.escortGroup:GetName() + end + + return nil +end + + --- Get distance to target. -- @param #AUFTRAG self -- @param Core.Point#COORDINATE FromCoord The coordinate from which the distance is measured. diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index 005d6e3ea..e107c536e 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -895,14 +895,19 @@ end -- @param #FLIGHTGROUP self -- @return #string Group name. function FLIGHTGROUP:GetName() - return self.group:GetName() + return self.groupname end --- Get current coordinate of the group. -- @param #FLIGHTGROUP self -- @return Core.Point#COORDINATE The coordinate (of the first unit) of the group. function FLIGHTGROUP:GetCoordinate() - return self.group:GetCoordinate() + if self:IsAlive() then + return self.group:GetCoordinate() + else + self:E(self.lid.."WARNING: Group is not alive. Cannot get coordinate!") + end + return nil end --- Get waypoint. diff --git a/Moose Development/Moose/Ops/Intelligence.lua b/Moose Development/Moose/Ops/Intelligence.lua index 13fd0eb8f..fd4ea847e 100644 --- a/Moose Development/Moose/Ops/Intelligence.lua +++ b/Moose Development/Moose/Ops/Intelligence.lua @@ -313,6 +313,10 @@ function INTEL:onafterStatus(From, Event, To) local contact=_contact --#INTEL.DetectedItem local dT=timer.getAbsTime()-contact.Tdetected text=text..string.format("\n- %s (%s): %s, units=%d, T=%d sec", contact.categoryname, contact.attribute, contact.groupname, contact.group:CountAliveUnits(), dT) + if contact.mission then + local mission=contact.mission --Ops.Auftrag#AUFTRAG + text=text..string.format(" mission name=%s type=%s target=%s", mission.name, mission.type, mission:GetTargetName() or "unkown") + end end self:I(self.lid..text) end diff --git a/Moose Development/Moose/Ops/Squadron.lua b/Moose Development/Moose/Ops/Squadron.lua index 75b37371c..3c8d7c89f 100644 --- a/Moose Development/Moose/Ops/Squadron.lua +++ b/Moose Development/Moose/Ops/Squadron.lua @@ -248,19 +248,25 @@ end --- Set call sign. -- @param #SQUADRON self --- @param #string Callsign +-- @param #number Callsign Callsign from CALLSIGN.Aircraft, e.g. "Chevy" for CALLSIGN.Aircraft.CHEVY. +-- @param #number Index Callsign index, Chevy-**1**. -- @return #SQUADRON self function SQUADRON:SetCallsign(Callsign, Index) self.callsignName=Callsign + self.callsignIndex=Index return self end --- Set modex. -- @param #SQUADRON self --- @param #string Modex +-- @param #number Modex A number like 100. +-- @param #string Prefix A prefix string, which is put before the `Modex` number. +-- @param #string Suffix A suffix string, which is put after the `Modex` number. -- @return #SQUADRON self -function SQUADRON:SetModex(Modex) +function SQUADRON:SetModex(Modex, Prefix, Suffix) self.modex=Modex + self.modexPrefix=Prefix + self.modexSuffix=Suffix return self end