-- ***************************************************************************** -- ** ATIS ** -- ********************************************************* --- Enable ATIS for a specific airbase. ---@param airbase string The name of the airbase for which to enable ATIS for. (MOOSE Enum) function EnableAtis(airbase) for _, atis in ipairs(ATISArray) do if atis.customconfig.airfield == airbase then -- Enable ATIS atis:Start() jtff_log.info(string.format("ATIS at airfield %s enabled (usually by bot).", atis.customconfig.airfield),"ATIS") atis.menu[coalition.side.BLUE]:Remove() atis.menu[coalition.side.BLUE] = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Disable Auto Atis at " .. atis.customconfig.airfield, MenuCoalitionAtis[coalition.side.BLUE], DisableAtis, atis.customconfig.airfield ) atis.menu[coalition.side.RED]:Remove() atis.menu[coalition.side.RED] = MENU_COALITION_COMMAND:New( coalition.side.RED, "Disable Auto Atis at " .. atis.customconfig.airfield, MenuCoalitionAtis[coalition.side.RED], DisableAtis, atis.customconfig.airfield ) return true end end end --- Disable ATIS for a specific airbase. ---@param airbase string The name of the airbase for which to disable ATIS for. (MOOSE Enum) function DisableAtis(airbase) for _, atis in ipairs(ATISArray) do if atis.customconfig.airfield == airbase then -- Disable ATIS atis:Stop() jtff_log.info(string.format("ATIS at airfield %s disabled (usually by bot).", atis.customconfig.airfield),"ATIS") atis.menu[coalition.side.BLUE]:Remove() atis.menu[coalition.side.BLUE] = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Enable Auto Atis at " .. atis.customconfig.airfield, MenuCoalitionAtis[coalition.side.BLUE], EnableAtis, atis.customconfig.airfield ) atis.menu[coalition.side.RED]:Remove() atis.menu[coalition.side.RED] = MENU_COALITION_COMMAND:New( coalition.side.RED, "Enable Auto Atis at " .. atis.customconfig.airfield, MenuCoalitionAtis[coalition.side.RED], EnableAtis, atis.customconfig.airfield ) return true end end end ATISArray = {} compteur = 0 MenuCoalitionAtis = {} MenuCoalitionAtis[coalition.side.BLUE] = MENU_COALITION:New(coalition.side.BLUE, "Atis", MenuCoalitionBlue) MenuCoalitionAtis[coalition.side.RED] = MENU_COALITION:New(coalition.side.RED, "Atis", MenuCoalitionRed) for index, atisconfig in ipairs(AtisConfig) do if atisconfig.enable == true then compteur = compteur + 1 jtff_log.info(string.format("Creation ATIS at airfield %s", atisconfig.airfield),"ATIS") local objAtis = ATIS:New(atisconfig.airfield, atisconfig.radio.freq, atisconfig.radio.modulation) :SetImperialUnits() :SetSoundfilesPath(soundFilesPrefix .. 'ATIS/ATIS Soundfiles/') :SetSubtitleDuration(0) :SetMapMarks(true) if (atisconfig.radio.relayunit) then objAtis:SetRadioRelayUnitName(atisconfig.radio.relayunit) else if (atisconfig.radio.power) then objAtis:SetRadioPower(atisconfig.radio.power) end end if (atisconfig.radio.tower) then objAtis:SetTowerFrequencies(atisconfig.radio.tower); end if (atisconfig.active.side) then if (atisconfig.active.number) then objAtis:SetActiveRunway(atisconfig.active.number..atisconfig.active.side) else objAtis:SetActiveRunway(atisconfig.active.side) end else if (atisconfig.active.number) then objAtis:SetActiveRunway(atisconfig.active.number) end end if (atisconfig.tacan) then objAtis:SetTACAN(atisconfig.tacan.channel) end if (atisconfig.ils) then if (atisconfig.ils.runway) then objAtis:AddILS(atisconfig.ils.freq, atisconfig.ils.runway) else objAtis:AddILS(atisconfig.ils.freq) end end if (atisconfig.useSRS) then objAtis:SetSRS(SRSConfig.path, "male", "en-US", nil, SRSConfig.port) end objAtis.customconfig = atisconfig objAtis.menu = {} objAtis.menu[coalition.side.BLUE] = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Disable Auto Atis at " .. atisconfig.airfield, MenuCoalitionAtis[coalition.side.BLUE], DisableAtis, atisconfig.airfield ) objAtis.menu[coalition.side.RED] = MENU_COALITION_COMMAND:New( coalition.side.RED, "Disable Auto Atis at " .. atisconfig.airfield, MenuCoalitionAtis[coalition.side.RED], DisableAtis, atisconfig.airfield ) ATISArray[compteur] = objAtis ATISArray[compteur]:Start() end end if compteur == 0 then MenuCoalitionAtis[coalition.side.BLUE]:Remove() MenuCoalitionAtis[coalition.side.RED]:Remove() MenuCoalitionAtis = {} end