This commit is contained in:
Frank 2020-08-19 22:32:16 +02:00
parent dee7307adc
commit f4bfcf58fd
6 changed files with 137 additions and 24 deletions

View File

@ -1748,7 +1748,11 @@ function AIRWING:_CreateFlightGroup(asset)
local flightgroup=FLIGHTGROUP:New(asset.spawngroupname) local flightgroup=FLIGHTGROUP:New(asset.spawngroupname)
-- Set airwing. -- Set airwing.
flightgroup:SetAirwing(self) flightgroup:SetAirwing(self)
flightgroup.squadron=self:GetSquadronOfAsset(asset)
--[[
--- Check if out of missiles. For A2A missions ==> RTB. --- Check if out of missiles. For A2A missions ==> RTB.
function flightgroup:OnAfterOutOfMissiles() function flightgroup:OnAfterOutOfMissiles()
@ -1774,6 +1778,8 @@ function AIRWING:_CreateFlightGroup(asset)
end end
]]
return flightgroup return flightgroup
end end

View File

@ -34,6 +34,7 @@
-- @field #boolean fuelcritical Fuel critical switch. -- @field #boolean fuelcritical Fuel critical switch.
-- @field #number fuelcriticalthresh Critical fuel threshold in percent. -- @field #number fuelcriticalthresh Critical fuel threshold in percent.
-- @field #boolean fuelcriticalrtb RTB on critical fuel switch. -- @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.AirWing#AIRWING airwing The airwing the flight group belongs to.
-- @field Ops.FlightControl#FLIGHTCONTROL flightcontrol The flightcontrol handling this group. -- @field Ops.FlightControl#FLIGHTCONTROL flightcontrol The flightcontrol handling this group.
-- @field Ops.Airboss#AIRBOSS airboss The airboss 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!") self:E(self.lid.."WARNING: Group was already initialized!")
return return
end end
local group=self.group --Wrapper.Group#GROUP
-- Get template of group. -- Get template of group.
self.template=self.group:GetTemplate() self.template=group:GetTemplate()
-- Define category. -- Define category.
self.isAircraft=true self.isAircraft=true
@ -2478,7 +2481,7 @@ function FLIGHTGROUP:_InitGroup()
self.isGround=false self.isGround=false
-- Helo group. -- Helo group.
self.ishelo=self.group:IsHelicopter() self.ishelo=group:IsHelicopter()
-- Is (template) group uncontrolled. -- Is (template) group uncontrolled.
self.isUncontrolled=self.template.uncontrolled self.isUncontrolled=self.template.uncontrolled
@ -2487,7 +2490,7 @@ function FLIGHTGROUP:_InitGroup()
self.isLateActivated=self.template.lateActivation self.isLateActivated=self.template.lateActivation
-- Max speed in km/h. -- 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. -- 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) local speedCruiseLimit=self.ishelo and UTILS.KnotsToKmph(80) or UTILS.KnotsToKmph(350)
@ -2525,7 +2528,7 @@ function FLIGHTGROUP:_InitGroup()
end end
-- Is this purely AI? -- Is this purely AI?
self.ai=not self:_IsHuman(self.group) self.ai=not self:_IsHuman(group)
-- Create Menu. -- Create Menu.
if not self.ai then if not self.ai then
@ -2607,10 +2610,11 @@ function FLIGHTGROUP:AddElementByName(unitname)
-- TODO: this is wrong when grouping is used! -- TODO: this is wrong when grouping is used!
local unittemplate=element.unit:GetTemplate() local unittemplate=element.unit:GetTemplate()
element.modex=element.unit:GetTemplate().onboard_num element.modex=unittemplate.onboard_num
element.skill=element.unit:GetTemplate().skill element.skill=unittemplate.skill
element.pylons=element.unit:GetTemplatePylons() element.payload=unittemplate.payload
element.fuelmass0=element.unit:GetTemplatePayload().fuel 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.fuelmass=element.fuelmass0
element.fuelrel=element.unit:GetFuel() element.fuelrel=element.unit:GetFuel()
element.category=element.unit:GetUnitCategory() element.category=element.unit:GetUnitCategory()

