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,9 +1431,103 @@ 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,
|
||||||
@ -241,7 +243,7 @@ function FLIGHTGROUP:New(group)
|
|||||||
|
|
||||||
-- Add FSM transitions.
|
-- Add FSM transitions.
|
||||||
-- From State --> Event --> To State
|
-- From State --> Event --> To State
|
||||||
self:AddTransition("*", "LandAtAirbase", "Inbound") -- Helo group is ordered to land at a specific point.
|
self:AddTransition("*", "LandAtAirbase", "Inbound") -- Helo group is ordered to land at a specific point.
|
||||||
self:AddTransition("*", "RTB", "Inbound") -- Group is returning to destination base.
|
self:AddTransition("*", "RTB", "Inbound") -- Group is returning to destination base.
|
||||||
self:AddTransition("*", "RTZ", "Inbound") -- Group is returning to destination zone. Not implemented yet!
|
self:AddTransition("*", "RTZ", "Inbound") -- Group is returning to destination zone. Not implemented yet!
|
||||||
self:AddTransition("Inbound", "Holding", "Holding") -- Group is in holding pattern.
|
self:AddTransition("Inbound", "Holding", "Holding") -- Group is in holding pattern.
|
||||||
@ -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.
|
||||||
@ -690,14 +718,14 @@ function FLIGHTGROUP:StartUncontrolled(delay)
|
|||||||
else
|
else
|
||||||
|
|
||||||
local alive=self:IsAlive()
|
local alive=self:IsAlive()
|
||||||
|
|
||||||
if alive~=nil then
|
if alive~=nil then
|
||||||
-- Check if group is already active.
|
-- Check if group is already active.
|
||||||
local _delay=0
|
local _delay=0
|
||||||
if alive==false then
|
if alive==false then
|
||||||
self:Activate()
|
self:Activate()
|
||||||
_delay=1
|
_delay=1
|
||||||
end
|
end
|
||||||
self:I(self.lid.."Starting uncontrolled group")
|
self:I(self.lid.."Starting uncontrolled group")
|
||||||
self.group:StartUncontrolled(_delay)
|
self.group:StartUncontrolled(_delay)
|
||||||
self.isUncontrolled=true
|
self.isUncontrolled=true
|
||||||
@ -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
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -1103,7 +1153,7 @@ function FLIGHTGROUP:onafterStatus(From, Event, To)
|
|||||||
---
|
---
|
||||||
-- Cargo
|
-- Cargo
|
||||||
---
|
---
|
||||||
|
|
||||||
self:_CheckCargoTransport()
|
self:_CheckCargoTransport()
|
||||||
|
|
||||||
|
|
||||||
@ -1529,7 +1579,7 @@ function FLIGHTGROUP:onafterSpawned(From, Event, To)
|
|||||||
|
|
||||||
-- Update position.
|
-- Update position.
|
||||||
self:_UpdatePosition()
|
self:_UpdatePosition()
|
||||||
|
|
||||||
-- Not dead or destroyed yet.
|
-- Not dead or destroyed yet.
|
||||||
self.isDead=false
|
self.isDead=false
|
||||||
self.isDestroyed=false
|
self.isDestroyed=false
|
||||||
@ -1567,7 +1617,7 @@ function FLIGHTGROUP:onafterSpawned(From, Event, To)
|
|||||||
self:GetGroup():SetOption(AI.Option.Air.id.PROHIBIT_AB, true) -- Does not seem to work. AI still used the after burner.
|
self:GetGroup():SetOption(AI.Option.Air.id.PROHIBIT_AB, true) -- Does not seem to work. AI still used the after burner.
|
||||||
self:GetGroup():SetOption(AI.Option.Air.id.RTB_ON_BINGO, false)
|
self:GetGroup():SetOption(AI.Option.Air.id.RTB_ON_BINGO, false)
|
||||||
--self.group:SetOption(AI.Option.Air.id.RADAR_USING, AI.Option.Air.val.RADAR_USING.FOR_CONTINUOUS_SEARCH)
|
--self.group:SetOption(AI.Option.Air.id.RADAR_USING, AI.Option.Air.val.RADAR_USING.FOR_CONTINUOUS_SEARCH)
|
||||||
|
|
||||||
-- Update status.
|
-- Update status.
|
||||||
self:__Status(-0.1)
|
self:__Status(-0.1)
|
||||||
|
|
||||||
@ -1675,7 +1725,7 @@ end
|
|||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
function FLIGHTGROUP:onafterAirborne(From, Event, To)
|
function FLIGHTGROUP:onafterAirborne(From, Event, To)
|
||||||
self:T(self.lid..string.format("Flight airborne"))
|
self:T(self.lid..string.format("Flight airborne"))
|
||||||
|
|
||||||
-- No current airbase any more.
|
-- No current airbase any more.
|
||||||
self.currbase=nil
|
self.currbase=nil
|
||||||
|
|
||||||
@ -1734,14 +1784,14 @@ end
|
|||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
function FLIGHTGROUP:onafterLandedAt(From, Event, To)
|
function FLIGHTGROUP:onafterLandedAt(From, Event, To)
|
||||||
self:T(self.lid..string.format("Flight landed at"))
|
self:T(self.lid..string.format("Flight landed at"))
|
||||||
|
|
||||||
-- Trigger (un-)loading process.
|
-- Trigger (un-)loading process.
|
||||||
if self:IsPickingup() then
|
if self:IsPickingup() then
|
||||||
self:__Loading(-1)
|
self:__Loading(-1)
|
||||||
elseif self:IsTransporting() then
|
elseif self:IsTransporting() then
|
||||||
self:__Unloading(-1)
|
self:__Unloading(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "Arrived" event.
|
--- On after "Arrived" event.
|
||||||
@ -1762,17 +1812,17 @@ function FLIGHTGROUP:onafterArrived(From, Event, To)
|
|||||||
if self.airwing then
|
if self.airwing then
|
||||||
-- Let airwing do its thing.
|
-- Let airwing do its thing.
|
||||||
elseif self.isLandingAtAirbase then
|
elseif self.isLandingAtAirbase then
|
||||||
|
|
||||||
local Template=UTILS.DeepCopy(self.template) --DCS#Template
|
local Template=UTILS.DeepCopy(self.template) --DCS#Template
|
||||||
|
|
||||||
-- No late activation.
|
-- No late activation.
|
||||||
self.isLateActivated=false
|
self.isLateActivated=false
|
||||||
Template.lateActivation=self.isLateActivated
|
Template.lateActivation=self.isLateActivated
|
||||||
|
|
||||||
-- Spawn in uncontrolled state.
|
-- Spawn in uncontrolled state.
|
||||||
self.isUncontrolled=true
|
self.isUncontrolled=true
|
||||||
Template.uncontrolled=self.isUncontrolled
|
Template.uncontrolled=self.isUncontrolled
|
||||||
|
|
||||||
-- First waypoint of the group.
|
-- First waypoint of the group.
|
||||||
local SpawnPoint=Template.route.points[1]
|
local SpawnPoint=Template.route.points[1]
|
||||||
|
|
||||||
@ -1780,13 +1830,13 @@ function FLIGHTGROUP:onafterArrived(From, Event, To)
|
|||||||
SpawnPoint.linkUnit = nil
|
SpawnPoint.linkUnit = nil
|
||||||
SpawnPoint.helipadId = nil
|
SpawnPoint.helipadId = nil
|
||||||
SpawnPoint.airdromeId = nil
|
SpawnPoint.airdromeId = nil
|
||||||
|
|
||||||
-- Airbase.
|
-- Airbase.
|
||||||
local airbase=self.isLandingAtAirbase
|
local airbase=self.isLandingAtAirbase
|
||||||
|
|
||||||
-- Get airbase ID and category.
|
-- Get airbase ID and category.
|
||||||
local AirbaseID = airbase:GetID()
|
local AirbaseID = airbase:GetID()
|
||||||
|
|
||||||
-- Set airdromeId.
|
-- Set airdromeId.
|
||||||
if airbase:IsShip() then
|
if airbase:IsShip() then
|
||||||
SpawnPoint.linkUnit = AirbaseID
|
SpawnPoint.linkUnit = AirbaseID
|
||||||
@ -1801,10 +1851,10 @@ function FLIGHTGROUP:onafterArrived(From, Event, To)
|
|||||||
-- Set waypoint type/action.
|
-- Set waypoint type/action.
|
||||||
SpawnPoint.alt = 0
|
SpawnPoint.alt = 0
|
||||||
SpawnPoint.type = COORDINATE.WaypointType.TakeOffParking
|
SpawnPoint.type = COORDINATE.WaypointType.TakeOffParking
|
||||||
SpawnPoint.action = COORDINATE.WaypointAction.FromParkingArea
|
SpawnPoint.action = COORDINATE.WaypointAction.FromParkingArea
|
||||||
|
|
||||||
local units=Template.units
|
local units=Template.units
|
||||||
|
|
||||||
for i=#units,1,-1 do
|
for i=#units,1,-1 do
|
||||||
local unit=units[i]
|
local unit=units[i]
|
||||||
local element=self:GetElementByName(unit.name)
|
local element=self:GetElementByName(unit.name)
|
||||||
@ -1817,25 +1867,25 @@ function FLIGHTGROUP:onafterArrived(From, Event, To)
|
|||||||
unit.y=vec3.z
|
unit.y=vec3.z
|
||||||
unit.alt=vec3.y
|
unit.alt=vec3.y
|
||||||
unit.heading=math.rad(heading)
|
unit.heading=math.rad(heading)
|
||||||
unit.psi=-unit.heading
|
unit.psi=-unit.heading
|
||||||
else
|
else
|
||||||
table.remove(units, i)
|
table.remove(units, i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Respawn with this template.
|
-- Respawn with this template.
|
||||||
self:_Respawn(0, Template)
|
self:_Respawn(0, Template)
|
||||||
|
|
||||||
-- Reset.
|
-- Reset.
|
||||||
self.isLandingAtAirbase=nil
|
self.isLandingAtAirbase=nil
|
||||||
|
|
||||||
-- Init (un-)loading process.
|
-- Init (un-)loading process.
|
||||||
if self:IsPickingup() then
|
if self:IsPickingup() then
|
||||||
self:__Loading(-1)
|
self:__Loading(-1)
|
||||||
elseif self:IsTransporting() then
|
elseif self:IsTransporting() then
|
||||||
self:__Unloading(-1)
|
self:__Unloading(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
-- Depawn after 5 min. Important to trigger dead events before DCS despawns on its own without any notification.
|
-- Depawn after 5 min. Important to trigger dead events before DCS despawns on its own without any notification.
|
||||||
self:Despawn(5*60)
|
self:Despawn(5*60)
|
||||||
@ -1976,7 +2026,7 @@ function FLIGHTGROUP:onafterUpdateRoute(From, Event, To, n)
|
|||||||
|
|
||||||
-- Current velocity.
|
-- Current velocity.
|
||||||
local speed=self.group and self.group:GetVelocityKMH() or 100
|
local speed=self.group and self.group:GetVelocityKMH() or 100
|
||||||
|
|
||||||
-- Waypoint type.
|
-- Waypoint type.
|
||||||
local waypointType=COORDINATE.WaypointType.TurningPoint
|
local waypointType=COORDINATE.WaypointType.TurningPoint
|
||||||
if self:IsLanded() or self:IsLandedAt() or self:IsAirborne()==false then
|
if self:IsLanded() or self:IsLandedAt() or self:IsAirborne()==false then
|
||||||
@ -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,
|
||||||
@ -2039,7 +2137,7 @@ function FLIGHTGROUP:_CheckGroupDone(delay)
|
|||||||
-- Delayed call.
|
-- Delayed call.
|
||||||
self:ScheduleOnce(delay, FLIGHTGROUP._CheckGroupDone, self)
|
self:ScheduleOnce(delay, FLIGHTGROUP._CheckGroupDone, self)
|
||||||
else
|
else
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(self.lid.."Check group done?")
|
self:T(self.lid.."Check group done?")
|
||||||
|
|
||||||
@ -2054,7 +2152,7 @@ function FLIGHTGROUP:_CheckGroupDone(delay)
|
|||||||
self:T(self.lid.."Engaging! Group NOT done...")
|
self:T(self.lid.."Engaging! Group NOT done...")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Group is ordered to land at an airbase.
|
-- Group is ordered to land at an airbase.
|
||||||
if self.isLandingAtAirbase then
|
if self.isLandingAtAirbase then
|
||||||
self:T(self.lid.."Landing at airbase! Group NOT done...")
|
self:T(self.lid.."Landing at airbase! Group NOT done...")
|
||||||
@ -2066,10 +2164,10 @@ function FLIGHTGROUP:_CheckGroupDone(delay)
|
|||||||
|
|
||||||
-- Number of mission remaining.
|
-- Number of mission remaining.
|
||||||
local nMissions=self:CountRemainingMissison()
|
local nMissions=self:CountRemainingMissison()
|
||||||
|
|
||||||
-- Number of cargo transports remaining.
|
-- Number of cargo transports remaining.
|
||||||
local nTransports=self:CountRemainingTransports()
|
local nTransports=self:CountRemainingTransports()
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(self.lid..string.format("Remaining (final=%s): missions=%d, tasks=%d, transports=%d", tostring(self.passedfinalwp), nMissions, nTasks, nTransports))
|
self:T(self.lid..string.format("Remaining (final=%s): missions=%d, tasks=%d, transports=%d", tostring(self.passedfinalwp), nMissions, nTasks, nTransports))
|
||||||
|
|
||||||
@ -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.
|
||||||
@ -2249,9 +2353,9 @@ function FLIGHTGROUP:_LandAtAirbase(airbase, SpeedTo, SpeedHold, SpeedLand)
|
|||||||
SpeedTo=SpeedTo or UTILS.KmphToKnots(self.speedCruise)
|
SpeedTo=SpeedTo or UTILS.KmphToKnots(self.speedCruise)
|
||||||
SpeedHold=SpeedHold or (self.isHelo and 80 or 250)
|
SpeedHold=SpeedHold or (self.isHelo and 80 or 250)
|
||||||
SpeedLand=SpeedLand or (self.isHelo and 40 or 170)
|
SpeedLand=SpeedLand or (self.isHelo and 40 or 170)
|
||||||
|
|
||||||
-- Clear holding time in any case.
|
-- Clear holding time in any case.
|
||||||
self.Tholding=nil
|
self.Tholding=nil
|
||||||
|
|
||||||
-- Debug message.
|
-- Debug message.
|
||||||
local text=string.format("Flight group set to hold at airbase %s. SpeedTo=%d, SpeedHold=%d, SpeedLand=%d", airbase:GetName(), SpeedTo, SpeedHold, SpeedLand)
|
local text=string.format("Flight group set to hold at airbase %s. SpeedTo=%d, SpeedHold=%d, SpeedLand=%d", airbase:GetName(), SpeedTo, SpeedHold, SpeedLand)
|
||||||
@ -2757,7 +2861,7 @@ function FLIGHTGROUP:onafterStop(From, Event, To)
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self.currbase=nil
|
self.currbase=nil
|
||||||
|
|
||||||
-- Handle events:
|
-- Handle events:
|
||||||
@ -2773,7 +2877,7 @@ function FLIGHTGROUP:onafterStop(From, Event, To)
|
|||||||
|
|
||||||
-- Call OPSGROUP function.
|
-- Call OPSGROUP function.
|
||||||
self:GetParent(self).onafterStop(self, From, Event, To)
|
self:GetParent(self).onafterStop(self, From, Event, To)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -2938,7 +3042,7 @@ function FLIGHTGROUP:_InitGroup()
|
|||||||
text=text..string.format("Range max = %.1f km\n", self.rangemax/1000)
|
text=text..string.format("Range max = %.1f km\n", self.rangemax/1000)
|
||||||
text=text..string.format("Ceiling = %.1f feet\n", UTILS.MetersToFeet(self.ceiling))
|
text=text..string.format("Ceiling = %.1f feet\n", UTILS.MetersToFeet(self.ceiling))
|
||||||
text=text..string.format("Weight = %.1f kg\n", self:GetWeightTotal())
|
text=text..string.format("Weight = %.1f kg\n", self:GetWeightTotal())
|
||||||
text=text..string.format("Cargo bay = %.1f kg\n", self:GetFreeCargobay())
|
text=text..string.format("Cargo bay = %.1f kg\n", self:GetFreeCargobay())
|
||||||
text=text..string.format("Tanker type = %s\n", tostring(self.tankertype))
|
text=text..string.format("Tanker type = %s\n", tostring(self.tankertype))
|
||||||
text=text..string.format("Refuel type = %s\n", tostring(self.refueltype))
|
text=text..string.format("Refuel type = %s\n", tostring(self.refueltype))
|
||||||
text=text..string.format("AI = %s\n", tostring(self.isAI))
|
text=text..string.format("AI = %s\n", tostring(self.isAI))
|
||||||
@ -2957,7 +3061,7 @@ function FLIGHTGROUP:_InitGroup()
|
|||||||
text=text..string.format("Start Rwy = %s\n", tostring(self:IsTakeoffRunway()))
|
text=text..string.format("Start Rwy = %s\n", tostring(self:IsTakeoffRunway()))
|
||||||
self:I(self.lid..text)
|
self:I(self.lid..text)
|
||||||
end
|
end
|
||||||
|
|
||||||
env.info("DCS Unit BOOM_AND_RECEPTACLE="..tostring(Unit.RefuelingSystem.BOOM_AND_RECEPTACLE))
|
env.info("DCS Unit BOOM_AND_RECEPTACLE="..tostring(Unit.RefuelingSystem.BOOM_AND_RECEPTACLE))
|
||||||
env.info("DCS Unit PROBE_AND_DROGUE="..tostring(Unit.RefuelingSystem.PROBE_AND_DROGUE))
|
env.info("DCS Unit PROBE_AND_DROGUE="..tostring(Unit.RefuelingSystem.PROBE_AND_DROGUE))
|
||||||
|
|
||||||
@ -3602,7 +3706,7 @@ function FLIGHTGROUP:GetParkingSpot(element, maxdist, airbase)
|
|||||||
|
|
||||||
-- TODO: replace by airbase.parking if AIRBASE is updated.
|
-- TODO: replace by airbase.parking if AIRBASE is updated.
|
||||||
local parking=airbase:GetParkingSpotsTable()
|
local parking=airbase:GetParkingSpotsTable()
|
||||||
|
|
||||||
-- If airbase is ship, translate parking coords. Alternatively, we just move the coordinate of the unit to the origin of the map, which is way more efficient.
|
-- If airbase is ship, translate parking coords. Alternatively, we just move the coordinate of the unit to the origin of the map, which is way more efficient.
|
||||||
if airbase and airbase:IsShip() then
|
if airbase and airbase:IsShip() then
|
||||||
coord.x=0
|
coord.x=0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user