Ops Auftrag

This commit is contained in:
Frank
2020-03-27 22:19:20 +01:00
parent dda74c471f
commit 891235032a
2 changed files with 70 additions and 23 deletions
+57 -20
View File
@@ -1,8 +1,14 @@
--- **Ops** - Auftrag (mission) for Ops. --- **Ops** - Auftrag (mission) for Air to Air and Air to Surface Ops.
-- --
-- **Main Features:** -- **Main Features:**
-- --
-- * Create mission for ops. -- * Simplifies setting DCS tasks.
-- * Handy events.
-- * Set mission start/stop times.
-- * Set mission priority and urgency (can cancel running missions).
-- * Interface to FLIGHTGROUP, AIRWING and WINGCOMMANDER classes.
--
--
-- --
-- --
-- === -- ===
@@ -60,7 +66,7 @@
-- @field #number requestID The ID of the queued warehouse request. Necessary to cancel the request if the mission was cancelled before the request is processed. -- @field #number requestID The ID of the queued warehouse request. Necessary to cancel the request if the mission was cancelled before the request is processed.
-- @field #boolean cancelContactLost If true, cancel mission if the contact is lost. -- @field #boolean cancelContactLost If true, cancel mission if the contact is lost.
-- --
-- @field #string missionTask Mission task. Seed ENUMS.MissionTask. -- @field #string missionTask Mission task. See `ENUMS.MissionTask`.
-- @field #number missionAltitude Mission altitude in meters. -- @field #number missionAltitude Mission altitude in meters.
-- @field #number missionFraction Mission coordiante fraction. Default is 0.5. -- @field #number missionFraction Mission coordiante fraction. Default is 0.5.
-- @field #table enrouteTasks Mission enroute tasks. -- @field #table enrouteTasks Mission enroute tasks.
@@ -86,6 +92,9 @@
-- --
-- # The AUFTRAG Concept -- # The AUFTRAG Concept
-- --
-- As you probably know, setting tasks in DCS is often tedious. The AUFTRAG class significantly simplifies the necessary workflow by using optimized default parameters.
-- Also, a lot of additional useful events are created.
--
-- # Events -- # Events
-- --
-- --
@@ -201,23 +210,25 @@ AUFTRAG.FlightStatus={
CANCELLED="cancelled", CANCELLED="cancelled",
} }
--- --- Target type.
-- @type AUFTRAG.TargetType -- @type AUFTRAG.TargetType
-- @field #string GROUP Group target. -- @field #string GROUP Target is a GROUP object.
-- @field #string UNIT Unit target. -- @field #string UNIT Target is a UNIT object.
-- @field #string STATIC Static target. -- @field #string STATIC Target is a STATIC object.
-- @field #string COORDINATE Target coordinates. -- @field #string COORDINATE Target is a COORDINATE.
-- @field #string AIRBASE Target is an AIRBASE.
AUFTRAG.TargetType={ AUFTRAG.TargetType={
GROUP="Group", GROUP="Group",
UNIT="Unit", UNIT="Unit",
STATIC="Static", STATIC="Static",
COORDINATE="Coordinate", COORDINATE="Coordinate",
AIRBASE="Airbase",
} }
--- ---
-- @type AUFTRAG.TargetData -- @type AUFTRAG.TargetData
-- @field Wrapper.Positionable#POSITIONABLE Target Target Object. -- @field Wrapper.Positionable#POSITIONABLE Target Target Object.
-- @field #string Type Target type: "Group", "Unit", "Static", "Coordinate" -- @field #string Type Target type: "Group", "Unit", "Static", "Coordinate", "Airbase.
--- Mission success. --- Mission success.
-- @type AUFTRAG.Success -- @type AUFTRAG.Success
@@ -243,6 +254,7 @@ AUFTRAG.version="0.0.9"
-- TODO list -- TODO list
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO: Mission success options damaged, destroyed.
-- DONE: Mission ROE and ROT. -- DONE: Mission ROE and ROT.
-- TODO: Mission formation, etc. -- TODO: Mission formation, etc.
-- DONE: FSM events. -- DONE: FSM events.
@@ -515,7 +527,7 @@ function AUFTRAG:NewCAP(OrbitCoordinate, OrbitSpeed, Heading, Leg, ZoneCAP, Targ
mission:_SetLogID() mission:_SetLogID()
mission.missionTask=ENUMS.MissionTask.CAP mission.missionTask=ENUMS.MissionTask.CAP
mission.optionROE=ENUMS.ROE.WeaponFree mission.optionROE=ENUMS.ROE.OpenFire
mission.optionROT=ENUMS.ROT.EvadeFire mission.optionROT=ENUMS.ROT.EvadeFire
mission.DCStask=mission:GetDCSMissionTask() mission.DCStask=mission:GetDCSMissionTask()
@@ -546,13 +558,14 @@ function AUFTRAG:NewCAS(OrbitCoordinate, OrbitSpeed, Heading, Leg, ZoneCAS, Targ
-- CAS paramters. -- CAS paramters.
mission.type=AUFTRAG.Type.CAS mission.type=AUFTRAG.Type.CAS
mission.engageZone=ZoneCAS or ZONE_RADIUS:New("CAS Zone", OrbitCoordinate:GetVec2(), Leg) mission.engageZone=ZoneCAS or ZONE_RADIUS:New("CAS Zone", OrbitCoordinate:GetVec2(), Leg)
mission.engageTargetTypes=TargetTypes or {"Helicopters", "Ground Units", "Light armed ships"} mission.engageTargetTypes=TargetTypes or {"Helicopters", "Ground Units", "Light armed ships"}
mission:_SetLogID() mission:_SetLogID()
--mission.missionTask=ENUMS.MissionTask.CAS mission.missionTask=ENUMS.MissionTask.CAS
mission.optionROE=ENUMS.ROE.WeaponFree mission.optionROE=ENUMS.ROE.OpenFire
mission.optionROT=ENUMS.ROT.EvadeFire mission.optionROT=ENUMS.ROT.EvadeFire
mission.DCStask=mission:GetDCSMissionTask() mission.DCStask=mission:GetDCSMissionTask()
@@ -653,7 +666,7 @@ function AUFTRAG:NewBOMBRUNWAY(Airdrome, Altitude)
local mission=AUFTRAG:New(AUFTRAG.Type.BOMBRUNWAY) local mission=AUFTRAG:New(AUFTRAG.Type.BOMBRUNWAY)
-- DCS task options: -- DCS task options:
mission.engageAirbase=Airdrome mission.engageTarget=mission:_TargetFromObject(Airdrome)
mission.engageAltitude=UTILS.FeetToMeters(Altitude or 25000) mission.engageAltitude=UTILS.FeetToMeters(Altitude or 25000)
mission.engageWeaponType=ENUMS.WeaponFlag.AnyBomb mission.engageWeaponType=ENUMS.WeaponFlag.AnyBomb
mission.engageWeaponExpend=AI.Task.WeaponExpend.ALL mission.engageWeaponExpend=AI.Task.WeaponExpend.ALL
@@ -904,7 +917,7 @@ end
--- Set Rules of Engagement (ROE) for this mission. --- Set Rules of Engagement (ROE) for this mission.
-- @param #AUFTRAG self -- @param #AUFTRAG self
-- @param #string roe Mision ROE. -- @param #string roe Mission ROE.
-- @return #AUFTRAG self -- @return #AUFTRAG self
function AUFTRAG:SetROE(roe) function AUFTRAG:SetROE(roe)
@@ -916,7 +929,7 @@ end
--- Set Reaction on Threat (ROT) for this mission. --- Set Reaction on Threat (ROT) for this mission.
-- @param #AUFTRAG self -- @param #AUFTRAG self
-- @param #string roe Mision ROT. -- @param #string roe Mission ROT.
-- @return #AUFTRAG self -- @return #AUFTRAG self
function AUFTRAG:SetROE(rot) function AUFTRAG:SetROE(rot)
@@ -1768,6 +1781,28 @@ function AUFTRAG:GetDCSMissionTask()
table.insert(DCStasks, DCStask) table.insert(DCStasks, DCStask)
elseif self.type==AUFTRAG.Type.BOMBRUNWAY then
------------------------
-- BOMBRUNWAY Mission --
------------------------
local DCStask=CONTROLLABLE.TaskBombingRunway(nil, self.engageTarget.Target, self.engageWeaponType, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAsGroup)
table.insert(DCStasks, DCStask)
elseif self.type==AUFTRAG.Type.BOMBCARPET then
------------------------
-- BOMBCARPET Mission --
------------------------
local Vec2=self:GetTargetCoordinate():GetVec2()
local DCStask=CONTROLLABLE.TaskCarpetBombing(nil, Vec2, self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType, CarpetLength)
table.insert(DCStasks, DCStask)
elseif self.type==AUFTRAG.Type.CAP then elseif self.type==AUFTRAG.Type.CAP then
----------------- -----------------
@@ -1776,8 +1811,7 @@ function AUFTRAG:GetDCSMissionTask()
local DCStask=CONTROLLABLE.EnRouteTaskEngageTargetsInZone(nil, self.engageZone:GetVec2(), self.engageZone:GetRadius(), self.engageTargetTypes, Priority) local DCStask=CONTROLLABLE.EnRouteTaskEngageTargetsInZone(nil, self.engageZone:GetVec2(), self.engageZone:GetRadius(), self.engageTargetTypes, Priority)
--table.insert(self.enrouteTasks, DCStask) table.insert(self.enrouteTasks, DCStask)
--table.insert(DCStasks, DCStask)
elseif self.type==AUFTRAG.Type.CAS then elseif self.type==AUFTRAG.Type.CAS then
@@ -1788,7 +1822,6 @@ function AUFTRAG:GetDCSMissionTask()
local DCStask=CONTROLLABLE.EnRouteTaskEngageTargetsInZone(nil, self.engageZone:GetVec2(), self.engageZone:GetRadius(), self.engageTargetTypes, Priority) local DCStask=CONTROLLABLE.EnRouteTaskEngageTargetsInZone(nil, self.engageZone:GetVec2(), self.engageZone:GetRadius(), self.engageTargetTypes, Priority)
table.insert(self.enrouteTasks, DCStask) table.insert(self.enrouteTasks, DCStask)
--table.insert(DCStasks, DCStask)
elseif self.type==AUFTRAG.Type.ESCORT then elseif self.type==AUFTRAG.Type.ESCORT then
@@ -1915,7 +1948,7 @@ function AUFTRAG:GetDCSMissionTask()
-- Count mission targets. -- Count mission targets.
self.Ntargets=self:CountMissionTargets() self.Ntargets=self:CountMissionTargets()
self:I({missiontask=DCStasks}) self:I({Ntargets=self.Ntargets, missiontask=DCStasks})
-- Return the task. -- Return the task.
if #DCStasks==1 then if #DCStasks==1 then
@@ -1974,8 +2007,12 @@ function AUFTRAG:_TargetFromObject(Object)
target.Type=AUFTRAG.TargetType.COORDINATE target.Type=AUFTRAG.TargetType.COORDINATE
elseif Object:IsInstanceOf("AIRBASE") then
target.Type=AUFTRAG.TargetType.AIRBASE
else else
self:E(self.lid.."ERROR: Unknown object given as target. Needs to be a GROUP, UNIT, STATIC or COORDINATE") self:E(self.lid.."ERROR: Unknown object given as target. Needs to be a GROUP, UNIT, STATIC, COORDINATE")
return nil return nil
end end
+11 -1
View File
@@ -18,6 +18,11 @@ ENUMS = {}
--- Rules of Engagement. --- Rules of Engagement.
-- @type ENUMS.ROE -- @type ENUMS.ROE
-- @field #number WeaponFree AI will engage any enemy group it detects. Target prioritization is based based on the threat of the target.
-- @field #number OpenFireWeaponFree AI will engage any enemy group it detects, but will prioritize targets specified in the groups tasking.
-- @field #number OpenFire AI will engage only targets specified in its taskings.
-- @field #number ReturnFire AI will only engage threats that shoot first.
-- @field #number WeaponHold AI will hold fire under all circumstances.
ENUMS.ROE = { ENUMS.ROE = {
WeaponFree=0, WeaponFree=0,
OpenFireWeaponFree=1, OpenFireWeaponFree=1,
@@ -28,11 +33,16 @@ ENUMS.ROE = {
--- Reaction On Threat. --- Reaction On Threat.
-- @type ENUMS.ROT -- @type ENUMS.ROT
-- @field #number NoReaction No defensive actions will take place to counter threats.
-- @field #number PassiveDefense AI will use jammers and other countermeasures in an attempt to defeat the threat. AI will not attempt a maneuver to defeat a threat.
-- @field #number EvadeFire AI will react by performing defensive maneuvers against incoming threats. AI will also use passive defense.
-- @field #number BypassAndEscape AI will attempt to avoid enemy threat zones all together. This includes attempting to fly above or around threats.
-- @field #number AllowAbortMission If a threat is deemed severe enough the AI will abort its mission and return to base.
ENUMS.ROT = { ENUMS.ROT = {
NoReaction=0, NoReaction=0,
PassiveDefense=1, PassiveDefense=1,
EvadeFire=2, EvadeFire=2,
ByPassAndEscape=3, BypassAndEscape=3,
AllowAbortMission=4, AllowAbortMission=4,
} }