From 31b93fb42c40a2292754e7a57831a78e61114f9b Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 1 Apr 2021 13:21:40 +0200 Subject: [PATCH 1/4] Update FlightGroup.lua Avoid endless when plane/heli is not airborne by needs to RTB --- Moose Development/Moose/Ops/FlightGroup.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index ad0f1a6ce..09ce9a524 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -147,6 +147,7 @@ FLIGHTGROUP = { Tparking = nil, menu = nil, ishelo = nil, + RTBRecallCount = 0, } @@ -2150,11 +2151,16 @@ function FLIGHTGROUP:onbeforeRTB(From, Event, To, airbase, SpeedTo, SpeedHold) end if not self.group:IsAirborne(true) then - self:I(self.lid..string.format("WARNING: Group is not AIRBORNE ==> RTB event is suspended for 10 sec.")) + -- this should really not happen, either the AUFTRAG is cancelled before the group was airborne or it is stuck at the ground for some reason + self:I(self.lid..string.format("WARNING: Group is not AIRBORNE ==> RTB event is suspended for 20 sec.")) allowed=false - Tsuspend=-10 + Tsuspend=-20 + self.RTBRecallCount = self.RTBRecallCount+1 + if self.RTBRecallCount > 3 then + self:Despawn(5) + end end - + -- Only if fuel is not low or critical. if not (self:IsFuelLow() or self:IsFuelCritical()) then From b1465d89a6c50cd36741348edbf81bd0f47f4b73 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sun, 4 Apr 2021 12:49:40 +0200 Subject: [PATCH 2/4] Update FlightGroup.lua Added check for velocity for the RTB loop (if group is taxiing). Added OutOfAAMissiles. --- Moose Development/Moose/Ops/FlightGroup.lua | 47 +++++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index 09ce9a524..afcedc072 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -140,6 +140,7 @@ FLIGHTGROUP = { fuelcritical = nil, fuelcriticalthresh = nil, fuelcriticalrtb = false, + outofAAMrtb = true, squadron = nil, flightcontrol = nil, flaghold = nil, @@ -477,6 +478,20 @@ function FLIGHTGROUP:SetFuelLowRTB(switch) return self end +--- Set if flight is out of Air-Air-Missiles, flight goes RTB. +-- @param #FLIGHTGROUP self +-- @param #boolean switch If true or nil, flight goes RTB. If false, turn this off. +-- @return #FLIGHTGROUP self +function FLIGHTGROUP:SetOutOfAMMRTB(switch) + if switch==false then + self.outofAAMrtb=false + else + self.outofAAMrtb=true + end + return self +end + + --- Set if low fuel threshold is reached, flight tries to refuel at the neares tanker. -- @param #FLIGHTGROUP self -- @param #boolean switch If true or nil, flight goes for refuelling. If false, turn this off. @@ -1015,7 +1030,18 @@ function FLIGHTGROUP:onafterStatus(From, Event, To) if fuelmin RTB event is suspended for 20 sec.")) allowed=false Tsuspend=-20 - self.RTBRecallCount = self.RTBRecallCount+1 - if self.RTBRecallCount > 3 then + local groupspeed = self.group:GetVelocityMPS() + if groupspeed <= 1 then self.RTBRecallCount = self.RTBRecallCount+1 end + if self.RTBRecallCount > 6 then self:Despawn(5) end end From c1a8c088804857797fc98a709f7baca2a8240ef4 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 12 Apr 2021 13:02:16 +0200 Subject: [PATCH 3/4] Update FlightGroup.lua --- Moose Development/Moose/Ops/FlightGroup.lua | 54 ++++++++++++++++++--- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index afcedc072..a71619474 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -140,7 +140,8 @@ FLIGHTGROUP = { fuelcritical = nil, fuelcriticalthresh = nil, fuelcriticalrtb = false, - outofAAMrtb = true, + outofAAMrtb = true, + outofAGMrtb = true, squadron = nil, flightcontrol = nil, flaghold = nil, @@ -148,7 +149,7 @@ FLIGHTGROUP = { Tparking = nil, menu = nil, ishelo = nil, - RTBRecallCount = 0, + RTBRecallCount = 0, } @@ -212,7 +213,7 @@ FLIGHTGROUP.version="0.6.1" -- TODO: Mark assigned parking spot on F10 map. -- TODO: Let user request a parking spot via F10 marker :) -- TODO: Monitor traveled distance in air ==> calculate fuel consumption ==> calculate range remaining. Will this give half way accurate results? --- TODO: Out of AG/AA missiles. Safe state of out-of-ammo. +-- DONE: Out of AG/AA missiles. Safe state of out-of-ammo. -- DONE: Add tasks. -- DONE: Waypoints, read, add, insert, detour. -- DONE: Get ammo. @@ -276,9 +277,9 @@ function FLIGHTGROUP:New(group) self:AddTransition("*", "FuelLow", "*") -- Fuel state of group is low. Default ~25%. self:AddTransition("*", "FuelCritical", "*") -- Fuel state of group is critical. Default ~10%. - self:AddTransition("*", "OutOfMissilesAA", "*") -- Group is out of A2A missiles. Not implemented yet! - self:AddTransition("*", "OutOfMissilesAG", "*") -- Group is out of A2G missiles. Not implemented yet! - self:AddTransition("*", "OutOfMissilesAS", "*") -- Group is out of A2G missiles. Not implemented yet! + self:AddTransition("*", "OutOfMissilesAA", "*") -- Group is out of A2A missiles. + self:AddTransition("*", "OutOfMissilesAG", "*") -- Group is out of A2G missiles. + self:AddTransition("*", "OutOfMissilesAS", "*") -- Group is out of A2S(ship) missiles. Not implemented yet! self:AddTransition("Airborne", "EngageTarget", "Engaging") -- Engage targets. self:AddTransition("Engaging", "Disengage", "Airborne") -- Engagement over. @@ -482,7 +483,7 @@ end -- @param #FLIGHTGROUP self -- @param #boolean switch If true or nil, flight goes RTB. If false, turn this off. -- @return #FLIGHTGROUP self -function FLIGHTGROUP:SetOutOfAMMRTB(switch) +function FLIGHTGROUP:SetOutOfAAMRTB(switch) if switch==false then self.outofAAMrtb=false else @@ -491,6 +492,18 @@ function FLIGHTGROUP:SetOutOfAMMRTB(switch) return self end +--- Set if flight is out of Air-Ground-Missiles, flight goes RTB. +-- @param #FLIGHTGROUP self +-- @param #boolean switch If true or nil, flight goes RTB. If false, turn this off. +-- @return #FLIGHTGROUP self +function FLIGHTGROUP:SetOutOfAGMRTB(switch) + if switch==false then + self.outofAGMrtb=false + else + self.outofAGMrtb=true + end + return self +end --- Set if low fuel threshold is reached, flight tries to refuel at the neares tanker. -- @param #FLIGHTGROUP self @@ -1031,17 +1044,28 @@ function FLIGHTGROUP:onafterStatus(From, Event, To) self:FuelCritical() end - -- Out of AA Ammo? CAP, GCICAP, INTERCEPT + -- Out of AA Missiles? CAP, GCICAP, INTERCEPT local CurrIsCap = false + -- Out of AG Missiles? BAI, SEAD, CAS, STRIKE + local CurrIsA2G = false + -- Check AUFTRAG Type local CurrAuftrag = self:GetMissionCurrent() if CurrAuftrag then local CurrAuftragType = CurrAuftrag:GetType() if CurrAuftragType == "CAP" or CurrAuftragType == "GCICAP" or CurrAuftragType == "INTERCEPT" then CurrIsCap = true end + if CurrAuftragType == "BAI" or CurrAuftragType == "CAS" or CurrAuftragType == "SEAD" or CurrAuftragType == "STRIKE" then CurrIsA2G = true end end + + -- Check A2A if (not self:CanAirToAir(true)) and CurrIsCap then self:OutOfMissilesAA() end + -- Check A2G + if (not self:CanAirToGround(false)) and CurrIsA2G then + self:OutOfMissilesAG() + end + end --- @@ -2087,6 +2111,20 @@ function FLIGHTGROUP:onafterOutOfMissilesAA(From, Event, To) end end +--- On after "OutOfMissilesAG" event. +-- @param #FLIGHTGROUP self +-- @param #string From From state. +-- @param #string Event Event. +-- @param #string To To state. +function FLIGHTGROUP:onafterOutOfMissilesAG(From, Event, To) + self:I(self.lid.."Group is out of AG Missiles!") + if self.outofAGMrtb then + -- Back to destination or home. + local airbase=self.destbase or self.homebase + self:__RTB(-5,airbase) + end +end + --- Check if flight is done, i.e. -- -- * passed the final waypoint, From fa342a5b6bc4bae476f016a0bd6006b213262b0b Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 14 Apr 2021 23:42:36 +0200 Subject: [PATCH 4/4] ATIS v0.9.1 - DCS 2.7 weather presetss --- Moose Development/Moose/Ops/ATIS.lua | 100 ++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/ATIS.lua b/Moose Development/Moose/Ops/ATIS.lua index 044963a28..001b43f1b 100644 --- a/Moose Development/Moose/Ops/ATIS.lua +++ b/Moose Development/Moose/Ops/ATIS.lua @@ -7,7 +7,7 @@ -- * Wind direction and speed -- * Visibility -- * Cloud coverage, base and ceiling --- * Temprature +-- * Temperature -- * Dew point (approximate as there is no relative humidity in DCS yet) -- * Pressure QNH/QFE -- * Weather phenomena: rain, thunderstorm, fog, dust @@ -564,7 +564,7 @@ _ATIS={} --- ATIS class version. -- @field #string version -ATIS.version="0.9.0" +ATIS.version="0.9.1" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -1431,9 +1431,103 @@ function ATIS:onafterBroadcast(From, Event, To) local cloudceil=clouds.base+clouds.thickness local clouddens=clouds.density + -- Cloud preset (DCS 2.7) + local cloudspreset=clouds.preset or "Nothing" + -- Precepitation: 0=None, 1=Rain, 2=Thunderstorm, 3=Snow, 4=Snowstorm. - local precepitation=tonumber(clouds.iprecptns) + local precepitation=0 + if cloudspreset:find("Preset10") then + -- Scattered 5 + clouddens=4 + elseif cloudspreset:find("Preset11") then + -- Scattered 6 + clouddens=4 + elseif cloudspreset:find("Preset12") then + -- Scattered 7 + clouddens=4 + elseif cloudspreset:find("Preset13") then + -- Broken 1 + clouddens=7 + elseif cloudspreset:find("Preset14") then + -- Broken 2 + clouddens=7 + elseif cloudspreset:find("Preset15") then + -- Broken 3 + clouddens=7 + elseif cloudspreset:find("Preset16") then + -- Broken 4 + clouddens=7 + elseif cloudspreset:find("Preset17") then + -- Broken 5 + clouddens=7 + elseif cloudspreset:find("Preset18") then + -- Broken 6 + clouddens=7 + elseif cloudspreset:find("Preset19") then + -- Broken 7 + clouddens=7 + elseif cloudspreset:find("Preset20") then + -- Broken 8 + clouddens=7 + elseif cloudspreset:find("Preset21") then + -- Overcast 1 + clouddens=9 + elseif cloudspreset:find("Preset22") then + -- Overcast 2 + clouddens=9 + elseif cloudspreset:find("Preset23") then + -- Overcast 3 + clouddens=9 + elseif cloudspreset:find("Preset24") then + -- Overcast 4 + clouddens=9 + elseif cloudspreset:find("Preset25") then + -- Overcast 5 + clouddens=9 + elseif cloudspreset:find("Preset26") then + -- Overcast 6 + clouddens=9 + elseif cloudspreset:find("Preset27") then + -- Overcast 7 + clouddens=9 + elseif cloudspreset:find("Preset1") then + -- Light Scattered 1 + clouddens=1 + elseif cloudspreset:find("Preset2") then + -- Light Scattered 2 + clouddens=1 + elseif cloudspreset:find("Preset3") then + -- High Scattered 1 + clouddens=4 + elseif cloudspreset:find("Preset4") then + -- High Scattered 2 + clouddens=4 + elseif cloudspreset:find("Preset5") then + -- Scattered 1 + clouddens=4 + elseif cloudspreset:find("Preset6") then + -- Scattered 2 + clouddens=4 + elseif cloudspreset:find("Preset7") then + -- Scattered 3 + clouddens=4 + elseif cloudspreset:find("Preset8") then + -- High Scattered 3 + clouddens=4 + elseif cloudspreset:find("Preset9") then + -- Scattered 4 + clouddens=4 + elseif cloudspreset:find("RainyPreset") then + -- Overcast + Rain + clouddens=9 + if temperature>5 then + precepitation=1 -- rain + else + precepitation=3 -- snow + end + end + local CLOUDBASE=string.format("%d", UTILS.MetersToFeet(cloudbase)) local CLOUDCEIL=string.format("%d", UTILS.MetersToFeet(cloudceil))