mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Ops
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user