View File

@ -2052,6 +2052,34 @@ function OPSGROUP:onafterMissionDone(From, Event, To, Mission)
Mission.patroldata.noccupied=Mission.patroldata.noccupied-1 Mission.patroldata.noccupied=Mission.patroldata.noccupied-1
AIRWING.UpdatePatrolPointMarker(Mission.patroldata) AIRWING.UpdatePatrolPointMarker(Mission.patroldata)
end 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. -- TODO: reset mission specific parameters like radio, ROE etc.
@ -3183,6 +3211,11 @@ function OPSGROUP:SwitchTACAN(Channel, Morse, UnitName, Band)
-- Tacan frequency. -- Tacan frequency.
local Frequency=UTILS.TACANToFrequency(Channel, Band) local Frequency=UTILS.TACANToFrequency(Channel, Band)
-- Backup TACAN.
if self.tacan.Channel then
self.tacanDefault=UTILS.DeepCopy(self.tacan)
end
-- Update info. -- Update info.
self.tacan.Channel=Channel self.tacan.Channel=Channel
self.tacan.Morse=Morse self.tacan.Morse=Morse

View File

@ -529,6 +529,7 @@ function SQUADRON:FetchTacan()
for channel,free in pairs(self.tacanChannel) do for channel,free in pairs(self.tacanChannel) do
if free then if free then
self:I(self.lid..string.format("Checking out Tacan channel %d", channel))
self.tacanChannel[channel]=false self.tacanChannel[channel]=false
return channel return channel
end end
@ -541,6 +542,7 @@ end
-- @param #SQUADRON self -- @param #SQUADRON self
-- @param #number channel The channel that is available again. -- @param #number channel The channel that is available again.
function SQUADRON:ReturnTacan(channel) function SQUADRON:ReturnTacan(channel)
self:I(self.lid..string.format("Returning Tacan channel %d", channel))
self.tacanChannel[channel]=true self.tacanChannel[channel]=true
end end

View File

@ -111,16 +111,20 @@ PROFILER = {
-- @param #number Duration Duration in (game) seconds before the profiler is stopped. Default is when mission ends. -- @param #number Duration Duration in (game) seconds before the profiler is stopped. Default is when mission ends.
function PROFILER.Start(Delay, Duration) function PROFILER.Start(Delay, Duration)
-- Check if os and lfs are available. -- Check if os, io and lfs are available.
local go=true local go=true
if not os then if not os then
error("Profiler needs os to be desanitized") env.error("ERROR: Profiler needs os to be desanitized!")
go=false go=false
end end
if not io then
env.error("ERROR: Profiler needs io to be desanitized!")
go=false
end
if not lfs then if not lfs then
error("Profiler needs lfs to be desanitized") env.error("ERROR: Profiler needs lfs to be desanitized!")
go=false go=false
end end
if not go then if not go then
return return
end end
@ -136,16 +140,6 @@ function PROFILER.Start(Delay, Duration)
-- Add event handler. -- Add event handler.
world.addEventHandler(PROFILER.eventHandler) 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. -- Info in log.
env.info('############################ Profiler Started ############################') env.info('############################ Profiler Started ############################')
if Duration then if Duration then
@ -292,7 +286,7 @@ function PROFILER.showTable(data, f, runTimeGame)
if cps>=PROFILER.lowCpsThres then if cps>=PROFILER.lowCpsThres then
-- Output -- 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) PROFILER._flog(f, text)
end end

View File

@ -315,6 +315,80 @@ AIRBASE.TheChannel = {
["High_Halden"] = "High Halden", ["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". --- AIRBASE.ParkingSpot ".Coordinate, ".TerminalID", ".TerminalType", ".TOAC", ".Free", ".TerminalID0", ".DistToRwy".
-- @type AIRBASE.ParkingSpot -- @type AIRBASE.ParkingSpot
-- @field Core.Point#COORDINATE Coordinate Coordinate of the parking spot. -- @field Core.Point#COORDINATE Coordinate Coordinate of the parking spot.