**AUFTRAG**
- Added new type `NOTHING` (similar to `ALERT5` but for ground/naval)
This commit is contained in:
Frank
2022-04-29 22:00:23 +02:00
parent 02dad179cd
commit ba591c9dc5
9 changed files with 178 additions and 62 deletions

View File

@@ -86,7 +86,7 @@ COHORT = {
--- COHORT class version.
-- @field #string version
COHORT.version="0.3.4"
COHORT.version="0.3.5"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
@@ -391,10 +391,12 @@ function COHORT:AddMissionCapability(MissionTypes, Performance)
for _,missiontype in pairs(MissionTypes) do
local Capability=self:GetMissionCapability(missiontype)
-- Check not to add the same twice.
if AUFTRAG.CheckMissionCapability(missiontype, self.missiontypes) then
self:E(self.lid.."WARNING: Mission capability already present! No need to add it twice.")
-- TODO: update performance.
if Capability then
self:E(self.lid.."WARNING: Mission capability already present! No need to add it twice. Will update the performance though!")
Capability.Performance=Performance or 50
else
local capability={} --Ops.Auftrag#AUFTRAG.Capability
@@ -411,6 +413,22 @@ function COHORT:AddMissionCapability(MissionTypes, Performance)
return self
end
--- Get missin capability for a given mission type.
-- @param #COHORT self
-- @param #string MissionType Mission type, e.g. `AUFTRAG.Type.BAI`.
-- @return Ops.Auftrag#AUFTRAG.Capability Capability table or `nil` if the capability does not exist.
function COHORT:GetMissionCapability(MissionType)
for _,_capability in pairs(self.missiontypes) do
local capability=_capability --Ops.Auftrag#AUFTRAG.Capability
if capability.MissionType==MissionType then
return capability
end
end
return nil
end
--- Check if cohort assets have a given property (DCS attribute).
-- @param #COHORT self
-- @param #string Property The property.
@@ -1008,12 +1026,17 @@ function COHORT:RecruitAssets(MissionType, Npayloads)
-- Asset is already on a mission.
---
-- Check if this asset is currently on a GCICAP mission (STARTED or EXECUTING).
-- Check if this asset is currently on a mission (STARTED or EXECUTING).
if MissionType==AUFTRAG.Type.RELOCATECOHORT then
-- Relocation: Take all assets. Mission will be cancelled.
table.insert(assets, asset)
elseif self.legion:IsAssetOnMission(asset, AUFTRAG.Type.NOTHING) then
-- Relocation: Take all assets. Mission will be cancelled.
table.insert(assets, asset)
elseif self.legion:IsAssetOnMission(asset, AUFTRAG.Type.GCICAP) and MissionType==AUFTRAG.Type.INTERCEPT then
-- Check if the payload of this asset is compatible with the mission.