mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'develop' into FF/Ops
This commit is contained in:
commit
e50fc00583
@ -7,7 +7,7 @@
|
|||||||
-- * Wind direction and speed
|
-- * Wind direction and speed
|
||||||
-- * Visibility
|
-- * Visibility
|
||||||
-- * Cloud coverage, base and ceiling
|
-- * Cloud coverage, base and ceiling
|
||||||
-- * Temprature
|
-- * Temperature
|
||||||
-- * Dew point (approximate as there is no relative humidity in DCS yet)
|
-- * Dew point (approximate as there is no relative humidity in DCS yet)
|
||||||
-- * Pressure QNH/QFE
|
-- * Pressure QNH/QFE
|
||||||
-- * Weather phenomena: rain, thunderstorm, fog, dust
|
-- * Weather phenomena: rain, thunderstorm, fog, dust
|
||||||
@ -564,7 +564,7 @@ _ATIS={}
|
|||||||
|
|
||||||
--- ATIS class version.
|
--- ATIS class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
ATIS.version="0.9.0"
|
ATIS.version="0.9.1"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@ -1431,8 +1431,102 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
local cloudceil=clouds.base+clouds.thickness
|
local cloudceil=clouds.base+clouds.thickness
|
||||||
local clouddens=clouds.density
|
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.
|
-- 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 CLOUDBASE=string.format("%d", UTILS.MetersToFeet(cloudbase))
|
||||||
local CLOUDCEIL=string.format("%d", UTILS.MetersToFeet(cloudceil))
|
local CLOUDCEIL=string.format("%d", UTILS.MetersToFeet(cloudceil))
|
||||||
|
|||||||
@ -135,6 +135,8 @@ FLIGHTGROUP = {
|
|||||||
fuelcritical = nil,
|
fuelcritical = nil,
|
||||||
fuelcriticalthresh = nil,
|
fuelcriticalthresh = nil,
|
||||||
fuelcriticalrtb = false,
|
fuelcriticalrtb = false,
|
||||||
|
outofAAMrtb = true,
|
||||||
|
outofAGMrtb = true,
|
||||||
squadron = nil,
|
squadron = nil,
|
||||||
flightcontrol = nil,
|
flightcontrol = nil,
|
||||||
flaghold = nil,
|
flaghold = nil,
|
||||||
@ -255,9 +257,9 @@ function FLIGHTGROUP:New(group)
|
|||||||
self:AddTransition("*", "FuelLow", "*") -- Fuel state of group is low. Default ~25%.
|
self:AddTransition("*", "FuelLow", "*") -- Fuel state of group is low. Default ~25%.
|
||||||
self:AddTransition("*", "FuelCritical", "*") -- Fuel state of group is critical. Default ~10%.
|
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("*", "OutOfMissilesAA", "*") -- Group is out of A2A missiles.
|
||||||
self:AddTransition("*", "OutOfMissilesAG", "*") -- Group is out of A2G missiles. Not implemented yet!
|
self:AddTransition("*", "OutOfMissilesAG", "*") -- Group is out of A2G missiles.
|
||||||
self:AddTransition("*", "OutOfMissilesAS", "*") -- Group is out of A2G missiles. Not implemented yet!
|
self:AddTransition("*", "OutOfMissilesAS", "*") -- Group is out of A2S(ship) missiles. Not implemented yet!
|
||||||
|
|
||||||
self:AddTransition("Airborne", "EngageTarget", "Engaging") -- Engage targets.
|
self:AddTransition("Airborne", "EngageTarget", "Engaging") -- Engage targets.
|
||||||
self:AddTransition("Engaging", "Disengage", "Airborne") -- Engagement over.
|
self:AddTransition("Engaging", "Disengage", "Airborne") -- Engagement over.
|
||||||
@ -458,6 +460,32 @@ function FLIGHTGROUP:SetFuelLowRTB(switch)
|
|||||||
return self
|
return self
|
||||||
end
|
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:SetOutOfAAMRTB(switch)
|
||||||
|
if switch==false then
|
||||||
|
self.outofAAMrtb=false
|
||||||
|
else
|
||||||
|
self.outofAAMrtb=true
|
||||||
|
end
|
||||||
|
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.
|
--- Set if low fuel threshold is reached, flight tries to refuel at the neares tanker.
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
-- @param #boolean switch If true or nil, flight goes for refuelling. If false, turn this off.
|
-- @param #boolean switch If true or nil, flight goes for refuelling. If false, turn this off.
|
||||||
@ -1004,6 +1032,28 @@ function FLIGHTGROUP:onafterStatus(From, Event, To)
|
|||||||
self:FuelCritical()
|
self:FuelCritical()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 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
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -2021,6 +2071,54 @@ function FLIGHTGROUP:onafterUpdateRoute(From, Event, To, n)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- On after "Respawn" event.
|
||||||
|
-- @param #FLIGHTGROUP self
|
||||||
|
-- @param #string From From state.
|
||||||
|
-- @param #string Event Event.
|
||||||
|
-- @param #string To To state.
|
||||||
|
-- @param #table Template The template used to respawn the group.
|
||||||
|
function FLIGHTGROUP:onafterRespawn(From, Event, To, Template)
|
||||||
|
|
||||||
|
self:T(self.lid.."Respawning group!")
|
||||||
|
|
||||||
|
local template=UTILS.DeepCopy(Template or self.template)
|
||||||
|
|
||||||
|
if self.group and self.group:InAir() then
|
||||||
|
template.lateActivation=false
|
||||||
|
self.respawning=true
|
||||||
|
self.group=self.group:Respawn(template)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--- On after "OutOfMissilesAA" event.
|
||||||
|
-- @param #FLIGHTGROUP self
|
||||||
|
-- @param #string From From state.
|
||||||
|
-- @param #string Event Event.
|
||||||
|
-- @param #string To To state.
|
||||||
|
function FLIGHTGROUP:onafterOutOfMissilesAA(From, Event, To)
|
||||||
|
self:I(self.lid.."Group is out of AA Missiles!")
|
||||||
|
if self.outofAAMrtb then
|
||||||
|
-- Back to destination or home.
|
||||||
|
local airbase=self.destbase or self.homebase
|
||||||
|
self:__RTB(-5,airbase)
|
||||||
|
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.
|
--- Check if flight is done, i.e.
|
||||||
--
|
--
|
||||||
-- * passed the final waypoint,
|
-- * passed the final waypoint,
|
||||||
@ -2141,9 +2239,15 @@ function FLIGHTGROUP:onbeforeRTB(From, Event, To, airbase, SpeedTo, SpeedHold)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not self.group:IsAirborne(true) then
|
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
|
allowed=false
|
||||||
Tsuspend=-10
|
Tsuspend=-20
|
||||||
|
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
|
end
|
||||||
|
|
||||||
-- Only if fuel is not low or critical.
|
-- Only if fuel is not low or critical.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user