--[[ ----------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------- -- Title: Dynamic Airfield ATIS Script -- Orig. Author: Turbine -- Version: 0.0.4 -- Initial Date: 2026-01-13 -- Description: This script generates ATIS frequencies for airfields within Caucasus, Kola Penninsula, Mirianas Islands, Nevada Test Range, -- Persian Gulf, Sinai Penninsula, South Atlantic and Syria conflict zones. It dynamically manages ATIS stations based on -- player presence within defined zones around airbases. This script dynamically creates trigger zones around the -- active coalitions airbases, activates MOOSE ATIS stations for those airbases, and then starts and stops them based -- on a players presence within the zone. -- To Use: To enable this script on your mission simply add the following line as a DO SCRIPT command in the Triggers menu within -- the mission editor. -- assert(loadfile("C:\\XXXX\\XXXX\\TACG Airfield Atis.lua"))() -- where XXXX\\XXXX is the folder path to where the lua file sits. -- Be aware that this script needs to run AFTER MOOSE is loaded. Add a conditional of TIME MORE (2) when letting this script run. -- -- Changelog: Version | Date | Author | Description -- 1.0 | 2023-12-05 | Crit | Initial Release -- 2.0 | 2024-05-19 | Turbine | Added Kola Penninsula and South Atlantic maps, Removed MIST requirements. Added -- SetActiveRunway, SetActiveTakeoffRunway and SetActiveLandingRunway for ATIS. -- Added a table debugger. Re-arranged the script so it is easier to interpret. -- 2.1 | 2024-06-08 | Turbine | Revised unicom frequency to read correctly. Updated Server listings. -- 2.2 | 2024-06-08 | Turbine | Removed most of the unnecessary information from ATIS. -- 2.3 | 2024-09-15 | Turbine | Added/Revamped the debugging information, Added prefix "ATIS_" to zone names for scripting purposes -- 2.4 | 2024-11-23 | Turbine | Added Afghanistan airfields. Corrected Airfields on Sinai -- 2.5 | 2024-11-30 | Turbine | Corrected airfields on Kola -- 2.6 | 2024-12-11 | Turbine | Added missing airfiels on Syria -- 3.0 | 2025-01-27 | Turbine | Major change. Moved global data to a new TACG Global Settings.lua file. -- 0.0.4 | 2026-01-13 | Turbine | Using new Version Scheme. Redid some of the frequencies, and included modulation. Redid the SetSRS fuction into block that will apply it based on whether user has Google TTS or not. -- -----------------------------------------------------------------------------------------------------------------------------------]] -- Define Local Variables local DEBUGGING = true -- This will draw circles where the trigger zones should be located and turn on log messaging. local ACTIVE_AIRBASES = {} -- Don't touch! This is used to store the airbases owned by the active coalition. local ATIS_LIST = {} -- Don't touch! This is the table that stores the active ATIS stations. local ATIS_ZONE_LIST = {} -- Don't touch! This is the table that stores the zones created for the active stations. local SERVER = { NAME = "", -- Placeholder for storing name of server SRS_PATH = "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio\\", -- SRS Path on Server SRS_PORT = 0000, -- Set the default port! If you have one server, this will be your port. } local TURBINE_CONFIG = { ZONE_RADIUS = 92600, -- In meters! 92600 meters is 50nm.. CHECK_INTERVAL = 60, -- In seconds! This determines how often to check if a player is within a zone and to start/stop ATIS. QUEUE_UPDATE_TIME = 60, -- This is the queue update time used for MOOSE ATIS. TRANSMIT_ONLY_WITH_PLAYERS = true, -- This is the transmit only with players on the frequency option in MOOSE ATIS. SUBTITLE_DURATION = 0, -- This is the subtitle duration if you want subtitles enabled with ATIS. } local TURBINE_AIRBASE_MASTER_LIST = { -- Data I've generated for ATIS information ["AFGHANISTAN"] = { { airbase = AIRBASE.Afghanistan.Bagram, frequency = 369.400, modulation = radio.modulation.AM, towerFrequencies = {325.750, 120.100}, tacan = 74, }, { airbase = AIRBASE.Afghanistan.Kabul, frequency = 130.150, modulation = radio.modulation.AM, towerFrequencies = {325.750, 120.100}, tacan = 65, }, { airbase = AIRBASE.Afghanistan.Kandahar, frequency = 242.675, modulation = radio.modulation.AM, towerFrequencies = {284.250, 120.600, 39.300, 4.200}, tacan = 75, } }, ["CAUCASUS"] = { { airbase = AIRBASE.Caucasus.Anapa_Vityazevo, frequency = 135.900, modulation = radio.modulation.AM, towerFrequencies = {250.000, 121.000, 38.400, 3.750}, }, { airbase = AIRBASE.Caucasus.Beslan, frequency = 118.500, modulation = radio.modulation.AM, towerFrequencies = {270.000, 141.000, 42.400, 4.750}, }, { airbase = AIRBASE.Caucasus.Gelendzhik, frequency = 134.870, modulation = radio.modulation.AM, towerFrequencies = {255.000, 126.000, 39.400, 4.000}, }, { airbase = AIRBASE.Caucasus.Kobuleti, frequency = 262.200, modulation = radio.modulation.AM, towerFrequencies = {262.000, 133.000, 40.800, 4.350}, tacan = 67, }, { airbase = AIRBASE.Caucasus.Krasnodar_Pashkovsky, frequency = 122.450, modulation = radio.modulation.AM, towerFrequencies = {257.000, 128.000, 39.800, 4.100}, }, { airbase = AIRBASE.Caucasus.Mineralnye_Vody, frequency = 127.400, modulation = radio.modulation.AM, towerFrequencies = {264.000, 135.000, 41.200, 4.450}, }, { airbase = AIRBASE.Caucasus.Sochi_Adler, frequency = 129.370, modulation = radio.modulation.AM, towerFrequencies = {256.000, 127.000, 39.600, 4.050}, }, { airbase = AIRBASE.Caucasus.Tbilisi_Lochini, frequency = 132.800, modulation = radio.modulation.AM, towerFrequencies = {267.000, 138.000, 41.800, 4.600}, tacan = 25, } }, ["GERMANYCW"] = { { airbase = AIRBASE.GermanyCW.Bindersleben, frequency = 133.450, modulation = radio.modulation.AM, towerFrequencies = {251.900, 122.100, 40.300, 4.700}, }, { airbase = AIRBASE.GermanyCW.Braunschweig, frequency = 134.450, modulation = radio.modulation.AM, towerFrequencies = {250.350, 120.050, 38.750, 3.925}, }, { airbase = AIRBASE.GermanyCW.Bremen, frequency = 132.380, modulation = radio.modulation.AM, towerFrequencies = {254.100, 118.450, 41.700, 4.225}, }, { airbase = AIRBASE.GermanyCW.Briest, frequency = 130.125, modulation = radio.modulation.AM, towerFrequencies = {254.150, 135.550, 40.200, 4.175}, }, { airbase = AIRBASE.GermanyCW.Dedelow, frequency = 121.720, modulation = radio.modulation.AM, towerFrequencies = {250.200, 119.000, 38.600, 3.850}, }, { airbase = AIRBASE.GermanyCW.Dessau, frequency = 125.800, modulation = radio.modulation.AM, towerFrequencies = {254.400, 127.500, 41.300, 3.825}, }, { airbase = AIRBASE.GermanyCW.Frankfurt, frequency = 118.730, modulation = radio.modulation.AM, towerFrequencies = {251.850, 127.300, 40.250, 4.675}, tacan = 89, }, { airbase = AIRBASE.GermanyCW.Hamburg, frequency = 124.325, modulation = radio.modulation.AM, towerFrequencies = {252.350, 126.850, 40.750, 4.925}, tacan = 78, }, { airbase = AIRBASE.GermanyCW.Hamburg_Finkenwerder, frequency = 135.960, modulation = radio.modulation.AM, towerFrequencies = {252.400, 123.200, 40.800, 4.950}, }, { airbase = AIRBASE.GermanyCW.Hannover, frequency = 136.570, modulation = radio.modulation.AM, towerFrequencies = {252.450, 120.200, 40.850, 4.525}, }, { airbase = AIRBASE.GermanyCW.Laage, frequency = 134.600, modulation = radio.modulation.AM, towerFrequencies = {252.700, 129.500, 41.100, 4.650}, }, --{ -- airbase = AIRBASE.GermanyCW.Leipzig_Halle, -- frequency = 123.950, -- towerFrequencies = {252.300, 129.000, 40.700, 4.900}, --}, { airbase = AIRBASE.GermanyCW.Luebeck, frequency = 119.930, modulation = radio.modulation.AM, towerFrequencies = {254.300, 128.700, 41.600, 4.825}, }, { airbase = AIRBASE.GermanyCW.Parchim, frequency = 126.130, modulation = radio.modulation.AM, towerFrequencies = {254.450, 129.000, 39.850, 4.775}, }, { airbase = AIRBASE.GermanyCW.Ramstein, frequency = 292.270, modulation = radio.modulation.AM, towerFrequencies = {251.950, 133.200, 40.350, 4.725}, tacan = 81, }, { airbase = AIRBASE.GermanyCW.Wiesbaden, frequency = 292.750, modulation = radio.modulation.AM, towerFrequencies = {252.250, 118.100, 40.650, 4.875}, tacan = 88, } }, ["IRAQ"] = { { airbase = AIRBASE.Iraq.Baghdad_International_Airport, frequency = 126.920, modulation = radio.modulation.AM, towerFrequencies = {250.300, 118.900, 38.750, 3.925}, tacan = 64, }, { airbase = AIRBASE.Iraq.Balad_Airbase, frequency = 125.400, modulation = radio.modulation.AM, towerFrequencies = {250.550, 119.800, 39.000, 4.050}, tacan = 93, }, { airbase = AIRBASE.Iraq.Erbil_International_Airport, frequency = 130.400, modulation = radio.modulation.AM, towerFrequencies = {250.350, 128.800, 38.800, 3.950}, }, { airbase = AIRBASE.Iraq.Mosul_International_Airport, frequency = 127.250, modulation = radio.modulation.AM, towerFrequencies = {250.650, 119.000, 38.400, 3.750}, } }, ["KOLA"] = { { airbase = AIRBASE.Kola.Alta, frequency = 118.170, modulation = radio.modulation.AM, towerFrequencies = {250.750, 120.400, 39.200, 4.150}, }, { airbase = AIRBASE.Kola.Andoya, frequency = 136.120, modulation = radio.modulation.AM, towerFrequencies = {250.600, 118.200, 39.050, 4.075}, tacan = 28, }, { airbase = AIRBASE.Kola.Banak, frequency = 136.320, modulation = radio.modulation.AM, towerFrequencies = {250.550, 118.050, 39.000, 4.050}, tacan = 47, }, { airbase = AIRBASE.Kola.Bardufoss, frequency = 129.720, modulation = radio.modulation.AM, towerFrequencies = {250.650, 118.100, 39.100, 4.100}, }, { airbase = AIRBASE.Kola.Bodo, frequency = 123.900, modulation = radio.modulation.AM, towerFrequencies = {251.150, 118.450, 39.650, 4.375}, tacan = 45, }, { airbase = AIRBASE.Kola.Enontekio, frequency = 134.820, modulation = radio.modulation.AM, towerFrequencies = {250.850, 119.700, 39.300, 4.200}, }, { airbase = AIRBASE.Kola.Evenes, frequency = 126.020, modulation = radio.modulation.AM, towerFrequencies = {250.800, 118.000, 39.250, 4.175}, tacan = 73, }, { airbase = AIRBASE.Kola.Ivalo, frequency = 123.200, modulation = radio.modulation.AM, towerFrequencies = {250.450, 118.000, 38.900, 4.000}, }, { airbase = AIRBASE.Kola.Kemi_Tornio, frequency = 123.150, modulation = radio.modulation.AM, towerFrequencies = {251.000, 119.400, 39.450, 4.275}, }, { airbase = AIRBASE.Kola.Kirkenes, frequency = 118.020, modulation = radio.modulation.AM, towerFrequencies = {250.250, 120.350, 38.700, 3.900}, }, { airbase = AIRBASE.Kola.Kittila, frequency = 133.850, modulation = radio.modulation.AM, towerFrequencies = {250.700, 118.950, 39.150, 4.125}, }, { airbase = AIRBASE.Kola.Kuusamo, frequency = 135.800, modulation = radio.modulation.AM, towerFrequencies = {250.350, 118.650, 38.800, 3.950}, }, { airbase = AIRBASE.Kola.Murmansk_International, frequency = 127.400, modulation = radio.modulation.AM, towerFrequencies = {250.200, 127.300, 38.600, 3.850}, }, { airbase = AIRBASE.Kola.Rovaniemi, frequency = 133.700, modulation = radio.modulation.AM, towerFrequencies = {250.950, 118.700, 39.400, 4.250}, } }, ["MARIANAISLANDS"] = { { airbase = AIRBASE.MarianaIslands.Andersen_AFB, frequency = 254.325, modulation = radio.modulation.AM, towerFrequencies = {250.100, 126.200, 38.600, 3.850}, tacan = 54, }, { airbase = AIRBASE.MarianaIslands.Antonio_B_Won_Pat_Intl, frequency = 119.000, modulation = radio.modulation.AM, towerFrequencies = {340.200, 118.100, 38.550, 3.825}, tacan = 105, }, { airbase = AIRBASE.MarianaIslands.Saipan_Intl, frequency = 127.200, modulation = radio.modulation.AM, towerFrequencies = {256.900, 125.700, 38.450, 3.775}, } }, ["NEVADA"] = { { airbase = AIRBASE.Nevada.Boulder_City, frequency = 118.475, modulation = radio.modulation.AM, towerFrequencies = {250.100, 118.050, 38.750, 3.925}, tacan = 114, }, { airbase = AIRBASE.Nevada.Creech, frequency = 290.450, modulation = radio.modulation.AM, towerFrequencies = {360.600, 118.300, 38.550, 3.825}, tacan = 87, }, { airbase = AIRBASE.Nevada.Henderson_Executive, frequency = 120.775, modulation = radio.modulation.AM, towerFrequencies = {250.150, 125.100, 38.800, 3.950}, }, { airbase = AIRBASE.Nevada.Laughlin, frequency = 119.825, modulation = radio.modulation.AM, towerFrequencies = {250.000, 123.900, 38.400, 3.750}, }, { airbase = AIRBASE.Nevada.McCarran_International, frequency = 132.400, modulation = radio.modulation.AM, towerFrequencies = {257.800, 119.900, 38.650, 3.875}, tacan = 116, }, { airbase = AIRBASE.Nevada.Mesquite, frequency = 118.525, modulation = radio.modulation.AM, additionalInfo = "Remarks. No active tower. Use 1 2 2 decimal 7 unicom.", }, { airbase = AIRBASE.Nevada.Nellis, frequency = 270.100, modulation = radio.modulation.AM, towerFrequencies = {327.000, 132.550, 38.700, 3.900}, tacan = 12, }, { airbase = AIRBASE.Nevada.North_Las_Vegas, frequency = 118.050, modulation = radio.modulation.AM, towerFrequencies = {360.750, 125.700, 38.450, 3.775}, }, { airbase = AIRBASE.Nevada.Tonopah, frequency = 118.875, modulation = radio.modulation.AM, additionalInfo = "Remarks. No active tower. Use 1 2 2 decimal 7 unicom.", } }, ["PERSIANGULF"] = { { airbase = AIRBASE.PersianGulf.Abu_Dhabi_Intl, frequency = 119.970, modulation = radio.modulation.AM, towerFrequencies = {250.550, 119.200, 39.000, 4.050}, }, { airbase = AIRBASE.PersianGulf.Al_Ain_Intl, frequency = 126.050, modulation = radio.modulation.AM, towerFrequencies = {250.700, 119.850, 39.150, 4.125}, }, { airbase = AIRBASE.PersianGulf.Al_Dhafra_AFB, frequency = 126.470, modulation = radio.modulation.AM, towerFrequencies = {251.200, 118.600, 39.600, 4.350}, }, { airbase = AIRBASE.PersianGulf.Bandar_Abbas_Intl, frequency = 128.650, modulation = radio.modulation.AM, towerFrequencies = {251.000, 118.100, 39.400, 4.250}, tacan = 78, }, { airbase = AIRBASE.PersianGulf.Dubai_Intl, frequency = 131.700, modulation = radio.modulation.AM, towerFrequencies = {251.150, 118.750, 39.550, 4.325}, }, { airbase = AIRBASE.PersianGulf.Fujairah_Intl, frequency = 126.650, modulation = radio.modulation.AM, towerFrequencies = {251.250, 124.600, 39.650}, }, { airbase = AIRBASE.PersianGulf.Kerman, frequency = 127.250, modulation = radio.modulation.AM, towerFrequencies = {250.300, 118.250, 38.750, 3.925}, tacan = 97, }, { airbase = AIRBASE.PersianGulf.Kish_Intl, frequency = 128.000, modulation = radio.modulation.AM, towerFrequencies = {250.650, 121.650, 39.100, 4.100}, tacan = 112, }, { airbase = AIRBASE.PersianGulf.Qeshm_Island, frequency = 127.050, modulation = radio.modulation.AM, towerFrequencies = {250.150, 118.050, 38.550, 3.825}, }, { airbase = AIRBASE.PersianGulf.Ras_Al_Khaimah_Intl, frequency = 126.070, modulation = radio.modulation.AM, towerFrequencies = {250.900, 121.600, 39.300, 4.200}, }, { airbase = AIRBASE.PersianGulf.Sharjah_Intl, frequency = 122.400, modulation = radio.modulation.AM, towerFrequencies = {250.200, 118.600, 38.600, 3.850}, }, { airbase = AIRBASE.PersianGulf.Shiraz_Intl, frequency = 127.000, modulation = radio.modulation.AM, towerFrequencies = {250.350, 121.900, 38.800, 3.950}, tacan = 94, } }, ["SINAIMAP"] = { { airbase = AIRBASE.Sinai.Ben_Gurion, frequency = 132.800, modulation = radio.modulation.AM, towerFrequencies = {250.800, 134.600, 39.200, 4.150}, tacan = 82, }, { airbase = AIRBASE.Sinai.Cairo_International_Airport, frequency = 122.600, modulation = radio.modulation.AM, towerFrequencies = {250.400, 118.100, 38.800, 3.950}, tacan = 110, additionalInfo = "Remarks. Use V O R 1 1 5 decimal 2 megahertz for runway 0 5 approaches. Use V O R 1 1 2 decimal 5 megahertz for runway 2 3 approaches.", }, { airbase = AIRBASE.Sinai.Hurghada_International_Airport, frequency = 120.450, modulation = radio.modulation.AM, towerFrequencies = {251.550, 119.600, 39.950, 4.525}, }, { airbase = AIRBASE.Sinai.Nevatim, frequency = 119.200, modulation = radio.modulation.AM, towerFrequencies = {252.200, 132.400, 40.600, 4.850}, }, { airbase = AIRBASE.Sinai.Ovda, frequency = 132.250, modulation = radio.modulation.AM, towerFrequencies = {250.050, 129.900, 38.450, 3.775}, tacan = 88, }, { airbase = AIRBASE.Sinai.Rafic_Hariri_Intl, frequency = 120.600, modulation = radio.modulation.AM, towerFrequencies = {253.200, 118.900, 41.650, 5.375}, }, { airbase = AIRBASE.Sinai.Ramon_International_Airport, frequency = 132.550, modulation = radio.modulation.AM, towerFrequencies = {251.750, 119.000, 40.150, 4.625}, }, { airbase = AIRBASE.Sinai.Sharm_El_Sheikh_International_Airport, frequency = 134.000, modulation = radio.modulation.AM, towerFrequencies = {251.800, 118.900, 40.200, 4.650}, }, { airbase = AIRBASE.Sinai.Tabuk, frequency = 128.200, modulation = radio.modulation.AM, towerFrequencies = {0.000, 0.000, 0.000, 0.000}, tacan = 104, additionalInfo = "Remarks. No active tower. Use 1 2 2 decimal 7 unicom.", } }, ["FALKLANDS"] = { { airbase = AIRBASE.SouthAtlantic.El_Calafate, frequency = 127.850, modulation = radio.modulation.AM, towerFrequencies = {250.200, 119.950, 38.600, 3.850}, }, { airbase = AIRBASE.SouthAtlantic.Mount_Pleasant, frequency = 128.550, modulation = radio.modulation.AM, towerFrequencies = {250.800, 133.350, 39.200, 4.150}, tacan = 59, }, { airbase = AIRBASE.SouthAtlantic.Rio_Gallegos, frequency = 127.600, modulation = radio.modulation.AM, towerFrequencies = {250.900, 119.100, 39.300, 4.200}, }, { airbase = AIRBASE.SouthAtlantic.Ushuaia, frequency = 127.800, modulation = radio.modulation.AM, towerFrequencies = {251.000, 118.100, 39.400, 4.250}, }, }, ["SYRIA"] = { { airbase = AIRBASE.Syria.Adana_Sakirpasa, frequency = 119.220, modulation = radio.modulation.AM, towerFrequencies = {251.250, 121.100, 39.700, 4.400}, }, { airbase = AIRBASE.Syria.Akrotiri, frequency = 125.000, modulation = radio.modulation.AM, towerFrequencies = {252.000, 128.000, 40.450, 4.775}, tacan = 107, }, { airbase = AIRBASE.Syria.Ben_Gurion, frequency = 132.800, modulation = radio.modulation.AM, towerFrequencies = {250.700, 134.600, 39.150, 4.125}, tacan = 82, }, { airbase = AIRBASE.Syria.Gaziantep, frequency = 119.270, modulation = radio.modulation.AM, towerFrequencies = {250.100, 120.100, 38.500, 3.800}, }, { airbase = AIRBASE.Syria.Gazipasa, frequency = 120.950, modulation = radio.modulation.AM, towerFrequencies = {251.900, 119.250, 40.350, 4.725}, }, { airbase = AIRBASE.Syria.Haifa, frequency = 135.400, modulation = radio.modulation.AM, towerFrequencies = {250.200, 127.800, 38.600, 3.850}, }, { airbase = AIRBASE.Syria.Hatay, frequency = 121.250, modulation = radio.modulation.AM, towerFrequencies = {250.300, 128.500, 38.700, 3.900}, }, { airbase = AIRBASE.Syria.Incirlik, frequency = 377.475, modulation = radio.modulation.AM, towerFrequencies = {360.100, 122.100, 38.750, 3.925}, tacan = 21, }, { airbase = AIRBASE.Syria.Kingsfield, frequency = 126.550, modulation = radio.modulation.AM, towerFrequencies = {252.050, 121.000, 40.500, 4.800}, }, { airbase = AIRBASE.Syria.Larnaca, frequency = 126.550, modulation = radio.modulation.AM, towerFrequencies = {252.150, 121.200, 40.600, 4.850}, }, { airbase = AIRBASE.Syria.Paphos, frequency = 127.320, modulation = radio.modulation.AM, towerFrequencies = {252.100, 119.900, 40.550, 4.825}, tacan = 79, }, { airbase = AIRBASE.Syria.Beirut_Rafic_Hariri, frequency = 120.600, modulation = radio.modulation.AM, towerFrequencies = {253.200, 118.900, 41.650, 5.375}, }, { airbase = AIRBASE.Syria.Sanliurfa, frequency = 128.250, modulation = radio.modulation.AM, towerFrequencies = {252.700, 118.400, 41.150, 5.125}, } }, } -- Debug Log Function local function DebugLogger(message) if DEBUGGING then env.info("TURBINE'S DYNAMIC AIRFIELD ATIS SCRIPT: " .. message) end end -- Debug Table Function local function DebugTable(_table) if DEBUGGING then env.info("TURBINE'S DYNAMIC AIRFIELD ATIS SCRIPT: OUTPUTTING TABLE!") UTILS.PrintTableToLog(_table,4) env.info("TURBINE'S DYNAMIC AIRFIELD ATIS SCRIPT: OUTPUTTING TABLE COMPLETE!") end end -- Check to see if customer SRS path provided if SRS_PATH then DebugLogger("CUSTOM SRS PATH FOUND. APPLYING PATH: " .. SRS_PATH) SERVER.SRS_PATH = SRS_PATH else DebugLogger("CUSTOM SRS PATH NOT FOUND. APPLYING PATH: C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio. PLEASE CHECK YOUR CODE.") end -- Check to see if custom server list provided if SERVER_MASTER_LIST then DebugLogger("CUSTOM SERVER MASTER LIST FOUND. APPLYING PRESETS.") for i, v in ipairs(SERVER_MASTER_LIST) do if v.SERVER_NAME then if v.SERVER_NAME == BASE.ServerName then SERVER.NAME = v.SERVER_NAME if v.SRS_PORT then SERVER.SRS_PORT = v.SRS_PORT else DebugLogger("\"SRS_PORT\" VARIABLE NOT DEFINED IN ATIS_SERVER_MASTER_LIST TABLE. PLEASE CHECK YOUR CODE.") end else DebugLogger("SERVER \"".. v.SERVER_NAME .. "\" NOT FOUND. SKIPPING.") end else DebugLogger("\"SERVER_NAME\" VARIABLE NOT DEFINED IN ATIS_SERVER_MASTER_LIST TABLE. PLEASE CHECK YOUR CODE.") end end else DebugLogger("CUSTOM SERVER MASTER LIST NOT FOUND. USING SCRIPT DEFAULTS. PLEASE CHECK YOUR CODE.") end -- Check if server port was updated if SERVER.SRS_PORT == 0000 then SERVER.SRS_PORT = 5002 DebugLogger("COULD NOT FIND MATCHING SERVER. SETTING SRS_PORT TO " .. SERVER.SRS_PORT) end -- Check to see if custom master airbase list is provided if ATIS_AIRBASE_MASTER_LIST then AIRBASE_MASTER_LIST = ATIS_AIRBASE_MASTER_LIST DebugLogger("CUSTOM AIRBASE MASTER LIST FOUND. APPLYING CUSTOM AIRBASE INFORMATION.") else AIRBASE_MASTER_LIST = TURBINE_AIRBASE_MASTER_LIST DebugLogger("CUSTOM AIRBASE MASTER LIST NOT FOUND. USING SCRIPT DEFAULT LIST! PLEASE CHECK YOUR CODE.") end -- Check to see if custom Config is provided if ATIS_MASTER_CONFIG then CONFIG = ATIS_MASTER_CONFIG DebugLogger("CUSTOM SETTINGS FOUND. APPLYING CUSTOM SETTINGS.") else CONFIG = TURBINE_CONFIG DebugLogger("CUSTOM SETTINGS NOT FOUND. USING SCRIPT DEFAULTS.") end -- Grab all active airbases owned by the coalitions, find them in the airbase master list, then add them to active airbases tables. local function createActiveAirBases() local bases = coalition.getAirbases(1) --Grab Red Airbases local bluebases = coalition.getAirbases(2) --Grab Blue Airbases for i = 1, #bluebases do table.insert(bases,bluebases[i]) end for i = 1, #bases do for _, a in ipairs(AIRBASE_MASTER_LIST[string.upper(env.mission.theatre)]) do if a.airbase == Airbase.getCallsign(bases[i]) then table.insert(ACTIVE_AIRBASES, a) DebugLogger("ACTIVE AIRBASE LOADED: " .. string.upper(Airbase.getCallsign(bases[i])) .."!") end end end end -- Create Audio ATIS Frequencies & Zones local function createATISAudio(airbaseList) -- Loop through each airbase in the active list sent for _, a in ipairs(airbaseList) do -- Create the Zone around the Airbase local airbaseObj = AIRBASE:FindByName(a.airbase) --Create the airbase object. local airbaseVec2 --Create the postional vector variable for the base. -- If airbase exists, Get position and create the zone. if airbaseObj then -- Get the Airbases Position. airbaseVec2 = airbaseObj:GetVec2() -- Create the zone by coalition ATIS_ZONE_LIST[a.airbase] = ZONE_RADIUS:New(a.airbase, airbaseVec2, CONFIG.ZONE_RADIUS) -- If Debugging, output drawzones to F10 Map. -- if DEBUGGING then -- ATIS_ZONE_LIST[a.airbase]:DrawZone(-1, {0,1,0}, 1, {0,1,0}, 0.15, 1, true) -- end else DebugLogger("AIRBASE " .. a.airbase .. " WAS NOT FOUND!") end -- Create ATIS Object ATIS_LIST[a.airbase] = ATIS:New(a.airbase, a.frequency, a.modulation) --Apply to transmit only with Players ATIS_LIST[a.airbase]:SetTransmitOnlyWithPlayers(CONFIG.TRANSMIT_ONLY_WITH_PLAYERS) --Apply SRS Path for Audio Ouput via SRS if not GOOGLE_KEY_PATH then ATIS_LIST[a.airbase]:SetSRS(SERVER.SRS_PATH, (math.random(1, 2) == 1) and "male" or "female", "en-US", nil, SERVER.SRS_PORT) else local voice local voices local voiceSex = (math.random(1, 2) == 1) and "male" or "female" local voiceCountry = (math.random(1, 2) == 1) and "en-US" or "en-GB" if voiceSex == "male" and voiceCountry == "en-US" then voices = { "en-US-Standard-A", --English (US) Standard en-US en-US-Standard-A MALE "en-US-Standard-B", --English (US) Standard en-US en-US-Standard-B MALE "en-US-Standard-D", --English (US) Standard en-US en-US-Standard-D MALE "en-US-Standard-I", --English (US) Standard en-US en-US-Standard-I MALE "en-US-Standard-J" --English (US) Standard en-US en-US-Standard-J MALE } elseif voiceSex == "female" and voiceCountry == "en-US" then voices = { "en-US-Standard-C", --English (US) Standard en-US en-US-Standard-C FEMALE "en-US-Standard-E", --English (US) Standard en-US en-US-Standard-E FEMALE "en-US-Standard-F", --English (US) Standard en-US en-US-Standard-F FEMALE "en-US-Standard-G", --English (US) Standard en-US en-US-Standard-G FEMALE "en-US-Standard-H" --English (US) Standard en-US en-US-Standard-H FEMALE } elseif voiceSex == "male" and voiceCountry == "en-GB" then voices = { "en-GB-Standard-B", --English (UK) Standard en-GB en-GB-Standard-B MALE "en-GB-Standard-D", --English (UK) Standard en-GB en-GB-Standard-D MALE "en-GB-Standard-O" --English (UK) Standard en-GB en-GB-Standard-O MALE } elseif voiceSex == "female" and voiceCountry == "en-GB" then voices = { "en-GB-Standard-C", --English (UK) Standard en-GB en-GB-Standard-C FEMALE "en-GB-Standard-A", --English (UK) Standard en-GB en-GB-Standard-A FEMALE "en-GB-Standard-F", --English (UK) Standard en-GB en-GB-Standard-F FEMALE "en-GB-Standard-N" --English (UK) Standard en-GB en-GB-Standard-N FEMALE } end voice = voices[math.random(#voices)] ATIS_LIST[a.airbase]:SetSRS(SERVER.SRS_PATH,voiceSex,voiceCountry,voices[math.random(#voices)],SERVER.SRS_PORT,GOOGLE_KEY_PATH) end --Apply Que Update Time ATIS_LIST[a.airbase]:SetQueueUpdateTime(CONFIG.QUEUE_UPDATE_TIME) --Apply Tower Frequencies if defined in master table if a.towerFrequencies then ATIS_LIST[a.airbase]:SetTowerFrequencies(a.towerFrequencies) end --Apply TACAN information if defined in master table if a.tacan then ATIS_LIST[a.airbase]:SetTACAN(a.tacan) end --Apply additional information if defined in master table if a.additionalInfo then ATIS_LIST[a.airbase]:SetAdditionalInformation(a.additionalInfo) end --Apply Tower Frequencies if defined in master table --if a.rsbn then -- ATIS_LIST[a.airbase]:SetRSBN(a.rsbn) --end -- -- -- --Apply VOR information if defined in master table -- --if a.vor then -- -- ATIS_LIST[a.airbase]:SetVOR(a.vor) -- --end -- -- --Apply NDB Inner Marker information if defined in master table -- --if a.ndbinner then -- -- for _, n in ipairs(a.ndbinner) do -- -- ATIS_LIST[a.airbase]:AddNDBinner(n[1], n[2]) -- -- end -- --end -- -- --Apply NDB Outer Marker information if defined in master table -- --if a.ndbouter then -- -- for _, n in ipairs(a.ndbouter) do -- -- ATIS_LIST[a.airbase]:AddNDBouter(n[1], n[2]) -- -- end -- --end -- -- --Apply PRMG information if defined in master table -- --if a.prmg then -- -- for _, p in ipairs(a.prmg) do -- -- ATIS_LIST[a.airbase]:AddPRMG(p[1], p[2]) -- -- end -- --end -- -- --Apply ILS information if defined in master table -- --if a.ils then -- -- for _, i in ipairs(a.ils) do -- -- ATIS_LIST[a.airbase]:AddILS(i[1], i[2]) -- -- end -- --end -- -- --Apply field elevation -- --ATIS_LIST[a.airbase]:SetElevation() -- -- --Apply runway length -- --ATIS_LIST[a.airbase]:SetRunwayLength() -- -- --Apply Subtitle duration -- ATIS_LIST[a.airbase]:SetSubtitleDuration(CONFIG.SUBTITLE_DURATION) -- -- -- --Apply Active Runway if defined in master table -- if a.activRunway then -- ATIS_LIST[a.airbase]:SetActiveRunway(a.activeRunway) -- end -- -- --Apply Active Takeoff Runway if defined in master table -- --if a.ActiveRunwayTakeoff then -- -- ATIS_LIST[a.airbase]:SetActiveRunwayTakeoff(a.ActiveRunwayTakeoff[1], a.ActiveRunwayTakeoff[2]) -- --end -- -- --Apply Active Landing Runway if defined in master table -- --if a.ActiveRunwayLanding then -- -- ATIS_LIST[a.airbase]:SetActiveRunwayLanding(a.ActiveRunwayLanding[1], a.ActiveRunwayLanding[2]) -- --end -- -- Add debugging information DebugLogger("AIRBASE " .. a.airbase .. " ATIS INFORMATION CREATED!") end end -- ATIS Check if clients inside of zone local function checkInAtisZone(aZone) local count = 0 SET_CLIENT:New():FilterOnce():ForEachClientInZone(aZone, function(client) count = count + 1 DebugLogger(client.ClientName .. " IS IN ZONE: " .. aZone:GetName()) end) return count ~= 0 end -- ATIS Audio State Management local function checkATISAudio() DebugLogger("CHECKING ATIS...") for _, z in pairs(ATIS_ZONE_LIST) do if checkInAtisZone(z,1) then if ATIS_LIST[z:GetName()]:GetState() == "Stopped" then ATIS_LIST[z:GetName()]:Start() DebugLogger("ATIS: " .. z:GetName() .. " HAS BEEN STARTED!") else DebugLogger(z:GetName() .. " IS ALREADY RUNNING.") end elseif ATIS_LIST[z:GetName()]:GetState() ~= nil and ATIS_LIST[z:GetName()]:GetState() == "Running" then ATIS_LIST[z:GetName()]:Stop() DebugLogger("ATIS " .. z:GetName() .. " HAS BEEN STOPPED!") end end DebugLogger("ATIS CHECK FINISHED.") end createActiveAirBases() createATISAudio(ACTIVE_AIRBASES) local atisChecker = SCHEDULER:New(nil, checkATISAudio, {}, CONFIG.CHECK_INTERVAL, CONFIG.CHECK_INTERVAL) -- Update logs that script loaded successfully DebugLogger("SCRIPT LOADING COMPLETE!")