AIRBOSS v0.8.0

This commit is contained in:
Frank 2019-01-10 17:26:37 +01:00
parent acd6e0f423
commit 47dd068655
5 changed files with 1435 additions and 585 deletions

View File

@ -322,6 +322,9 @@ function SPAWN:New( SpawnTemplatePrefix )
self.Grouping = nil -- No grouping.
self.SpawnInitLivery = nil -- No special livery.
self.SpawnInitSkill = nil -- No special skill.
self.SpawnInitFreq = nil -- No special frequency.
self.SpawnInitModu = nil -- No special modulation.
self.SpawnInitRadio = nil -- No radio comms setting.
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
else
@ -370,6 +373,9 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
self.Grouping = nil -- No grouping.
self.SpawnInitLivery = nil -- No special livery.
self.SpawnInitSkill = nil -- No special skill.
self.SpawnInitFreq = nil -- No special frequency.
self.SpawnInitModu = nil -- No special modulation.
self.SpawnInitRadio = nil -- No radio comms setting.
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
else
@ -421,6 +427,9 @@ function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPr
self.Grouping = nil -- No grouping.
self.SpawnInitLivery = nil -- No special livery.
self.SpawnInitSkill = nil -- No special skill.
self.SpawnInitFreq = nil -- No special frequency.
self.SpawnInitModu = nil -- No special modulation.
self.SpawnInitRadio = nil -- No radio comms setting.
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
else
@ -597,6 +606,42 @@ function SPAWN:InitSkill( Skill )
return self
end
--- Sets the radio comms on or off. Same as checking/unchecking the COMM box in the mission editor.
-- @param #SPAWN self
-- @param #number switch If true (or nil), enables the radio comms. If false, disables the radio for the spawned group.
-- @return #SPAWN self
function SPAWN:InitRadioCommsOnOff(switch)
self:F({switch=switch} )
self.SpawnInitRadio=switch or true
return self
end
--- Sets the radio frequency of the group.
-- @param #SPAWN self
-- @param #number frequency The frequency in MHz.
-- @return #SPAWN self
function SPAWN:InitRadioFrequency(frequency)
self:F({frequency=frequency} )
self.SpawnInitFreq=frequency
return self
end
--- Set radio modulation. Default is AM.
-- @param #SPAWN self
-- @param #string modulation Either "FM" or "AM". If no value is given, modulation is set to AM.
-- @return #SPAWN self
function SPAWN:InitRadioModulation(modulation)
self:F({modulation=modulation})
if modulation and modulation:lower()=="fm" then
self.SpawnInitModu=radio.modulation.FM
else
self.SpawnInitModu=radio.modulation.AM
end
return self
end
--- Randomizes the defined route of the SpawnTemplatePrefix group in the ME. This is very useful to define extra variation of the behaviour of groups.
-- @param #SPAWN self
@ -1174,6 +1219,22 @@ function SPAWN:SpawnWithIndex( SpawnIndex )
end
end
-- Set radio comms on/off.
if self.SpawnInitRadio then
SpawnTemplate.communication=self.SpawnInitRadio
end
-- Set radio frequency.
if self.SpawnInitFreq then
SpawnTemplate.frequency=self.SpawnInitFreq
end
-- Set radio modulation.
if self.SpawnInitModu then
SpawnTemplate.modulation=self.SpawnInitModu
end
-- Set country, coaliton and categroy.
SpawnTemplate.CategoryID = self.SpawnInitCategory or SpawnTemplate.CategoryID
SpawnTemplate.CountryID = self.SpawnInitCountry or SpawnTemplate.CountryID

File diff suppressed because it is too large Load Diff

View File

