From 4e36e2011f307e268b9c8ecf6eed95fef4245895 Mon Sep 17 00:00:00 2001 From: ttrebuchon Date: Sat, 20 May 2023 12:32:39 -0400 Subject: [PATCH 1/6] Add categories/attributes/properties filters for AUFTRAG transports --- Moose Development/Moose/Ops/Auftrag.lua | 11 ++++++++++- Moose Development/Moose/Ops/Commander.lua | 2 +- Moose Development/Moose/Ops/Legion.lua | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index 3c967a15e..3d52dbe89 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -114,6 +114,9 @@ -- @field #number NcarriersMax Max number of required carrier assets. -- @field Core.Zone#ZONE transportDeployZone Deploy zone of an OPSTRANSPORT. -- @field Core.Zone#ZONE transportDisembarkZone Disembark zone of an OPSTRANSPORT. +-- @param #table Categories Transport group categories. +-- @field #table transportAttributes Generalized attribute(s) of transport assets. +-- @field #table transportProperties DCS attribute(s) of transport assets. -- -- @field #number artyRadius Radius in meters. -- @field #number artyShots Number of shots fired. @@ -3056,12 +3059,18 @@ end -- @param #number NcarriersMin Number of carriers *at least* required. Default 1. -- @param #number NcarriersMax Number of carriers *at most* used for transportation. Default is same as `NcarriersMin`. -- @param Core.Zone#ZONE DisembarkZone Zone where assets are disembarked to. +-- @param #table Categories Group categories. +-- @param #table Attributes Generalizes group attributes. +-- @param #table Properties DCS attributes. -- @return #AUFTRAG self -function AUFTRAG:SetRequiredTransport(DeployZone, NcarriersMin, NcarriersMax, DisembarkZone) +function AUFTRAG:SetRequiredTransport(DeployZone, NcarriersMin, NcarriersMax, DisembarkZone, Categories, Attributes, Properties) -- OPS transport from pickup to deploy zone. self.transportDeployZone=DeployZone self.transportDisembarkZone=DisembarkZone + self.transportCategories = UTILS.EnsureTable(Categories, true) + self.transportAttributes = UTILS.EnsureTable(Attributes, true) + self.transportProperties = UTILS.EnsureTable(Properties, true) -- Set required carriers. self:SetRequiredCarriers(NcarriersMin, NcarriersMax) diff --git a/Moose Development/Moose/Ops/Commander.lua b/Moose Development/Moose/Ops/Commander.lua index 16b9d43e1..13f069380 100644 --- a/Moose Development/Moose/Ops/Commander.lua +++ b/Moose Development/Moose/Ops/Commander.lua @@ -1508,7 +1508,7 @@ function COMMANDER:CheckMissionQueue() local Transport=nil local Legions=mission.transportLegions or self.legions - TransportAvail, Transport=LEGION.AssignAssetsForTransport(self, Legions, assets, mission.NcarriersMin, mission.NcarriersMax, mission.transportDeployZone, mission.transportDisembarkZone) + TransportAvail, Transport=LEGION.AssignAssetsForTransport(self, Legions, assets, mission.NcarriersMin, mission.NcarriersMax, mission.transportDeployZone, mission.transportDisembarkZone, mission.transportCategories, mission.transportAttributes, mission.transportProperties) -- Add opstransport to mission. if TransportAvail and Transport then diff --git a/Moose Development/Moose/Ops/Legion.lua b/Moose Development/Moose/Ops/Legion.lua index d05f456f2..ddd13d54f 100644 --- a/Moose Development/Moose/Ops/Legion.lua +++ b/Moose Development/Moose/Ops/Legion.lua @@ -714,7 +714,7 @@ function LEGION:CheckMissionQueue() local Legions=mission.transportLegions or {self} -- Assign carrier assets for transport. - TransportAvail, Transport=self:AssignAssetsForTransport(Legions, assets, mission.NcarriersMin, mission.NcarriersMax, mission.transportDeployZone, mission.transportDisembarkZone) + TransportAvail, Transport=self:AssignAssetsForTransport(Legions, assets, mission.NcarriersMin, mission.NcarriersMax, mission.transportDeployZone, mission.transportDisembarkZone, mission.transportCategories, mission.transportAttributes, mission.transportProperties) end -- Add opstransport to mission. From b3d46618c2180d94a4529b191caa20893ffbb1b9 Mon Sep 17 00:00:00 2001 From: ttrebuchon Date: Sat, 17 Jun 2023 16:56:46 -0400 Subject: [PATCH 2/6] Missed 2 spots in Legion/Commander for transport filters. --- Moose Development/Moose/Ops/Commander.lua | 3 +-- Moose Development/Moose/Ops/Legion.lua | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Ops/Commander.lua b/Moose Development/Moose/Ops/Commander.lua index 13f069380..ff13e6bf3 100644 --- a/Moose Development/Moose/Ops/Commander.lua +++ b/Moose Development/Moose/Ops/Commander.lua @@ -1702,8 +1702,7 @@ function COMMANDER:RecruitAssetsForMission(Mission) local cohort=_cohort --Ops.Cohort#COHORT -- Check if cohort can perform transport to target. - --TODO: Option to filter transport carrier asset categories, attributes and/or properties. - local can=LEGION._CohortCan(cohort, AUFTRAG.Type.OPSTRANSPORT, Categories, Attributes, Properties, nil, TargetVec2) + local can=LEGION._CohortCan(cohort, AUFTRAG.Type.OPSTRANSPORT, Mission.transportCategories, Mission.transportAttributes, Mission.transportProperties, nil, TargetVec2) -- MaxWeight of cargo assets is limited by the largets available cargo bay. We don't want to select, e.g., tanks that cannot be transported by APCs or helos. if can and (MaxWeight==nil or cohort.cargobayLimit>MaxWeight) then diff --git a/Moose Development/Moose/Ops/Legion.lua b/Moose Development/Moose/Ops/Legion.lua index ddd13d54f..73ea7f28e 100644 --- a/Moose Development/Moose/Ops/Legion.lua +++ b/Moose Development/Moose/Ops/Legion.lua @@ -2252,8 +2252,7 @@ function LEGION:RecruitAssetsForMission(Mission) local cohort=_cohort --Ops.Cohort#COHORT -- Check if cohort can perform transport to target. - --TODO: Option to filter transport carrier asset categories, attributes and/or properties. - local can=LEGION._CohortCan(cohort, AUFTRAG.Type.OPSTRANSPORT, Categories, Attributes, Properties, nil, TargetVec2) + local can=LEGION._CohortCan(cohort, AUFTRAG.Type.OPSTRANSPORT, Mission.transportCategories, Mission.transportAttributes, Mission.transportProperties, nil, TargetVec2) -- MaxWeight of cargo assets is limited by the largets available cargo bay. We don't want to select, e.g., tanks that cannot be transported by APCs or helos. if can and (MaxWeight==nil or cohort.cargobayLimit>MaxWeight) then From e28477349209cd8822667ed358ff9daf89dc0497 Mon Sep 17 00:00:00 2001 From: ttrebuchon Date: Sat, 17 Jun 2023 17:06:16 -0400 Subject: [PATCH 3/6] Move transport categories/etc to SetRequiredCarriers, to allow for specifying them without always needing to specify zones --- Moose Development/Moose/Ops/Auftrag.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index 3d52dbe89..fa819ba0a 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -3068,12 +3068,9 @@ function AUFTRAG:SetRequiredTransport(DeployZone, NcarriersMin, NcarriersMax, Di -- OPS transport from pickup to deploy zone. self.transportDeployZone=DeployZone self.transportDisembarkZone=DisembarkZone - self.transportCategories = UTILS.EnsureTable(Categories, true) - self.transportAttributes = UTILS.EnsureTable(Attributes, true) - self.transportProperties = UTILS.EnsureTable(Properties, true) -- Set required carriers. - self:SetRequiredCarriers(NcarriersMin, NcarriersMax) + self:SetRequiredCarriers(NcarriersMin, NcarriersMax, Categories, Attributes, Properties) return self end @@ -3124,8 +3121,11 @@ end -- @param #AUFTRAG self -- @param #number NcarriersMin Number of carriers *at least* required. Default 1. -- @param #number NcarriersMax Number of carriers *at most* used for transportation. Default is same as `NcarriersMin`. +-- @param #table Categories Group categories. +-- @param #table Attributes Generalizes group attributes. +-- @param #table Properties DCS attributes. -- @return #AUFTRAG self -function AUFTRAG:SetRequiredCarriers(NcarriersMin, NcarriersMax) +function AUFTRAG:SetRequiredCarriers(NcarriersMin, NcarriersMax, Categories, Attributes, Properties) self.NcarriersMin=NcarriersMin or 1 @@ -3136,6 +3136,10 @@ function AUFTRAG:SetRequiredCarriers(NcarriersMin, NcarriersMax) self.NcarriersMax=self.NcarriersMin end + self.transportCategories = UTILS.EnsureTable(Categories, true) + self.transportAttributes = UTILS.EnsureTable(Attributes, true) + self.transportProperties = UTILS.EnsureTable(Properties, true) + return self end From 2a11c4c98aad99f2762d949149628943c2ad7f35 Mon Sep 17 00:00:00 2001 From: ttrebuchon Date: Sat, 17 Jun 2023 17:07:56 -0400 Subject: [PATCH 4/6] Rename AUFTRAG.transportCategories/etc to carrierCategories/etc --- Moose Development/Moose/Ops/Auftrag.lua | 6 +++--- Moose Development/Moose/Ops/Commander.lua | 4 ++-- Moose Development/Moose/Ops/Legion.lua | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index fa819ba0a..039056886 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -3136,9 +3136,9 @@ function AUFTRAG:SetRequiredCarriers(NcarriersMin, NcarriersMax, Categories, Att self.NcarriersMax=self.NcarriersMin end - self.transportCategories = UTILS.EnsureTable(Categories, true) - self.transportAttributes = UTILS.EnsureTable(Attributes, true) - self.transportProperties = UTILS.EnsureTable(Properties, true) + self.carrierCategories = UTILS.EnsureTable(Categories, true) + self.carrierAttributes = UTILS.EnsureTable(Attributes, true) + self.carrierProperties = UTILS.EnsureTable(Properties, true) return self end diff --git a/Moose Development/Moose/Ops/Commander.lua b/Moose Development/Moose/Ops/Commander.lua index ff13e6bf3..0af40ed2d 100644 --- a/Moose Development/Moose/Ops/Commander.lua +++ b/Moose Development/Moose/Ops/Commander.lua @@ -1508,7 +1508,7 @@ function COMMANDER:CheckMissionQueue() local Transport=nil local Legions=mission.transportLegions or self.legions - TransportAvail, Transport=LEGION.AssignAssetsForTransport(self, Legions, assets, mission.NcarriersMin, mission.NcarriersMax, mission.transportDeployZone, mission.transportDisembarkZone, mission.transportCategories, mission.transportAttributes, mission.transportProperties) + TransportAvail, Transport=LEGION.AssignAssetsForTransport(self, Legions, assets, mission.NcarriersMin, mission.NcarriersMax, mission.transportDeployZone, mission.transportDisembarkZone, mission.carrierCategories, mission.carrierAttributes, mission.carrierProperties) -- Add opstransport to mission. if TransportAvail and Transport then @@ -1702,7 +1702,7 @@ function COMMANDER:RecruitAssetsForMission(Mission) local cohort=_cohort --Ops.Cohort#COHORT -- Check if cohort can perform transport to target. - local can=LEGION._CohortCan(cohort, AUFTRAG.Type.OPSTRANSPORT, Mission.transportCategories, Mission.transportAttributes, Mission.transportProperties, nil, TargetVec2) + local can=LEGION._CohortCan(cohort, AUFTRAG.Type.OPSTRANSPORT, Mission.carrierCategories, Mission.carrierAttributes, Mission.carrierProperties, nil, TargetVec2) -- MaxWeight of cargo assets is limited by the largets available cargo bay. We don't want to select, e.g., tanks that cannot be transported by APCs or helos. if can and (MaxWeight==nil or cohort.cargobayLimit>MaxWeight) then diff --git a/Moose Development/Moose/Ops/Legion.lua b/Moose Development/Moose/Ops/Legion.lua index 73ea7f28e..15cad88be 100644 --- a/Moose Development/Moose/Ops/Legion.lua +++ b/Moose Development/Moose/Ops/Legion.lua @@ -714,7 +714,7 @@ function LEGION:CheckMissionQueue() local Legions=mission.transportLegions or {self} -- Assign carrier assets for transport. - TransportAvail, Transport=self:AssignAssetsForTransport(Legions, assets, mission.NcarriersMin, mission.NcarriersMax, mission.transportDeployZone, mission.transportDisembarkZone, mission.transportCategories, mission.transportAttributes, mission.transportProperties) + TransportAvail, Transport=self:AssignAssetsForTransport(Legions, assets, mission.NcarriersMin, mission.NcarriersMax, mission.transportDeployZone, mission.transportDisembarkZone, mission.carrierCategories, mission.carrierAttributes, mission.carrierProperties) end -- Add opstransport to mission. @@ -2252,7 +2252,7 @@ function LEGION:RecruitAssetsForMission(Mission) local cohort=_cohort --Ops.Cohort#COHORT -- Check if cohort can perform transport to target. - local can=LEGION._CohortCan(cohort, AUFTRAG.Type.OPSTRANSPORT, Mission.transportCategories, Mission.transportAttributes, Mission.transportProperties, nil, TargetVec2) + local can=LEGION._CohortCan(cohort, AUFTRAG.Type.OPSTRANSPORT, Mission.carrierCategories, Mission.carrierAttributes, Mission.carrierProperties, nil, TargetVec2) -- MaxWeight of cargo assets is limited by the largets available cargo bay. We don't want to select, e.g., tanks that cannot be transported by APCs or helos. if can and (MaxWeight==nil or cohort.cargobayLimit>MaxWeight) then From 92f81614ba34002b45f1e89496910b1e393174c9 Mon Sep 17 00:00:00 2001 From: ttrebuchon Date: Sat, 17 Jun 2023 17:09:50 -0400 Subject: [PATCH 5/6] Update/fix lua docs for new AUFTRAG transport fields --- Moose Development/Moose/Ops/Auftrag.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index 039056886..17c33d13f 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -114,9 +114,9 @@ -- @field #number NcarriersMax Max number of required carrier assets. -- @field Core.Zone#ZONE transportDeployZone Deploy zone of an OPSTRANSPORT. -- @field Core.Zone#ZONE transportDisembarkZone Disembark zone of an OPSTRANSPORT. --- @param #table Categories Transport group categories. --- @field #table transportAttributes Generalized attribute(s) of transport assets. --- @field #table transportProperties DCS attribute(s) of transport assets. +-- @param #table carrierCategories Transport group categories. +-- @field #table carrierAttributes Generalized attribute(s) of transport assets. +-- @field #table carrierProperties DCS attribute(s) of transport assets. -- -- @field #number artyRadius Radius in meters. -- @field #number artyShots Number of shots fired. From 9c1acc731a241f95a452960f4b6c2e8e79047f89 Mon Sep 17 00:00:00 2001 From: ttrebuchon Date: Sat, 17 Jun 2023 17:32:49 -0400 Subject: [PATCH 6/6] Make Attributes parameter documentation conform to other similar descriptions --- Moose Development/Moose/Ops/Auftrag.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index 17c33d13f..00fb6ddbd 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -3122,7 +3122,7 @@ end -- @param #number NcarriersMin Number of carriers *at least* required. Default 1. -- @param #number NcarriersMax Number of carriers *at most* used for transportation. Default is same as `NcarriersMin`. -- @param #table Categories Group categories. --- @param #table Attributes Generalizes group attributes. +-- @param #table Attributes Group attributes. See `GROUP.Attribute.` -- @param #table Properties DCS attributes. -- @return #AUFTRAG self function AUFTRAG:SetRequiredCarriers(NcarriersMin, NcarriersMax, Categories, Attributes, Properties)