From 9cd3027ea6a45039bd7e1a2ad5e73b0c1d8fcee3 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 16 Apr 2023 11:16:54 +0200 Subject: [PATCH 1/3] Update FlightGroup.lua --- Moose Development/Moose/Ops/FlightGroup.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index 9ff16c279..39c815101 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -1083,11 +1083,11 @@ function FLIGHTGROUP:Status() -- Life points. local life=self.life or 0 - -- Total ammo. + -- Total ammo. local ammo=self:GetAmmoTot().Total -- Detected units. - local ndetected=self.detectionOn and tostring(self.detectedunits:Count()) or "Off" + local ndetected=self.detectionOn and tostring(self.detectedunits:Count()) or "Off" -- Get cargo weight. local cargo=0 From d07709a167fdf714561a61a7c66f497f938c56e6 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 13 May 2023 23:06:56 +0200 Subject: [PATCH 2/3] Update Auftrag.lua --- Moose Development/Moose/Ops/Auftrag.lua | 72 +++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index 9edd38838..09ee24a8a 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -400,6 +400,7 @@ _AUFTRAGSNR=0 -- @field #string CAP Combat Air Patrol. -- @field #string CAS Close Air Support. -- @field #string ESCORT Escort mission. +-- @field #string FAC Forward AirController mission. -- @field #string FACA Forward AirController airborne mission. -- @field #string FERRY Ferry mission. -- @field #string INTERCEPT Intercept mission. @@ -443,6 +444,7 @@ AUFTRAG.Type={ CAP="CAP", CAS="CAS", ESCORT="Escort", + FAC="FAC", FACA="FAC-A", FERRY="Ferry Flight", INTERCEPT="Intercept", @@ -1457,6 +1459,43 @@ function AUFTRAG:NewCASENHANCED(CasZone, Altitude, Speed, RangeMax, NoEngageZone return mission end +--- **[AIR]** Create a FAC mission. Group(s) will go to the zone and patrol it randomly and act as FAC for detected units. +-- @param #AUFTRAG self +-- @param Core.Zone#ZONE CasZone The CAS zone. +-- @param #number Speed Speed in knots. +-- @param #number Altitude Altitude in feet. Only for airborne units. Default 2000 feet ASL. +-- @param #number Frequency Frequency in MHz. +-- @param #number Modulation Modulation. +-- @return #AUFTRAG self +function AUFTRAG:NewFAC(FacZone, Speed, Altitude, Frequency, Modulation) + + local mission=AUFTRAG:New(AUFTRAG.Type.FAC) + + -- Ensure we got a ZONE and not just the zone name. + if type(FacZone)=="string" then + FacZone=ZONE:FindByName(FacZone) + end + + mission:_TargetFromObject(FacZone) + + mission.missionTask=mission:GetMissionTaskforMissionType(AUFTRAG.Type.FAC) + + mission.optionROE=ENUMS.ROE.ReturnFire + mission.optionROT=ENUMS.ROT.EvadeFire + mission.optionAlarm=ENUMS.AlarmState.Auto + + mission.missionFraction=1.0 + mission.missionSpeed=Speed and UTILS.KnotsToKmph(Speed) or nil + mission.missionAltitude=Altitude and UTILS.FeetToMeters(Altitude) or nil + + mission.categories={AUFTRAG.Category.AIRCRAFT} + + mission.DCStask=mission:GetDCSMissionTask() + + + return mission +end + --- **[AIR]** Create a FACA mission. -- @param #AUFTRAG self @@ -2567,6 +2606,7 @@ function AUFTRAG:NewAUTO(EngageGroup) mission=AUFTRAG:NewESCORT(EscortGroup,OffsetVector,EngageMaxDistance,TargetTypes) elseif auftrag==AUFTRAG.Type.FACA then mission=AUFTRAG:NewFACA(Target,Designation,DataLink,Frequency,Modulation) + elseif auftrag==AUFTRAG.Type.FERRY then -- Not implemented yet. elseif auftrag==AUFTRAG.Type.GCICAP then @@ -5749,14 +5789,38 @@ function AUFTRAG:GetDCSMissionTask() elseif self.type==AUFTRAG.Type.FACA then - ----------------- - -- FAC Mission -- - ----------------- + ------------------ + -- AFAC Mission -- + ------------------ local DCStask=CONTROLLABLE.TaskFAC_AttackGroup(nil, self.engageTarget:GetObject(), self.engageWeaponType, self.facDesignation, self.facDatalink, self.facFreq, self.facModu, CallsignName, CallsignNumber) table.insert(DCStasks, DCStask) + elseif self.type==AUFTRAG.Type.FAC then + + ----------------- + -- FAC Mission -- + ----------------- + + local DCStask={} + + DCStask.id=AUFTRAG.SpecialTask.PATROLZONE + + -- We create a "fake" DCS task and pass the parameters to the OPSGROUP. + local param={} + param.zone=self:GetObjective() + param.altitude=self.missionAltitude + param.speed=self.missionSpeed + + DCStask.params=param + + table.insert(DCStasks, DCStask) + + -- Enroute task FAC + local DCSenroute=CONTROLLABLE.EnRouteTaskFAC(self, self.facFreq, self.facModu) + table.insert(self.enrouteTasks, DCSenroute) + elseif self.type==AUFTRAG.Type.FERRY then ------------------- @@ -6400,6 +6464,8 @@ function AUFTRAG:GetMissionTaskforMissionType(MissionType) mtask=ENUMS.MissionTask.ESCORT elseif MissionType==AUFTRAG.Type.FACA then mtask=ENUMS.MissionTask.AFAC + elseif MissionType==AUFTRAG.Type.FAC then + mtask=ENUMS.MissionTask.AFAC elseif MissionType==AUFTRAG.Type.FERRY then mtask=ENUMS.MissionTask.NOTHING elseif MissionType==AUFTRAG.Type.INTERCEPT then From d9d545845024c281897b7ac9ce130b2224fca0d1 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 23 May 2023 01:28:52 +0200 Subject: [PATCH 3/3] OPS **AUFTRAG** - New type `FAC` **OPSZONE** - Improved drawzone on capture --- Moose Development/Moose/Ops/Auftrag.lua | 11 +++++++---- Moose Development/Moose/Ops/OpsZone.lua | 13 +++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index 09ee24a8a..4c6dd2d20 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -642,7 +642,7 @@ AUFTRAG.Category={ --- AUFTRAG class version. -- @field #string version -AUFTRAG.version="1.1.0" +AUFTRAG.version="1.2.0" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -1459,9 +1459,9 @@ function AUFTRAG:NewCASENHANCED(CasZone, Altitude, Speed, RangeMax, NoEngageZone return mission end ---- **[AIR]** Create a FAC mission. Group(s) will go to the zone and patrol it randomly and act as FAC for detected units. +--- **[AIR, GROUND]** Create a FAC mission. Group(s) will go to the zone and patrol it randomly and act as FAC for detected units. -- @param #AUFTRAG self --- @param Core.Zone#ZONE CasZone The CAS zone. +-- @param Core.Zone#ZONE FacZone The FAC zone (or name of zone) where to patrol. -- @param #number Speed Speed in knots. -- @param #number Altitude Altitude in feet. Only for airborne units. Default 2000 feet ASL. -- @param #number Frequency Frequency in MHz. @@ -1479,6 +1479,9 @@ function AUFTRAG:NewFAC(FacZone, Speed, Altitude, Frequency, Modulation) mission:_TargetFromObject(FacZone) mission.missionTask=mission:GetMissionTaskforMissionType(AUFTRAG.Type.FAC) + + mission.facFreq=Frequency or 133 + mission.facModu=Modulation or radio.modulation.AM mission.optionROE=ENUMS.ROE.ReturnFire mission.optionROT=ENUMS.ROT.EvadeFire @@ -1488,7 +1491,7 @@ function AUFTRAG:NewFAC(FacZone, Speed, Altitude, Frequency, Modulation) mission.missionSpeed=Speed and UTILS.KnotsToKmph(Speed) or nil mission.missionAltitude=Altitude and UTILS.FeetToMeters(Altitude) or nil - mission.categories={AUFTRAG.Category.AIRCRAFT} + mission.categories={AUFTRAG.Category.AIRCRAFT, AUFTRAG.Category.GROUND} mission.DCStask=mission:GetDCSMissionTask() diff --git a/Moose Development/Moose/Ops/OpsZone.lua b/Moose Development/Moose/Ops/OpsZone.lua index dd0d942dd..d7b134adf 100644 --- a/Moose Development/Moose/Ops/OpsZone.lua +++ b/Moose Development/Moose/Ops/OpsZone.lua @@ -95,7 +95,7 @@ OPSZONE.ZoneType={ --- OPSZONE class version. -- @field #string version -OPSZONE.version="0.5.0" +OPSZONE.version="0.6.0" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- ToDo list @@ -127,7 +127,7 @@ OPSZONE.version="0.5.0" -- function OPSZONE:New(Zone, CoalitionOwner) - -- Inherit everything from LEGION class. + -- Inherit everything from FSM class. local self=BASE:Inherit(self, FSM:New()) -- #OPSZONE -- Check if zone name instead of ZONE object was passed. @@ -817,6 +817,15 @@ function OPSZONE:onafterCaptured(From, Event, To, NewOwnerCoalition) -- Set owners. self.ownerPrevious=self.ownerCurrent self.ownerCurrent=NewOwnerCoalition + + if self.drawZone then + + self.zone:UndrawZone() + + local color=self:_GetZoneColor() + + self.zone:DrawZone(nil, color, 1.0, color, 0.5) + end for _,_chief in pairs(self.chiefs) do local chief=_chief --Ops.Chief#CHIEF