@ -35,6 +35,8 @@
-- @field #string TACANmode TACAN mode, i.e. "X" or "Y". Default "Y". Use only "Y" for AA TACAN stations!
-- @field #string TACANmorse TACAN morse code. Three letters identifying the TACAN station. Default "TKR".
-- @field #boolean TACANon If true, TACAN is automatically activated. If false, TACAN is disabled.
-- @field #number RadioFreq Radio frequency in MHz of the tanker. Default 251 MHz.
-- @field #string RadioModu Radio modulation "AM" or "FM". Default "AM".
-- @field #number speed Tanker speed when flying pattern.
-- @field #number altitude Tanker orbit pattern altitude.
-- @field #number distStern Race-track distance astern. distStern is <0.
@ -154,6 +156,19 @@
--
-- In order to completely disable the TACAN beacon, you can use the @{#RECOVERYTANKER.SetTACANoff}() function in your script.
--
-- ## Radio
--
-- The radio frequency on optionally modulation can be set via the @{#RECOVERYTANKER.SetRadio}(*frequency*, *modulation*) function. The first parameter denotes the radio frequency the tanker uses in MHz.
-- The second parameter is *optional* and sets the modulation to either AM (default) or FM.
--
-- For example,
--
-- TexacoStennis:SetRadio(260)
--
-- will set the frequency of the tanker to 260 MHz AM.
--
-- **Note** that if this is not set, the tanker frequency will be automatically set to **251 MHz AM**.
--
-- ## Pattern Update
--
-- The pattern of the tanker is updated if at least one of the two following conditions apply:
@ -217,6 +232,8 @@ RECOVERYTANKER = {
TACANmode = nil,
TACANmorse = nil,
TACANon = nil,
RadioFreq = nil,
RadioModu = nil,
altitude = nil,
speed = nil,
distStern = nil,
@ -237,7 +254,7 @@ RECOVERYTANKER = {
--- Class version.
-- @field #string version
RECOVERYTANKER.version="1.0.1"
RECOVERYTANKER.version="1.0.2"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
@ -297,6 +314,7 @@ function RECOVERYTANKER:New(carrierunit, tankergroupname)
self:SetLowFuelThreshold()
self:SetRespawnOnOff()
self:SetTACAN()
self:SetRadio()
self:SetPatternUpdateDistance()
self:SetPatternUpdateHeading()
self:SetPatternUpdateInterval()
@ -623,6 +641,17 @@ function RECOVERYTANKER:SetTACAN(channel, morse)
return self
end
--- Set radio frequency and optionally modulation of the tanker.
-- @param #RECOVERYTANKER self
-- @param #number frequency Radio frequency in MHz. Default 251 MHz.
-- @param #string modulation Radio modulation, either "AM" or "FM". Default "AM".
-- @return #RECOVERYTANKER self
function RECOVERYTANKER:SetRadio(frequency, modulation)
self.RadioFreq=frequency or 251
self.RadioModu=modulation or "AM"
return self
end
--- Activate debug mode. Marks of pattern on F10 map and debug messages displayed on screen.
-- @param #RECOVERYTANKER self
-- @return #RECOVERYTANKER self
@ -692,6 +721,11 @@ function RECOVERYTANKER:onafterStart(From, Event, To)
-- Spawn tanker. We need to introduce an alias in case this class is used twice. This would confuse the spawn routine.
local Spawn=SPAWN:NewWithAlias(self.tankergroupname, tankergroupalias)
-- Set radio frequency and modulation.
Spawn:InitRadioCommsOnOff(true)
Spawn:InitRadioFrequency(self.RadioFreq)
Spawn:InitRadioModulation(self.RadioModu)
-- Spawn on carrier.
if self.takeoff==SPAWN.Takeoff.Air then
@ -789,8 +823,15 @@ function RECOVERYTANKER:onafterStatus(From, Event, To)
MESSAGE:New(text, 10, "DEBUG"):ToAllIf(self.Debug)
self:T(self.lid..text)
-- Respawn tanker.
-- Set heading for respawn template.
self.tanker:InitHeading(self.tanker:GetHeading())
-- Set radio for respawn template.
self.tanker:InitRadioCommsOnOff(true)
self.tanker:InitRadioFrequency(self.RadioFreq)
self.tanker:InitRadioModulation(self.RadioModu)
-- Respawn tanker.
self.tanker=self.tanker:Respawn(nil, true)
-- Create tanker beacon and activate TACAN.
@ -964,8 +1005,12 @@ function RECOVERYTANKER:OnEventEngineShutdown(EventData)
MESSAGE:New(text, 10, "DEBUG"):ToAllIf(self.Debug)
self:T(self.lid..text)
-- Set radio for respawn template.
group:InitRadioCommsOnOff(true)
group:InitRadioFrequency(self.RadioFreq)
group:InitRadioModulation(self.RadioModu)
-- Respawn tanker.
--self.tanker=group:RespawnAtCurrentAirbase()
-- Delaying respawn due to DCS bug https://github.com/FlightControl-Master/MOOSE/issues/1076
SCHEDULER:New(nil , group.RespawnAtCurrentAirbase, {group}, 1)

View File

@ -219,50 +219,62 @@ AIRBASE.Normandy = {
--- These are all airbases of the Persion Gulf Map:
--
-- * AIRBASE.PersianGulf.Fujairah_Intl
-- * AIRBASE.PersianGulf.Qeshm_Island
-- * AIRBASE.PersianGulf.Sir_Abu_Nuayr
-- * AIRBASE.PersianGulf.Abu_Musa_Island_Airport
-- * AIRBASE.PersianGulf.Bandar_Abbas_Intl
-- * AIRBASE.PersianGulf.Bandar_Lengeh
-- * AIRBASE.PersianGulf.Tunb_Island_AFB
-- * AIRBASE.PersianGulf.Havadarya
-- * AIRBASE.PersianGulf.Lar_Airbase
-- * AIRBASE.PersianGulf.Sirri_Island
-- * AIRBASE.PersianGulf.Tunb_Kochak
-- * AIRBASE.PersianGulf.Al_Dhafra_AB
-- * AIRBASE.PersianGulf.Dubai_Intl
-- * AIRBASE.PersianGulf.Al_Maktoum_Intl
-- * AIRBASE.PersianGulf.Fujairah_Intl
-- * AIRBASE.PersianGulf.Tunb_Island_AFB
-- * AIRBASE.PersianGulf.Havadarya
-- * AIRBASE.PersianGulf.Khasab
-- * AIRBASE.PersianGulf.Lar_Airbase
-- * AIRBASE.PersianGulf.Al_Minhad_AB
-- * AIRBASE.PersianGulf.Qeshm_Island
-- * AIRBASE.PersianGulf.Sharjah_Intl
-- * AIRBASE.PersianGulf.Shiraz_International_Airport
-- * AIRBASE.PersianGulf.Sirri_Island
-- * AIRBASE.PersianGulf.Tunb_Kochak
-- * AIRBASE.PersianGulf.Sir_Abu_Nuayr
-- * AIRBASE.PersianGulf.Kerman_Airport
-- * AIRBASE.PersianGulf.Jiroft_Airport
-- * AIRBASE.PersianGulf.Shiraz_International_Airport
-- * AIRBASE.PersianGulf.Sas_Al_Nakheel_Airport
-- * AIRBASE.PersianGulf.Bandar-e-Jask_airfield
-- * AIRBASE.PersianGulf.Abu_Dhabi_International_Airport
-- * AIRBASE.PersianGulf.Al-Bateen_Airport
-- * AIRBASE.PersianGulf.Kish_International_Airport
-- * AIRBASE.PersianGulf.Al_Ain_International_Airport
-- * AIRBASE.PersianGulf.Lavan_Island_Airport
-- * AIRBASE.PersianGulf.Jiroft_Airport
-- @field PersianGulf
AIRBASE.PersianGulf = {
["Fujairah_Intl"] = "Fujairah Intl",
["Qeshm_Island"] = "Qeshm Island",
["Sir_Abu_Nuayr"] = "Sir Abu Nuayr",
["Abu_Musa_Island_Airport"] = "Abu Musa Island Airport",
["Bandar_Abbas_Intl"] = "Bandar Abbas Intl",
["Bandar_Lengeh"] = "Bandar Lengeh",
["Tunb_Island_AFB"] = "Tunb Island AFB",
["Havadarya"] = "Havadarya",
["Lar_Airbase"] = "Lar Airbase",
["Sirri_Island"] = "Sirri Island",
["Tunb_Kochak"] = "Tunb Kochak",
["Al_Dhafra_AB"] = "Al Dhafra AB",
["Dubai_Intl"] = "Dubai Intl",
["Al_Maktoum_Intl"] = "Al Maktoum Intl",
["Fujairah_Intl"] = "Fujairah Intl",
["Tunb_Island_AFB"] = "Tunb Island AFB",
["Havadarya"] = "Havadarya",
["Khasab"] = "Khasab",
["Lar_Airbase"] = "Lar Airbase",
["Al_Minhad_AB"] = "Al Minhad AB",
["Qeshm_Island"] = "Qeshm Island",
["Sharjah_Intl"] = "Sharjah Intl",
["Shiraz_International_Airport"] = "Shiraz International Airport",
["Sirri_Island"] = "Sirri Island",
["Tunb_Kochak"] = "Tunb Kochak",
["Sir_Abu_Nuayr"] = "Sir Abu Nuayr",
["Kerman_Airport"] = "Kerman Airport",
["Jiroft_Airport"] = "Jiroft Airport",
["Shiraz_International_Airport"] = "Shiraz International Airport",
["Sas_Al_Nakheel_Airport"] = "Sas Al Nakheel Airport",
["Bandar-e-Jask_airfield"] = "Bandar-e-Jask airfield",
["Abu_Dhabi_International_Airport"] = "Abu Dhabi International Airport",
["Al-Bateen_Airport"] = "Al-Bateen Airport",
["Kish_International_Airport"] = "Kish International Airport",
["Al_Ain_International_Airport"] = "Al Ain International Airport",
["Lavan_Island_Airport"] = "Lavan Island Airport",
["Jiroft_Airport"] = "Jiroft Airport",
}
--- AIRBASE.ParkingSpot ".Coordinate, ".TerminalID", ".TerminalType", ".TOAC", ".Free", ".TerminalID0", ".DistToRwy".

View File

@ -1455,6 +1455,41 @@ function GROUP:InitRandomizePositionRadius( OuterRadius, InnerRadius )
return self
end
--- Sets the radio comms on or off when the group is respawned. Same as checking/unchecking the COMM box in the mission editor.
-- @param #GROUP self
-- @param #number switch If true (or nil), enables the radio comms. If false, disables the radio for the spawned group.
-- @return #GROUP self
function GROUP:InitRadioCommsOnOff(switch)
self:F({switch=switch} )
self.InitRespawnRadio=switch or true
end
--- Sets the radio frequency of the group when it is respawned.
-- @param #GROUP self
-- @param #number frequency The frequency in MHz.
-- @return #GROUP self
function GROUP:InitRadioFrequency(frequency)
self:F({frequency=frequency} )
self.InitRespawnFreq=frequency
return self
end
--- Set radio modulation when the group is respawned. Default is AM.
-- @param #GROUP self
-- @param #string modulation Either "FM" or "AM". If no value is given, modulation is set to AM.
-- @return #GROUP self
function GROUP:InitRadioModulation(modulation)
self:F({modulation=modulation})
if modulation and modulation:lower()=="fm" then
self.InitRespawnModu=radio.modulation.FM
else
self.InitRespawnModu=radio.modulation.AM
end
return self
end
--- Respawn the @{Wrapper.Group} at a @{Point}.
-- The method will setup the new group template according the Init(Respawn) settings provided for the group.
@ -1477,7 +1512,7 @@ end
--
-- @param Wrapper.Group#GROUP self
-- @param #table Template (optional) The template of the Group retrieved with GROUP:GetTemplate(). If the template is not provided, the template will be retrieved of the group itself.
-- @param #boolean Reset Reset positons if TRUE.
-- @param #boolean Reset Reset positions if TRUE.
-- @return Wrapper.Group#GROUP self
function GROUP:Respawn( Template, Reset )
@ -1606,6 +1641,17 @@ function GROUP:Respawn( Template, Reset )
end
-- Set radio frequency and modulation.
if self.InitRespawnRadio then
Template.communication=self.InitRespawnRadio
end
if self.InitRespawnFreq then
Template.frequency=self.InitRespawnFreq
end
if self.InitRespawnModu then
Template.modulation=self.InitRespawnModu
end
-- Destroy old group. Dont trigger any dead/crash events since this is a respawn.
self:Destroy(false)
@ -1715,11 +1761,22 @@ function GROUP:RespawnAtCurrentAirbase(SpawnTemplate, Takeoff, Uncontrolled) --
-- Set uncontrolled state.
SpawnTemplate.uncontrolled=Uncontrolled
-- Set radio frequency and modulation.
if self.InitRespawnRadio then
SpawnTemplate.communication=self.InitRespawnRadio
end
if self.InitRespawnFreq then
SpawnTemplate.frequency=self.InitRespawnFreq
end
if self.InitRespawnModu then
SpawnTemplate.modulation=self.InitRespawnModu
end
-- Destroy old group.
self:Destroy(false)
-- Spawn new group.
_DATABASE:Spawn( SpawnTemplate )
_DATABASE:Spawn(SpawnTemplate)
-- Reset events.
self:ResetEvents()