mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-13 09:16:15 +00:00
Merge branch 'develop' into FF/Fox2
This commit is contained in:
@@ -1217,11 +1217,11 @@ do -- COORDINATE
|
|||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #number Speed (optional) Speed in km/h. The default speed is 20 km/h.
|
-- @param #number Speed (optional) Speed in km/h. The default speed is 20 km/h.
|
||||||
-- @param #string Formation (optional) The route point Formation, which is a text string that specifies exactly the Text in the Type of the route point, like "Vee", "Echelon Right".
|
-- @param #string Formation (optional) The route point Formation, which is a text string that specifies exactly the Text in the Type of the route point, like "Vee", "Echelon Right".
|
||||||
|
-- @param #table DCSTasks A table of DCS tasks that are executed at the waypoints. Mind the curly brackets {}!
|
||||||
-- @return #table The route point.
|
-- @return #table The route point.
|
||||||
function COORDINATE:WaypointGround( Speed, Formation )
|
function COORDINATE:WaypointGround( Speed, Formation, DCSTasks )
|
||||||
self:F2( { Formation, Speed } )
|
self:F2( { Formation, Speed } )
|
||||||
|
|
||||||
|
|
||||||
local RoutePoint = {}
|
local RoutePoint = {}
|
||||||
RoutePoint.x = self.x
|
RoutePoint.x = self.x
|
||||||
RoutePoint.y = self.z
|
RoutePoint.y = self.z
|
||||||
@@ -1244,12 +1244,10 @@ do -- COORDINATE
|
|||||||
-- }, -- end of ["params"]
|
-- }, -- end of ["params"]
|
||||||
-- }, -- end of ["task"]
|
-- }, -- end of ["task"]
|
||||||
|
|
||||||
|
|
||||||
RoutePoint.task = {}
|
RoutePoint.task = {}
|
||||||
RoutePoint.task.id = "ComboTask"
|
RoutePoint.task.id = "ComboTask"
|
||||||
RoutePoint.task.params = {}
|
RoutePoint.task.params = {}
|
||||||
RoutePoint.task.params.tasks = {}
|
RoutePoint.task.params.tasks = DCSTasks or {}
|
||||||
|
|
||||||
|
|
||||||
return RoutePoint
|
return RoutePoint
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -750,7 +750,7 @@ function ZONE_RADIUS:GetScannedUnits()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Count the number of different coalitions inside the zone.
|
--- Get a set of scanned units.
|
||||||
-- @param #ZONE_RADIUS self
|
-- @param #ZONE_RADIUS self
|
||||||
-- @return Core.Set#SET_UNIT Set of units and statics inside the zone.
|
-- @return Core.Set#SET_UNIT Set of units and statics inside the zone.
|
||||||
function ZONE_RADIUS:GetScannedSetUnit()
|
function ZONE_RADIUS:GetScannedSetUnit()
|
||||||
@@ -949,7 +949,6 @@ function ZONE_RADIUS:SearchZone( EvaluateFunction, ObjectCategories )
|
|||||||
|
|
||||||
local function EvaluateZone( ZoneDCSUnit )
|
local function EvaluateZone( ZoneDCSUnit )
|
||||||
|
|
||||||
--env.info( ZoneDCSUnit:getName() )
|
|
||||||
|
|
||||||
local ZoneUnit = UNIT:Find( ZoneDCSUnit )
|
local ZoneUnit = UNIT:Find( ZoneDCSUnit )
|
||||||
|
|
||||||
|
|||||||
@@ -874,16 +874,23 @@ do -- ZONE_CAPTURE_COALITION
|
|||||||
self:Capture()
|
self:Capture()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get red and blue unit sets.
|
-- Count stuff in zone.
|
||||||
local unitsetRed=self:GetScannedSetUnit():FilterCoalitions("red"):FilterActive(true):FilterOnce()
|
local unitset=self:GetScannedSetUnit()
|
||||||
local unitsetBlu=self:GetScannedSetUnit():FilterCoalitions("blue"):FilterActive(true):FilterOnce()
|
local nRed=0
|
||||||
|
local nBlue=0
|
||||||
-- Count number of units.
|
for _,object in pairs(unitset:GetSet()) do
|
||||||
local nRed=unitsetRed:Count()
|
local coal=object:GetCoalition()
|
||||||
local nBlu=unitsetBlu:Count()
|
if object:IsAlive() then
|
||||||
|
if coal==coalition.side.RED then
|
||||||
|
nRed=nRed+1
|
||||||
|
elseif coal==coalition.side.BLUE then
|
||||||
|
nBlue=nBlue+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Status text.
|
-- Status text.
|
||||||
local text=string.format("CAPTURE ZONE %s: Owner=%s (Previous=%s): #blue=%d, #red=%d, Status %s", self:GetZoneName(), self:GetCoalitionName(), UTILS.GetCoalitionName(self:GetPreviousCoalition()), nBlu, nRed, State)
|
local text=string.format("CAPTURE ZONE %s: Owner=%s (Previous=%s): #blue=%d, #red=%d, Status %s", self:GetZoneName(), self:GetCoalitionName(), UTILS.GetCoalitionName(self:GetPreviousCoalition()), nBlue, nRed, State)
|
||||||
local NewState = self:GetState()
|
local NewState = self:GetState()
|
||||||
if NewState~=State then
|
if NewState~=State then
|
||||||
text=text..string.format(" --> %s", NewState)
|
text=text..string.format(" --> %s", NewState)
|
||||||
|
|||||||
@@ -82,6 +82,8 @@
|
|||||||
-- @field #number runwaym2t Optional correction for magnetic to true runway heading conversion (and vice versa) in degrees.
|
-- @field #number runwaym2t Optional correction for magnetic to true runway heading conversion (and vice versa) in degrees.
|
||||||
-- @field #boolean windtrue Report true (from) heading of wind. Default is magnetic.
|
-- @field #boolean windtrue Report true (from) heading of wind. Default is magnetic.
|
||||||
-- @field #boolean altimeterQNH Report altimeter QNH.
|
-- @field #boolean altimeterQNH Report altimeter QNH.
|
||||||
|
-- @field #boolean usemarker Use mark on the F10 map.
|
||||||
|
-- @field #number markerid Numerical ID of the F10 map mark point.
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- *It is a very sad thing that nowadays there is so little useless information.* - Oscar Wilde
|
--- *It is a very sad thing that nowadays there is so little useless information.* - Oscar Wilde
|
||||||
@@ -241,6 +243,10 @@
|
|||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- **Note** that the default folder name is *ATIS Soundfiles/*. If you want to change it, you can use the @{#ATIS.SetSoundfilesPath}(*path*), where *path* is the path of the directory. This must end with a slash "/"!
|
-- **Note** that the default folder name is *ATIS Soundfiles/*. If you want to change it, you can use the @{#ATIS.SetSoundfilesPath}(*path*), where *path* is the path of the directory. This must end with a slash "/"!
|
||||||
|
--
|
||||||
|
-- # Marks on the F10 Map
|
||||||
|
--
|
||||||
|
-- You can place marks on the F10 map via the @{#ATIS.SetMapMarks}() function. These will contain info about the ATIS frequency, the currently active runway and some basic info about the weather (wind, pressure and temperature).
|
||||||
--
|
--
|
||||||
-- # Examples
|
-- # Examples
|
||||||
--
|
--
|
||||||
@@ -309,6 +315,8 @@ ATIS = {
|
|||||||
runwaym2t = nil,
|
runwaym2t = nil,
|
||||||
windtrue = nil,
|
windtrue = nil,
|
||||||
altimeterQNH = nil,
|
altimeterQNH = nil,
|
||||||
|
usemarker = nil,
|
||||||
|
markerid = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- NATO alphabet.
|
--- NATO alphabet.
|
||||||
@@ -570,6 +578,7 @@ function ATIS:New(airbasename, frequency, modulation)
|
|||||||
self:SetRunwayCorrectionMagnetic2True()
|
self:SetRunwayCorrectionMagnetic2True()
|
||||||
self:SetRadioPower()
|
self:SetRadioPower()
|
||||||
self:SetAltimeterQNH(true)
|
self:SetAltimeterQNH(true)
|
||||||
|
self:SetMapMarks(false)
|
||||||
|
|
||||||
-- Start State.
|
-- Start State.
|
||||||
self:SetStartState("Stopped")
|
self:SetStartState("Stopped")
|
||||||
@@ -687,6 +696,19 @@ function ATIS:SetRadioPower(power)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Use F10 map mark points.
|
||||||
|
-- @param #ATIS self
|
||||||
|
-- @param #boolean switch If *true* or *nil*, marks are placed on F10 map. If *false* this feature is set to off (default).
|
||||||
|
-- @return #ATIS self
|
||||||
|
function ATIS:SetMapMarks(switch)
|
||||||
|
if switch==nil or switch==true then
|
||||||
|
self.usemarker=true
|
||||||
|
else
|
||||||
|
self.usemarker=false
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set magnetic runway headings as depicted on the runway, *e.g.* "13" for 130° or "25L" for the left runway with magnetic heading 250°.
|
--- Set magnetic runway headings as depicted on the runway, *e.g.* "13" for 130° or "25L" for the left runway with magnetic heading 250°.
|
||||||
-- @param #ATIS self
|
-- @param #ATIS self
|
||||||
-- @param #table headings Magnetic headings. Inverse (-180°) headings are added automatically. You only need to specify one heading per runway direction. "L"eft and "R" right can also be appended.
|
-- @param #table headings Magnetic headings. Inverse (-180°) headings are added automatically. You only need to specify one heading per runway direction. "L"eft and "R" right can also be appended.
|
||||||
@@ -955,6 +977,12 @@ end
|
|||||||
-- @param #ATIS self
|
-- @param #ATIS self
|
||||||
function ATIS:onafterStart(From, Event, To)
|
function ATIS:onafterStart(From, Event, To)
|
||||||
|
|
||||||
|
-- Check that this is an airdrome.
|
||||||
|
if self.airbase:GetAirbaseCategory()~=Airbase.Category.AIRDROME then
|
||||||
|
self:E(self.lid..string.format("ERROR: Cannot start ATIS for airbase %s! Only AIRDROMES are supported but NOT FARPS or SHIPS.", self.airbasename))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- Info.
|
-- Info.
|
||||||
self:I(self.lid..string.format("Starting ATIS v%s for airbase %s on %.3f MHz Modulation=%d", ATIS.version, self.airbasename, self.frequency, self.modulation))
|
self:I(self.lid..string.format("Starting ATIS v%s for airbase %s on %.3f MHz Modulation=%d", ATIS.version, self.airbasename, self.frequency, self.modulation))
|
||||||
|
|
||||||
@@ -1315,6 +1343,7 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
|
|
||||||
-- Information tag
|
-- Information tag
|
||||||
subtitle=string.format("Information %s", NATO)
|
subtitle=string.format("Information %s", NATO)
|
||||||
|
local _INFORMATION=subtitle
|
||||||
self:Transmission(ATIS.Sound.Information, 0.5, subtitle)
|
self:Transmission(ATIS.Sound.Information, 0.5, subtitle)
|
||||||
self.radioqueue:NewTransmission(string.format("NATO Alphabet/%s.ogg", NATO), 0.75, self.soundpath)
|
self.radioqueue:NewTransmission(string.format("NATO Alphabet/%s.ogg", NATO), 0.75, self.soundpath)
|
||||||
|
|
||||||
@@ -1436,6 +1465,7 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
subtitle=string.format("Altimeter QNH %s.%s, QFE %s.%s inHg", QNH[1], QNH[2], QFE[1], QFE[2])
|
subtitle=string.format("Altimeter QNH %s.%s, QFE %s.%s inHg", QNH[1], QNH[2], QFE[1], QFE[2])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local _ALTIMETER=subtitle
|
||||||
self:Transmission(ATIS.Sound.Altimeter, 1.0, subtitle)
|
self:Transmission(ATIS.Sound.Altimeter, 1.0, subtitle)
|
||||||
self:Transmission(ATIS.Sound.QNH, 0.5)
|
self:Transmission(ATIS.Sound.QNH, 0.5)
|
||||||
self.radioqueue:Number2Transmission(QNH[1])
|
self.radioqueue:Number2Transmission(QNH[1])
|
||||||
@@ -1469,6 +1499,7 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
subtitle=string.format("Temperature %s °C", TEMPERATURE)
|
subtitle=string.format("Temperature %s °C", TEMPERATURE)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local _TEMPERATURE=subtitle
|
||||||
self:Transmission(ATIS.Sound.Temperature, 1.0, subtitle)
|
self:Transmission(ATIS.Sound.Temperature, 1.0, subtitle)
|
||||||
if temperature<0 then
|
if temperature<0 then
|
||||||
self:Transmission(ATIS.Sound.Minus, 0.2)
|
self:Transmission(ATIS.Sound.Minus, 0.2)
|
||||||
@@ -1489,6 +1520,7 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
if turbulence>0 then
|
if turbulence>0 then
|
||||||
subtitle=subtitle..", gusting"
|
subtitle=subtitle..", gusting"
|
||||||
end
|
end
|
||||||
|
local _WIND=subtitle
|
||||||
self:Transmission(ATIS.Sound.WindFrom, 1.0, subtitle)
|
self:Transmission(ATIS.Sound.WindFrom, 1.0, subtitle)
|
||||||
self.radioqueue:Number2Transmission(WINDFROM)
|
self.radioqueue:Number2Transmission(WINDFROM)
|
||||||
self:Transmission(ATIS.Sound.At, 0.2)
|
self:Transmission(ATIS.Sound.At, 0.2)
|
||||||
@@ -1509,6 +1541,7 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
elseif rwyLeft==false then
|
elseif rwyLeft==false then
|
||||||
subtitle=subtitle.." Right"
|
subtitle=subtitle.." Right"
|
||||||
end
|
end
|
||||||
|
local _RUNACT=subtitle
|
||||||
self:Transmission(ATIS.Sound.ActiveRunway, 1.0, subtitle)
|
self:Transmission(ATIS.Sound.ActiveRunway, 1.0, subtitle)
|
||||||
self.radioqueue:Number2Transmission(runway)
|
self.radioqueue:Number2Transmission(runway)
|
||||||
if rwyLeft==true then
|
if rwyLeft==true then
|
||||||
@@ -1536,7 +1569,7 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
subtitle=subtitle.." feet"
|
subtitle=subtitle.." feet"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Transmitt.
|
-- Transmit.
|
||||||
self:Transmission(ATIS.Sound.RunwayLength, 1.0, subtitle)
|
self:Transmission(ATIS.Sound.RunwayLength, 1.0, subtitle)
|
||||||
if tonumber(L1000)>0 then
|
if tonumber(L1000)>0 then
|
||||||
self.radioqueue:Number2Transmission(L1000)
|
self.radioqueue:Number2Transmission(L1000)
|
||||||
@@ -1700,9 +1733,41 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
subtitle=string.format("End of information %s", NATO)
|
subtitle=string.format("End of information %s", NATO)
|
||||||
self:Transmission(ATIS.Sound.EndOfInformation, 0.5, subtitle)
|
self:Transmission(ATIS.Sound.EndOfInformation, 0.5, subtitle)
|
||||||
self.radioqueue:NewTransmission(string.format("NATO Alphabet/%s.ogg", NATO), 0.75, self.soundpath)
|
self.radioqueue:NewTransmission(string.format("NATO Alphabet/%s.ogg", NATO), 0.75, self.soundpath)
|
||||||
|
|
||||||
|
-- Update F10 marker.
|
||||||
|
if self.usemarker then
|
||||||
|
self:UpdateMarker(_INFORMATION, _RUNACT, _WIND, _ALTIMETER, _TEMPERATURE)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Update F10 map marker.
|
||||||
|
-- @param #ATIS self
|
||||||
|
-- @param #string information Information tag text.
|
||||||
|
-- @param #string runact Active runway text.
|
||||||
|
-- @param #string wind Wind text.
|
||||||
|
-- @param #string altimeter Altimeter text.
|
||||||
|
-- @param #string temperature Temperature text.
|
||||||
|
-- @return #number Marker ID.
|
||||||
|
function ATIS:UpdateMarker(information, runact, wind, altimeter, temperature)
|
||||||
|
|
||||||
|
if self.markerid then
|
||||||
|
self.airbase:GetCoordinate():RemoveMark(self.markerid)
|
||||||
|
end
|
||||||
|
|
||||||
|
local text=string.format("ATIS on %.3f %s, %s:\n", self.frequency, UTILS.GetModulationName(self.modulation), tostring(information))
|
||||||
|
text=text..string.format("%s\n", tostring(runact))
|
||||||
|
text=text..string.format("%s\n", tostring(wind))
|
||||||
|
text=text..string.format("%s\n", tostring(altimeter))
|
||||||
|
text=text..string.format("%s", tostring(temperature))
|
||||||
|
-- More info is not displayed on the marker!
|
||||||
|
|
||||||
|
-- Place new mark
|
||||||
|
self.markerid=self.airbase:GetCoordinate():MarkToAll(text, true)
|
||||||
|
|
||||||
|
return self.markerid
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- Misc Functions
|
-- Misc Functions
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -2384,6 +2384,7 @@ do -- Route methods
|
|||||||
|
|
||||||
local FromCoordinate = self:GetCoordinate()
|
local FromCoordinate = self:GetCoordinate()
|
||||||
|
|
||||||
|
--local FromWP = FromCoordinate:WaypointGround()
|
||||||
local FromWP = FromCoordinate:WaypointGround(Speed, Formation)
|
local FromWP = FromCoordinate:WaypointGround(Speed, Formation)
|
||||||
local ToWP = ToCoordinate:WaypointGround( Speed, Formation )
|
local ToWP = ToCoordinate:WaypointGround( Speed, Formation )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user