diff --git a/Moose Development/Moose/Ops/AirWing.lua b/Moose Development/Moose/Ops/AirWing.lua index 52214c1f2..b6dc7ffc3 100644 --- a/Moose Development/Moose/Ops/AirWing.lua +++ b/Moose Development/Moose/Ops/AirWing.lua @@ -1748,7 +1748,11 @@ function AIRWING:_CreateFlightGroup(asset) local flightgroup=FLIGHTGROUP:New(asset.spawngroupname) -- Set airwing. - flightgroup:SetAirwing(self) + flightgroup:SetAirwing(self) + + flightgroup.squadron=self:GetSquadronOfAsset(asset) + + --[[ --- Check if out of missiles. For A2A missions ==> RTB. function flightgroup:OnAfterOutOfMissiles() @@ -1774,6 +1778,8 @@ function AIRWING:_CreateFlightGroup(asset) end + ]] + return flightgroup end diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index b3ecb9298..1ae0ec45e 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -34,6 +34,7 @@ -- @field #boolean fuelcritical Fuel critical switch. -- @field #number fuelcriticalthresh Critical fuel threshold in percent. -- @field #boolean fuelcriticalrtb RTB on critical fuel switch. +-- @field Ops.Squadron#SQUADRON squadron The squadron of this flight group. -- @field Ops.AirWing#AIRWING airwing The airwing the flight group belongs to. -- @field Ops.FlightControl#FLIGHTCONTROL flightcontrol The flightcontrol handling this group. -- @field Ops.Airboss#AIRBOSS airboss The airboss handling this group. @@ -2468,9 +2469,11 @@ function FLIGHTGROUP:_InitGroup() self:E(self.lid.."WARNING: Group was already initialized!") return end + + local group=self.group --Wrapper.Group#GROUP -- Get template of group. - self.template=self.group:GetTemplate() + self.template=group:GetTemplate() -- Define category. self.isAircraft=true @@ -2478,7 +2481,7 @@ function FLIGHTGROUP:_InitGroup() self.isGround=false -- Helo group. - self.ishelo=self.group:IsHelicopter() + self.ishelo=group:IsHelicopter() -- Is (template) group uncontrolled. self.isUncontrolled=self.template.uncontrolled @@ -2487,7 +2490,7 @@ function FLIGHTGROUP:_InitGroup() self.isLateActivated=self.template.lateActivation -- Max speed in km/h. - self.speedmax=self.group:GetSpeedMax() + self.speedmax=group:GetSpeedMax() -- Cruise speed limit 350 kts for fixed and 80 knots for rotary wings. local speedCruiseLimit=self.ishelo and UTILS.KnotsToKmph(80) or UTILS.KnotsToKmph(350) @@ -2525,7 +2528,7 @@ function FLIGHTGROUP:_InitGroup() end -- Is this purely AI? - self.ai=not self:_IsHuman(self.group) + self.ai=not self:_IsHuman(group) -- Create Menu. if not self.ai then @@ -2607,10 +2610,11 @@ function FLIGHTGROUP:AddElementByName(unitname) -- TODO: this is wrong when grouping is used! local unittemplate=element.unit:GetTemplate() - element.modex=element.unit:GetTemplate().onboard_num - element.skill=element.unit:GetTemplate().skill - element.pylons=element.unit:GetTemplatePylons() - element.fuelmass0=element.unit:GetTemplatePayload().fuel + element.modex=unittemplate.onboard_num + element.skill=unittemplate.skill + element.payload=unittemplate.payload + element.pylons=unittemplate.payload and unittemplate.payload.pylons or nil --element.unit:GetTemplatePylons() + element.fuelmass0=unittemplate.payload and unittemplate.payload.fuel or 0 --element.unit:GetTemplatePayload().fuel element.fuelmass=element.fuelmass0 element.fuelrel=element.unit:GetFuel() element.category=element.unit:GetUnitCategory() diff --git a/Moose Development/Moose/Ops/OpsGroup.lua b/Moose Development/Moose/Ops/OpsGroup.lua index 6b64b3d73..229daab70 100644 --- a/Moose Development/Moose/Ops/OpsGroup.lua +++ b/Moose Development/Moose/Ops/OpsGroup.lua @@ -2052,6 +2052,34 @@ function OPSGROUP:onafterMissionDone(From, Event, To, Mission) Mission.patroldata.noccupied=Mission.patroldata.noccupied-1 AIRWING.UpdatePatrolPointMarker(Mission.patroldata) end + + env.info("FF 000") + + -- TACAN + if Mission.tacan then + + env.info("FF 100") + + if self.tacanDefault then + env.info("FF 200") + self:_SwitchTACAN(self.tacanDefault) + else + env.info("FF 300") + self:TurnOffTACAN() + end + + local squadron=self.squadron --Ops.Squadron#SQUADRON + if squadron then + env.info("FF 400") + squadron:ReturnTacan(Mission.tacan.Channel) + end + + local asset=Mission:GetAssetByName(self.groupname) + if asset then + env.info("FF 500") + asset.tacan=nil + end + end -- TODO: reset mission specific parameters like radio, ROE etc. @@ -3183,6 +3211,11 @@ function OPSGROUP:SwitchTACAN(Channel, Morse, UnitName, Band) -- Tacan frequency. local Frequency=UTILS.TACANToFrequency(Channel, Band) + -- Backup TACAN. + if self.tacan.Channel then + self.tacanDefault=UTILS.DeepCopy(self.tacan) + end + -- Update info. self.tacan.Channel=Channel self.tacan.Morse=Morse diff --git a/Moose Development/Moose/Ops/Squadron.lua b/Moose Development/Moose/Ops/Squadron.lua index 2b7bdbc4f..5f446d3e5 100644 --- a/Moose Development/Moose/Ops/Squadron.lua +++ b/Moose Development/Moose/Ops/Squadron.lua @@ -529,6 +529,7 @@ function SQUADRON:FetchTacan() for channel,free in pairs(self.tacanChannel) do if free then + self:I(self.lid..string.format("Checking out Tacan channel %d", channel)) self.tacanChannel[channel]=false return channel end @@ -541,6 +542,7 @@ end -- @param #SQUADRON self -- @param #number channel The channel that is available again. function SQUADRON:ReturnTacan(channel) + self:I(self.lid..string.format("Returning Tacan channel %d", channel)) self.tacanChannel[channel]=true end diff --git a/Moose Development/Moose/Utilities/Profiler.lua b/Moose Development/Moose/Utilities/Profiler.lua index c1667bc3b..76fee9dcc 100644 --- a/Moose Development/Moose/Utilities/Profiler.lua +++ b/Moose Development/Moose/Utilities/Profiler.lua @@ -111,16 +111,20 @@ PROFILER = { -- @param #number Duration Duration in (game) seconds before the profiler is stopped. Default is when mission ends. function PROFILER.Start(Delay, Duration) - -- Check if os and lfs are available. + -- Check if os, io and lfs are available. local go=true if not os then - error("Profiler needs os to be desanitized") + env.error("ERROR: Profiler needs os to be desanitized!") go=false end + if not io then + env.error("ERROR: Profiler needs io to be desanitized!") + go=false + end if not lfs then - error("Profiler needs lfs to be desanitized") + env.error("ERROR: Profiler needs lfs to be desanitized!") go=false - end + end if not go then return end @@ -136,16 +140,6 @@ function PROFILER.Start(Delay, Duration) -- Add event handler. world.addEventHandler(PROFILER.eventHandler) - --[[ - -- Message to screen. - local function showProfilerRunning() - timer.scheduleFunction(showProfilerRunning, nil, timer.getTime()+600) - trigger.action.outText("### Profiler running ###", 600) - end - -- Message. - showProfilerRunning() - ]] - -- Info in log. env.info('############################ Profiler Started ############################') if Duration then @@ -292,7 +286,7 @@ function PROFILER.showTable(data, f, runTimeGame) if cps>=PROFILER.lowCpsThres then -- Output - local text=string.format("%30s: %8d calls %8.1f/sec - Time Total %8.3f sec (%.3f %%) - Per call %5.3f sec %s line %s", t.func, t.count, cps, t.tm, t.tm/runTimeGame*100, t.tm/t.count, tostring(t.src), tostring(t.line)) + local text=string.format("%30s: %8d calls %8.1f/sec - Time Total %8.3f sec (%.3f %%) %5.3f sec/call %s line %s", t.func, t.count, cps, t.tm, t.tm/runTimeGame*100, t.tm/t.count, tostring(t.src), tostring(t.line)) PROFILER._flog(f, text) end diff --git a/Moose Development/Moose/Wrapper/Airbase.lua b/Moose Development/Moose/Wrapper/Airbase.lua index 9c5675c53..234a92533 100644 --- a/Moose Development/Moose/Wrapper/Airbase.lua +++ b/Moose Development/Moose/Wrapper/Airbase.lua @@ -315,6 +315,80 @@ AIRBASE.TheChannel = { ["High_Halden"] = "High Halden", } +--- Airbases of Syria +-- +-- * AIRBASE.Syria.Kuweires +-- * AIRBASE.Syria.Marj_Ruhayyil +-- * AIRBASE.Syria.Kiryat_Shmona +-- * AIRBASE.Syria.Marj_as_Sultan_North +-- * AIRBASE.Syria.Eyn_Shemer +-- * AIRBASE.Syria.Incirlik +-- * AIRBASE.Syria.Damascus +-- * AIRBASE.Syria.Bassel_Al_Assad +-- * AIRBASE.Syria.Aleppo +-- * AIRBASE.Syria.Qabr_as_Sitt +-- * AIRBASE.Syria.Wujah_Al_Hajar +-- * AIRBASE.Syria.Al_Dumayr +-- * AIRBASE.Syria.Hatay +-- * AIRBASE.Syria.Haifa +-- * AIRBASE.Syria.Khalkhalah +-- * AIRBASE.Syria.Megiddo +-- * AIRBASE.Syria.Rayak +-- * AIRBASE.Syria.Mezzeh +-- * AIRBASE.Syria.King_Hussein_Air_College +-- * AIRBASE.Syria.Jirah +-- * AIRBASE.Syria.Taftanaz +-- * AIRBASE.Syria.Rene_Mouawad +-- * AIRBASE.Syria.Ramat_David +-- * AIRBASE.Syria.Minakh +-- * AIRBASE.Syria.Adana_Sakirpasa +-- * AIRBASE.Syria.Marj_as_Sultan_South +-- * AIRBASE.Syria.Hama +-- * AIRBASE.Syria.Al_Qusayr +-- * AIRBASE.Syria.Palmyra +-- * AIRBASE.Syria.Tabqa +-- * AIRBASE.Syria.Beirut_Rafic_Hariri +-- * AIRBASE.Syria.An_Nasiriyah +-- * AIRBASE.Syria.Abu_al_Duhur +-- +-- @field Syria +AIRBASE.Syria={ + ["Kuweires"]="Kuweires", + ["Marj_Ruhayyil"]="Marj Ruhayyil", + ["Kiryat_Shmona"]="Kiryat Shmona", + ["Marj_as_Sultan_North"]="Marj as Sultan North", + ["Eyn_Shemer"]="Eyn Shemer", + ["Incirlik"]="Incirlik", + ["Damascus"]="Damascus", + ["Bassel_Al_Assad"]="Bassel Al-Assad", + ["Aleppo"]="Aleppo", + ["Qabr_as_Sitt"]="Qabr as Sitt", + ["Wujah_Al_Hajar"]="Wujah Al Hajar", + ["Al_Dumayr"]="Al-Dumayr", + ["Hatay"]="Hatay", + ["Haifa"]="Haifa", + ["Khalkhalah"]="Khalkhalah", + ["Megiddo"]="Megiddo", + ["Rayak"]="Rayak", + ["Mezzeh"]="Mezzeh", + ["King_Hussein_Air_College"]="King Hussein Air College", + ["Jirah"]="Jirah", + ["Taftanaz"]="Taftanaz", + ["Rene_Mouawad"]="Rene Mouawad", + ["Ramat_David"]="Ramat David", + ["Minakh"]="Minakh", + ["Adana_Sakirpasa"]="Adana Sakirpasa", + ["Marj_as_Sultan_South"]="Marj as Sultan South", + ["Hama"]="Hama", + ["Al_Qusayr"]="Al Qusayr", + ["Palmyra"]="Palmyra", + ["Tabqa"]="Tabqa", + ["Beirut_Rafic_Hariri"]="Beirut-Rafic Hariri", + ["An_Nasiriyah"]="An Nasiriyah", + ["Abu_al_Duhur"]="Abu al-Duhur", +} + + --- AIRBASE.ParkingSpot ".Coordinate, ".TerminalID", ".TerminalType", ".TOAC", ".Free", ".TerminalID0", ".DistToRwy". -- @type AIRBASE.ParkingSpot -- @field Core.Point#COORDINATE Coordinate Coordinate of the parking spot.