From 897df1b8fa374e121dd96e7340a16c3a97f632b6 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 3 Dec 2021 14:27:03 +0100 Subject: [PATCH] CHIEF - Option to allow ground transport. Set CAS speed to 70% max as Russian Helos are overly slow --- Moose Development/Moose/Ops/Chief.lua | 28 +++++++++++++++++-- .../Moose/Wrapper/Positionable.lua | 2 +- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Ops/Chief.lua b/Moose Development/Moose/Ops/Chief.lua index d37fd5fc0..e0c8afa01 100644 --- a/Moose Development/Moose/Ops/Chief.lua +++ b/Moose Development/Moose/Ops/Chief.lua @@ -180,7 +180,7 @@ CHIEF.Strategy = { --- CHIEF class version. -- @field #string version -CHIEF.version="0.0.2" +CHIEF.version="0.0.3" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -238,6 +238,7 @@ function CHIEF:New(Coalition, AgentSet, Alias) -- Init stuff. self.Defcon=CHIEF.DEFCON.GREEN self.strategy=CHIEF.Strategy.DEFENSIVE + self.TransportCategories = {Group.Category.HELICOPTER} -- Create a new COMMANDER. self.commander=COMMANDER:New(Coalition) @@ -986,6 +987,23 @@ function CHIEF:AddAttackZone(Zone) return self end +--- Allow chief to use GROUND units for transport tasks. Helicopters are still preferred, and be aware there's no check as of now +-- if a destination can be reached on land. +-- @param #CHIEF self +-- @return #CHIEF self +function CHIEF:AllowGroundTransport() + self.TransportCategories = {Group.Category.GROUND, Group.Category.HELICOPTER} + return self +end + +--- Forbid chief to use GROUND units for transport tasks. Restrict to Helicopters. This is the default +-- @param #CHIEF self +-- @return #CHIEF self +function CHIEF:ForbidGroundTransport() + self.TransportCategories = {Group.Category.HELICOPTER} + return self +end + --- Check if current strategy is passive. -- @param #CHIEF self -- @return #boolean If `true`, strategy is passive. @@ -2191,7 +2209,7 @@ function CHIEF:RecruitAssetsForZone(StratZone, MissionType, NassetsMin, NassetsM -- Categories. Currently only helicopters are allowed due to problems with ground transports (might get stuck, might not be a land connection. -- TODO: Check if ground transport is possible. For example, by trying land.getPathOnRoad or something. - local Categories={Group.Category.HELICOPTER} + local Categories={self.TransportCategories} --local Categories={Group.Category.HELICOPTER, Group.Category.GROUND} -- Recruit transport assets for infantry. @@ -2243,10 +2261,14 @@ function CHIEF:RecruitAssetsForZone(StratZone, MissionType, NassetsMin, NassetsM local mission=AUFTRAG:NewPATROLZONE(caszone) mission:SetEngageDetected(25, {"Ground Units", "Light armed ships", "Helicopters"}) mission:SetWeaponExpend(AI.Task.WeaponExpend.ALL) - + -- Add assets to mission. for _,asset in pairs(assets) do mission:AddAsset(asset) + if asset.speedmax then + local speed = UTILS.KmphToKnots(asset.speedmax * 0.7) or 100 + mission:SetMissionSpeed(speed) + end end -- Assign mission to legions. diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua index f1a704cc3..2ff626552 100644 --- a/Moose Development/Moose/Wrapper/Positionable.lua +++ b/Moose Development/Moose/Wrapper/Positionable.lua @@ -1565,7 +1565,7 @@ do -- Cargo ["KrAZ6322"] = 12, ["M 818"] = 12, ["Tigr_233036"] = 6, - ["TPZ"] = 10, + ["TPZ"] = 10, -- Fuchs ["UAZ-469"] = 4, -- new by kappa ["Ural-375"] = 12, ["Ural-4320-31"] = 14,