mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-12 16:57:50 +00:00
Ops
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
-- * Set mission priority and urgency (can cancel running missions).
|
-- * Set mission priority and urgency (can cancel running missions).
|
||||||
-- * Specific mission options for ROE, ROT, formation, etc.
|
-- * Specific mission options for ROE, ROT, formation, etc.
|
||||||
-- * Interface to FLIGHTGROUP, AIRWING and WINGCOMMANDER classes.
|
-- * Interface to FLIGHTGROUP, AIRWING and WINGCOMMANDER classes.
|
||||||
|
-- * FSM events when a mission is done, successful or failed.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -314,7 +315,7 @@ AUFTRAG.TargetType={
|
|||||||
|
|
||||||
--- AUFTRAG class version.
|
--- AUFTRAG class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
AUFTRAG.version="0.1.6"
|
AUFTRAG.version="0.1.7"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -425,7 +426,7 @@ function AUFTRAG:NewRESCUEHELO(Carrier)
|
|||||||
|
|
||||||
local mission=AUFTRAG:New(AUFTRAG.Type.RESCUEHELO)
|
local mission=AUFTRAG:New(AUFTRAG.Type.RESCUEHELO)
|
||||||
|
|
||||||
mission.engageTarget=mission:_TargetFromObject(Carrier)
|
mission:_TargetFromObject(Carrier)
|
||||||
|
|
||||||
mission.missionTask=ENUMS.MissionTask.NOTHING
|
mission.missionTask=ENUMS.MissionTask.NOTHING
|
||||||
mission.missionFraction=0.5
|
mission.missionFraction=0.5
|
||||||
@@ -445,7 +446,8 @@ function AUFTRAG:NewANTISHIP(Target)
|
|||||||
|
|
||||||
local mission=AUFTRAG:New(AUFTRAG.Type.ANTISHIP)
|
local mission=AUFTRAG:New(AUFTRAG.Type.ANTISHIP)
|
||||||
|
|
||||||
mission.engageTarget=mission:_TargetFromObject(Target)
|
mission:_TargetFromObject(Target)
|
||||||
|
|
||||||
mission.engageWeaponType=ENUMS.WeaponFlag.Auto
|
mission.engageWeaponType=ENUMS.WeaponFlag.Auto
|
||||||
|
|
||||||
mission.missionTask=ENUMS.MissionTask.ANTISHIPSTRIKE
|
mission.missionTask=ENUMS.MissionTask.ANTISHIPSTRIKE
|
||||||
@@ -478,7 +480,7 @@ function AUFTRAG:NewORBIT(Coordinate, Altitude, Speed, Heading, Leg)
|
|||||||
end
|
end
|
||||||
Coordinate.y=mission.orbitAltitude
|
Coordinate.y=mission.orbitAltitude
|
||||||
|
|
||||||
mission.engageTarget = mission:_TargetFromObject(Coordinate)
|
mission:_TargetFromObject(Coordinate)
|
||||||
|
|
||||||
mission.orbitSpeed = UTILS.KnotsToMps(Speed or 350)
|
mission.orbitSpeed = UTILS.KnotsToMps(Speed or 350)
|
||||||
|
|
||||||
@@ -621,7 +623,7 @@ function AUFTRAG:NewINTERCEPT(Target)
|
|||||||
|
|
||||||
local mission=AUFTRAG:New(AUFTRAG.Type.INTERCEPT)
|
local mission=AUFTRAG:New(AUFTRAG.Type.INTERCEPT)
|
||||||
|
|
||||||
mission.engageTarget=mission:_TargetFromObject(Target)
|
mission:_TargetFromObject(Target)
|
||||||
|
|
||||||
mission.missionTask=ENUMS.MissionTask.INTERCEPT
|
mission.missionTask=ENUMS.MissionTask.INTERCEPT
|
||||||
mission.missionFraction=0.1
|
mission.missionFraction=0.1
|
||||||
@@ -939,7 +941,7 @@ function AUFTRAG:NewTRANSPORT(TransportGroupSet, PickupCoordinate)
|
|||||||
env.info("FF error in TRANSPORT auftrag")
|
env.info("FF error in TRANSPORT auftrag")
|
||||||
end
|
end
|
||||||
|
|
||||||
mission.engageTarget=mission:_TargetFromObject(mission.transportGroupSet)
|
mission:_TargetFromObject(mission.transportGroupSet)
|
||||||
|
|
||||||
mission.transportPickup=PickupCoordinate or mission:GetTargetCoordinate()
|
mission.transportPickup=PickupCoordinate or mission:GetTargetCoordinate()
|
||||||
|
|
||||||
@@ -1140,7 +1142,7 @@ function AUFTRAG:SetWeaponExpend(WeaponExpend)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set number of weapons to expend.
|
--- Set whether target will be attack as group.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param #boolean Switch If true or nil, engage as group. If false, not.
|
-- @param #boolean Switch If true or nil, engage as group. If false, not.
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
@@ -1378,12 +1380,12 @@ function AUFTRAG:IsReadyToGo()
|
|||||||
local Tnow=timer.getAbsTime()
|
local Tnow=timer.getAbsTime()
|
||||||
|
|
||||||
-- Start time did not pass yet.
|
-- Start time did not pass yet.
|
||||||
if Tnow<self.Tstart then
|
if self.Tstart and Tnow<self.Tstart or false then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Stop time already passed.
|
-- Stop time already passed.
|
||||||
if Tnow>self.Tstop then
|
if self.Tstop and Tnow>self.Tstop or false then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2062,7 +2064,7 @@ function AUFTRAG:CountMissionTargets(Target)
|
|||||||
|
|
||||||
local N=0
|
local N=0
|
||||||
|
|
||||||
Target=Target or self.engageTarget
|
Target=Target or self:GetTargetData()
|
||||||
|
|
||||||
if Target then
|
if Target then
|
||||||
|
|
||||||
@@ -2101,6 +2103,10 @@ function AUFTRAG:CountMissionTargets(Target)
|
|||||||
elseif Target.Type==AUFTRAG.TargetType.AIRBASE then
|
elseif Target.Type==AUFTRAG.TargetType.AIRBASE then
|
||||||
|
|
||||||
-- TODO: any (good) way to tell whether an airbase was "destroyed" or at least damaged? Is :GetLive() working?
|
-- TODO: any (good) way to tell whether an airbase was "destroyed" or at least damaged? Is :GetLive() working?
|
||||||
|
|
||||||
|
elseif Target.Type==AUFTRAG.TargetType.COORDINATE then
|
||||||
|
|
||||||
|
-- No target!
|
||||||
|
|
||||||
elseif Target.Type==AUFTRAG.TargetType.SETGROUP then
|
elseif Target.Type==AUFTRAG.TargetType.SETGROUP then
|
||||||
|
|
||||||
@@ -2114,7 +2120,7 @@ function AUFTRAG:CountMissionTargets(Target)
|
|||||||
|
|
||||||
-- We check that unit is "alive".
|
-- We check that unit is "alive".
|
||||||
if unit and unit:IsAlive() and unit:GetLife()>1 then
|
if unit and unit:IsAlive() and unit:GetLife()>1 then
|
||||||
N=N+unit:GetLife()
|
N=N+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2127,7 +2133,7 @@ function AUFTRAG:CountMissionTargets(Target)
|
|||||||
|
|
||||||
-- We check that unit is "alive".
|
-- We check that unit is "alive".
|
||||||
if unit and unit:IsAlive() and unit:GetLife()>1 then
|
if unit and unit:IsAlive() and unit:GetLife()>1 then
|
||||||
N=N+unit:GetLife()
|
N=N+1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -2148,7 +2154,7 @@ function AUFTRAG:GetTargetLife(Target)
|
|||||||
|
|
||||||
local N=0
|
local N=0
|
||||||
|
|
||||||
Target=Target or self.engageTarget
|
Target=Target or self:GetTargetData()
|
||||||
|
|
||||||
if Target then
|
if Target then
|
||||||
|
|
||||||
@@ -2186,6 +2192,10 @@ function AUFTRAG:GetTargetLife(Target)
|
|||||||
elseif Target.Type==AUFTRAG.TargetType.AIRBASE then
|
elseif Target.Type==AUFTRAG.TargetType.AIRBASE then
|
||||||
|
|
||||||
-- TODO: any (good) way to tell whether an airbase was "destroyed" or at least damaged? Is :GetLive() working?
|
-- TODO: any (good) way to tell whether an airbase was "destroyed" or at least damaged? Is :GetLive() working?
|
||||||
|
|
||||||
|
elseif Target.Type==AUFTRAG.TargetType.COORDINATE then
|
||||||
|
|
||||||
|
-- A coordinate does not live.
|
||||||
|
|
||||||
elseif Target.Type==AUFTRAG.TargetType.SETGROUP then
|
elseif Target.Type==AUFTRAG.TargetType.SETGROUP then
|
||||||
|
|
||||||
@@ -2302,7 +2312,7 @@ function AUFTRAG:GetTargetCoordinate()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get coordinate of target.
|
--- Get name of the target.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @return #string Name of the target or "N/A".
|
-- @return #string Name of the target or "N/A".
|
||||||
function AUFTRAG:GetTargetName()
|
function AUFTRAG:GetTargetName()
|
||||||
@@ -2311,7 +2321,6 @@ function AUFTRAG:GetTargetName()
|
|||||||
return self.engageTarget.Name
|
return self.engageTarget.Name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
return "N/A"
|
return "N/A"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2360,9 +2369,10 @@ end
|
|||||||
function AUFTRAG:UpdateMarker()
|
function AUFTRAG:UpdateMarker()
|
||||||
|
|
||||||
-- Marker text.
|
-- Marker text.
|
||||||
local text=string.format("%s %s", self.name, self.status:upper())
|
local text=string.format("%s %s: %s", self.name, self.type:upper(), self.status:upper())
|
||||||
text=text..string.format("\n%s %s * %d/%d", self.type:upper(), self:GetTargetName(), self:CountMissionTargets(), self.Ntargets)
|
text=text..string.format("\n%s", self:GetTargetName())
|
||||||
text=text..string.format("\nFlights %d/%d", self:CountFlightGroups(), tostring(self.nassets))
|
text=text..string.format("\nTargets %d/%d, Life Points=%d", self:CountMissionTargets(), self.Ntargets, self:GetTargetLife())
|
||||||
|
text=text..string.format("\nFlights %d/%d", self:CountFlightGroups(), self.nassets)
|
||||||
|
|
||||||
if not self.marker then
|
if not self.marker then
|
||||||
|
|
||||||
@@ -2634,7 +2644,7 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get DCS task table for an attack task.
|
--- Get DCS task table for an attack group or unit task.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param #AUFTRAG.TargetData target Target data.
|
-- @param #AUFTRAG.TargetData target Target data.
|
||||||
-- @param #table DCStasks DCS DCS tasks table to which the task is added.
|
-- @param #table DCStasks DCS DCS tasks table to which the task is added.
|
||||||
@@ -2761,7 +2771,8 @@ function AUFTRAG:_TargetFromObject(Object)
|
|||||||
-- TODO: get rid of this.
|
-- TODO: get rid of this.
|
||||||
self.Ntargets=Ninitial
|
self.Ntargets=Ninitial
|
||||||
|
|
||||||
self:I(self.lid..string.format("Mission Target Type=%s", target.Type))
|
env.info("FF check")
|
||||||
|
self:I(self.lid..string.format("Mission Target Type=%s, Ntargets=%d", target.Type, self.Ntargets))
|
||||||
|
|
||||||
return target
|
return target
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -64,6 +64,7 @@
|
|||||||
-- @field Core.Set#SET_ZONE inzones Set of zones in which the group is currently in.
|
-- @field Core.Set#SET_ZONE inzones Set of zones in which the group is currently in.
|
||||||
-- @field #boolean groupinitialized If true, group parameters were initialized.
|
-- @field #boolean groupinitialized If true, group parameters were initialized.
|
||||||
-- @field #boolean ishelo If true, the is a helicopter group.
|
-- @field #boolean ishelo If true, the is a helicopter group.
|
||||||
|
-- @field #boolean detectionOn If true, detected units of the group are analyzed.
|
||||||
--
|
--
|
||||||
-- @field #number tacanChannelDefault The default TACAN channel.
|
-- @field #number tacanChannelDefault The default TACAN channel.
|
||||||
-- @field #string tacanMorseDefault The default TACAN morse code.
|
-- @field #string tacanMorseDefault The default TACAN morse code.
|
||||||
@@ -436,6 +437,7 @@ function FLIGHTGROUP:New(groupname, autostart)
|
|||||||
self:SetFuelCriticalThreshold()
|
self:SetFuelCriticalThreshold()
|
||||||
self:SetDefaultROE()
|
self:SetDefaultROE()
|
||||||
self:SetDefaultROT()
|
self:SetDefaultROT()
|
||||||
|
self:SetDetection()
|
||||||
|
|
||||||
|
|
||||||
-- Add FSM transitions.
|
-- Add FSM transitions.
|
||||||
@@ -816,20 +818,16 @@ function FLIGHTGROUP:GetAirWing()
|
|||||||
return self.airwing
|
return self.airwing
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Define parking spots to be used by the flight group.
|
--- Set detection on or off.
|
||||||
-- This is valid only for the specified airbase.
|
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
-- @param #string airbasename Name of the airbase.
|
-- @param #boolean Switch If true, detection is on. If false or nil, detection is off. Default is off.
|
||||||
-- @param #table Table of parking spot numbers.
|
|
||||||
-- @return #FLIGHTGROUP self
|
-- @return #FLIGHTGROUP self
|
||||||
function FLIGHTGROUP:SetParkingSpots(airbase, spots)
|
function FLIGHTGROUP:SetDetection(Switch)
|
||||||
self.parkingspots[airbase]=spots
|
self.detectionOn=Switch
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Set the FLIGHTCONTROL controlling this flight group.
|
--- Set the FLIGHTCONTROL controlling this flight group.
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
-- @param Ops.FlightControl#FLIGHTCONTROL flightcontrol The FLIGHTCONTROL object.
|
-- @param Ops.FlightControl#FLIGHTCONTROL flightcontrol The FLIGHTCONTROL object.
|
||||||
@@ -1231,11 +1229,19 @@ end
|
|||||||
|
|
||||||
--- Clear the group for landing when it is holding.
|
--- Clear the group for landing when it is holding.
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
|
-- @param #number Delay Delay in seconds before landing clearance is given.
|
||||||
-- @return #FLIGHTGROUP self
|
-- @return #FLIGHTGROUP self
|
||||||
function FLIGHTGROUP:ClearToLand()
|
function FLIGHTGROUP:ClearToLand(Delay)
|
||||||
if self:IsHolding() then
|
|
||||||
self:I(self.lid..string.format("Clear to land ==> setting holding flag to 1 (true)"))
|
if Delay and Delay>0 then
|
||||||
self.flaghold:Set(1)
|
self:ScheduleOnce(Delay, FLIGHTGROUP.ClearToLand, self)
|
||||||
|
else
|
||||||
|
|
||||||
|
if self:IsHolding() then
|
||||||
|
self:I(self.lid..string.format("Clear to land ==> setting holding flag to 1 (true)"))
|
||||||
|
self.flaghold:Set(1)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -1459,7 +1465,7 @@ function FLIGHTGROUP:onafterFlightStatus(From, Event, To)
|
|||||||
---
|
---
|
||||||
|
|
||||||
-- Check if group has detected any units.
|
-- Check if group has detected any units.
|
||||||
if self.DetectionON then
|
if self.detectionOn then
|
||||||
self:_CheckDetectedUnits()
|
self:_CheckDetectedUnits()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user