mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-19 05:36:02 +00:00
Merge branch 'FF/Ops' into FF/Fox2
This commit is contained in:
@@ -5162,7 +5162,7 @@ function WAREHOUSE:onafterAssetSpawned(From, Event, To, group, asset, request)
|
||||
local assetitem=_asset --#WAREHOUSE.Assetitem
|
||||
|
||||
-- Debug info.
|
||||
self:I(self.lid..string.format("Asset %s spawned=%s as %s", assetitem.templatename, tostring(assetitem.spawned), tostring(assetitem.spawngroupname)))
|
||||
self:T2(self.lid..string.format("Asset %s spawned %s as %s", assetitem.templatename, tostring(assetitem.spawned), tostring(assetitem.spawngroupname)))
|
||||
|
||||
if assetitem.spawned then
|
||||
n=n+1
|
||||
@@ -6123,6 +6123,9 @@ function WAREHOUSE:_OnEventBirth(EventData)
|
||||
-- Debug message.
|
||||
self:T(self.lid..string.format("Warehouse %s captured event birth of its asset unit %s. spawned=%s", self.alias, EventData.IniUnitName, tostring(asset.spawned)))
|
||||
|
||||
-- Birth is triggered for each unit. We need to make sure not to call this too often!
|
||||
if not asset.spawned then
|
||||
|
||||
if request then
|
||||
|
||||
|
||||
|
||||
@@ -2973,7 +2973,7 @@ function AUFTRAG:GetDCSMissionTask(TaskControllable)
|
||||
-- FAC Mission --
|
||||
-----------------
|
||||
|
||||
local DCStask=CONTROLLABLE.TaskFAC_AttackGroup(nil, self.engageTarget.Target, self.engageWeaponType, self.facDesignation, self.facDatalink, self.facFrequency, self.facModulation, CallsignName, CallsignNumber)
|
||||
local DCStask=CONTROLLABLE.TaskFAC_AttackGroup(nil, self.engageTarget.Target, self.engageWeaponType, self.facDesignation, self.facDatalink, self.facFreq, self.facModu, CallsignName, CallsignNumber)
|
||||
|
||||
table.insert(DCStasks, DCStask)
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
-- @field #table menu F10 radio menu.
|
||||
-- @field #string controlstatus Flight control status.
|
||||
-- @field #boolean ishelo If true, the is a helicopter group.
|
||||
-- @field #number callsignName Callsign name.
|
||||
-- @field #number callsignNumber Callsign number.
|
||||
--
|
||||
-- @extends Ops.OpsGroup#OPSGROUP
|
||||
|
||||
@@ -294,13 +296,13 @@ function FLIGHTGROUP:New(group)
|
||||
self:AddTransition("*", "ElementOutOfAmmo", "*") -- An element is completely out of ammo.
|
||||
|
||||
|
||||
self:AddTransition("*", "FlightParking", "Parking") -- The whole flight group is parking.
|
||||
self:AddTransition("*", "FlightTaxiing", "Taxiing") -- The whole flight group is taxiing.
|
||||
self:AddTransition("*", "FlightTakeoff", "Airborne") -- The whole flight group is airborne.
|
||||
self:AddTransition("*", "FlightAirborne", "Airborne") -- The whole flight group is airborne.
|
||||
self:AddTransition("*", "FlightLanding", "Landing") -- The whole flight group is landing.
|
||||
self:AddTransition("*", "FlightLanded", "Landed") -- The whole flight group has landed.
|
||||
self:AddTransition("*", "FlightArrived", "Arrived") -- The whole flight group has arrived.
|
||||
self:AddTransition("*", "Parking", "Parking") -- The whole flight group is parking.
|
||||
self:AddTransition("*", "Taxiing", "Taxiing") -- The whole flight group is taxiing.
|
||||
self:AddTransition("*", "Takeoff", "Airborne") -- The whole flight group is airborne.
|
||||
self:AddTransition("*", "Airborne", "Airborne") -- The whole flight group is airborne.
|
||||
self:AddTransition("*", "Landing", "Landing") -- The whole flight group is landing.
|
||||
self:AddTransition("*", "Landed", "Landed") -- The whole flight group has landed.
|
||||
self:AddTransition("*", "Arrived", "Arrived") -- The whole flight group has arrived.
|
||||
|
||||
|
||||
------------------------
|
||||
@@ -1113,13 +1115,13 @@ function FLIGHTGROUP:OnEventEngineShutdown(EventData)
|
||||
self:ElementArrived(element, airbase, parking)
|
||||
self:T3(self.lid..string.format("EVENT: Element %s shut down engines ==> arrived", element.name))
|
||||
else
|
||||
self:T3(self.lid..string.format("EVENT: Element %s shut down engines (in air) ==> dead", element.name))
|
||||
self:ElementDead(element)
|
||||
self:T3(self.lid..string.format("EVENT: Element %s shut down engines but is not parking. Is it dead?", element.name))
|
||||
--self:ElementDead(element)
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
self:I(self.lid..string.format("EVENT: Element %s shut down engines but is NOT alive ==> waiting for crash event (==> dead)", element.name))
|
||||
--self:I(self.lid..string.format("EVENT: Element %s shut down engines but is NOT alive ==> waiting for crash event (==> dead)", element.name))
|
||||
|
||||
end
|
||||
|
||||
@@ -1163,6 +1165,19 @@ function FLIGHTGROUP:OnEventUnitLost(EventData)
|
||||
-- Check that this is the right group.
|
||||
if EventData and EventData.IniGroup and EventData.IniUnit and EventData.IniGroupName and EventData.IniGroupName==self.groupname then
|
||||
self:I(self.lid..string.format("EVENT: Unit %s lost!", EventData.IniUnitName))
|
||||
|
||||
local unit=EventData.IniUnit
|
||||
local group=EventData.IniGroup
|
||||
local unitname=EventData.IniUnitName
|
||||
|
||||
-- Get element.
|
||||
local element=self:GetElementByName(unitname)
|
||||
|
||||
if element then
|
||||
self:T3(self.lid..string.format("EVENT: Element %s crashed ==> dead", element.name))
|
||||
self:ElementDead(element)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1414,6 +1429,11 @@ function FLIGHTGROUP:onafterSpawned(From, Event, To)
|
||||
if self.radioFreqDefault then
|
||||
self:SwitchRadioOn(self.radioFreqDefault, self.radioModuDefault)
|
||||
end
|
||||
|
||||
-- Set callsign.
|
||||
if self.callsignNameDefault then
|
||||
self:SwitchCallsign(self.callsignNameDefault, self.callsignNumberDefault)
|
||||
end
|
||||
|
||||
-- Update route.
|
||||
self:__UpdateRoute(-0.5)
|
||||
@@ -1427,12 +1447,12 @@ function FLIGHTGROUP:onafterSpawned(From, Event, To)
|
||||
|
||||
end
|
||||
|
||||
--- On after "FlightParking" event. Add flight to flightcontrol of airbase.
|
||||
--- On after "Parking" event. Add flight to flightcontrol of airbase.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function FLIGHTGROUP:onafterFlightParking(From, Event, To)
|
||||
function FLIGHTGROUP:onafterParking(From, Event, To)
|
||||
self:I(self.lid..string.format("Flight is parking"))
|
||||
|
||||
local airbase=self.group:GetCoordinate():GetClosestAirbase()
|
||||
@@ -1464,12 +1484,12 @@ function FLIGHTGROUP:onafterFlightParking(From, Event, To)
|
||||
end
|
||||
end
|
||||
|
||||
--- On after "FlightTaxiing" event.
|
||||
--- On after "Taxiing" event.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function FLIGHTGROUP:onafterFlightTaxiing(From, Event, To)
|
||||
function FLIGHTGROUP:onafterTaxiing(From, Event, To)
|
||||
self:T(self.lid..string.format("Flight is taxiing"))
|
||||
|
||||
-- Parking over.
|
||||
@@ -1495,13 +1515,13 @@ function FLIGHTGROUP:onafterFlightTaxiing(From, Event, To)
|
||||
|
||||
end
|
||||
|
||||
--- On after "FlightTakeoff" event.
|
||||
--- On after "Takeoff" event.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Wrapper.Airbase#AIRBASE airbase The airbase the flight landed.
|
||||
function FLIGHTGROUP:onafterFlightTakeoff(From, Event, To, airbase)
|
||||
function FLIGHTGROUP:onafterTakeoff(From, Event, To, airbase)
|
||||
self:T(self.lid..string.format("Flight takeoff from %s", airbase and airbase:GetName() or "unknown airbase"))
|
||||
|
||||
-- Remove flight from all FC queues.
|
||||
@@ -1512,12 +1532,12 @@ function FLIGHTGROUP:onafterFlightTakeoff(From, Event, To, airbase)
|
||||
|
||||
end
|
||||
|
||||
--- On after "FlightAirborne" event.
|
||||
--- On after "Airborne" event.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function FLIGHTGROUP:onafterFlightAirborne(From, Event, To)
|
||||
function FLIGHTGROUP:onafterAirborne(From, Event, To)
|
||||
self:I(self.lid..string.format("Flight airborne"))
|
||||
|
||||
if not self.ai then
|
||||
@@ -1525,25 +1545,25 @@ function FLIGHTGROUP:onafterFlightAirborne(From, Event, To)
|
||||
end
|
||||
end
|
||||
|
||||
--- On after "FlightLanding" event.
|
||||
--- On after "Landing" event.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function FLIGHTGROUP:onafterFlightLanding(From, Event, To)
|
||||
function FLIGHTGROUP:onafterLanding(From, Event, To)
|
||||
self:T(self.lid..string.format("Flight is landing"))
|
||||
|
||||
self:_SetElementStatusAll(OPSGROUP.ElementStatus.LANDING)
|
||||
|
||||
end
|
||||
|
||||
--- On after "FlightLanded" event.
|
||||
--- On after "Landed" event.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Wrapper.Airbase#AIRBASE airbase The airbase the flight landed.
|
||||
function FLIGHTGROUP:onafterFlightLanded(From, Event, To, airbase)
|
||||
function FLIGHTGROUP:onafterLanded(From, Event, To, airbase)
|
||||
self:T(self.lid..string.format("Flight landed at %s", airbase and airbase:GetName() or "unknown place"))
|
||||
|
||||
if self:IsLandingAt() then
|
||||
@@ -1556,12 +1576,12 @@ function FLIGHTGROUP:onafterFlightLanded(From, Event, To, airbase)
|
||||
end
|
||||
end
|
||||
|
||||
--- On after "FlightArrived" event.
|
||||
--- On after "Arrived" event.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function FLIGHTGROUP:onafterFlightArrived(From, Event, To)
|
||||
function FLIGHTGROUP:onafterArrived(From, Event, To)
|
||||
self:T(self.lid..string.format("Flight arrived"))
|
||||
|
||||
-- Flight Control
|
||||
@@ -2438,8 +2458,8 @@ end
|
||||
function FLIGHTGROUP._ClearedToLand(group, flightgroup)
|
||||
flightgroup:I(flightgroup.lid..string.format("Group was cleared to land"))
|
||||
|
||||
-- Trigger FlightLanding event.
|
||||
flightgroup:__FlightLanding(-1)
|
||||
-- Trigger Landing event.
|
||||
flightgroup:__Landing(-1)
|
||||
end
|
||||
|
||||
--- Function called when flight finished refuelling.
|
||||
@@ -3712,6 +3732,42 @@ function FLIGHTGROUP:SwitchFormation(Formation)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set default formation.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #number CallsignName Callsign name.
|
||||
-- @param #number CallsignNumber Callsign number.
|
||||
-- @return #FLIGHTGROUP self
|
||||
function FLIGHTGROUP:SetDefaultCallsign(CallsignName, CallsignNumber)
|
||||
|
||||
self.callsignNameDefault=CallsignName
|
||||
self.callsignNumberDefault=CallsignNumber or 1
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Switch to a specific callsign.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #number CallsignName Callsign name.
|
||||
-- @param #number CallsignNumber Callsign number.
|
||||
-- @return #FLIGHTGROUP self
|
||||
function FLIGHTGROUP:SwitchCallsign(CallsignName, CallsignNumber)
|
||||
|
||||
if self:IsAlive() and CallsignName then
|
||||
|
||||
self.callsignName=CallsignName
|
||||
self.callsignNumber=CallsignNumber or 1
|
||||
|
||||
self:I(self.lid..string.format("Switching callsign to %d-%d", self.callsignName, self.callsignNumber))
|
||||
|
||||
local group=self.group --Wrapper.Group#GROUP
|
||||
|
||||
group:CommandSetCallsign(self.callsignName, self.callsignNumber)
|
||||
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- MENU FUNCTIONS
|
||||
|
||||
@@ -59,9 +59,10 @@ NAVYGROUP.version="0.0.1"
|
||||
-- TODO list
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: Stop and resume route.
|
||||
-- TODO: Add waypoints.
|
||||
-- TODO: Add tasks.
|
||||
-- TODO: Detour, add temporary waypoint and resume route.
|
||||
-- DONE: Stop and resume route.
|
||||
-- DONE: Add waypoints.
|
||||
-- DONE: Add tasks.
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Constructor
|
||||
@@ -392,10 +393,11 @@ function NAVYGROUP:onafterUpdateRoute(From, Event, To, n, Speed, Depth)
|
||||
---
|
||||
|
||||
self:I(self.lid..string.format("No waypoints left"))
|
||||
|
||||
-- TODO: Switch to waypoint 1
|
||||
|
||||
--self:UpdateRoute(1)
|
||||
|
||||
if #self.waypoints>1 then
|
||||
self:I(self.lid..string.format("Resuming route at first waypoint"))
|
||||
self:UpdateRoute(1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -64,9 +64,6 @@
|
||||
-- @field #boolean radioOn If true, radio is currently turned on.
|
||||
-- @field Core.RadioQueue#RADIOQUEUE radioQueue Radio queue.
|
||||
--
|
||||
-- @field #number CallsignName Call sign name.
|
||||
-- @field #number CallsignNumber Call sign number.
|
||||
--
|
||||
-- @field #boolean eplrsDefault Default EPLRS data link setting.
|
||||
-- @field #boolean eplrs If true, EPLRS data link is on.
|
||||
--
|
||||
@@ -2455,7 +2452,7 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
||||
---
|
||||
|
||||
if self:_AllSimilarStatus(newstatus) then
|
||||
self:__FlightParking(-0.5)
|
||||
self:__Parking(-0.5)
|
||||
end
|
||||
|
||||
elseif newstatus==OPSGROUP.ElementStatus.ENGINEON then
|
||||
@@ -2471,7 +2468,7 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
||||
---
|
||||
|
||||
if self:_AllSimilarStatus(newstatus) then
|
||||
self:__FlightTaxiing(-0.5)
|
||||
self:__Taxiing(-0.5)
|
||||
end
|
||||
|
||||
elseif newstatus==OPSGROUP.ElementStatus.TAKEOFF then
|
||||
@@ -2481,7 +2478,7 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
||||
|
||||
if self:_AllSimilarStatus(newstatus) then
|
||||
-- Trigger takeoff event. Also triggers airborne event.
|
||||
self:__FlightTakeoff(-0.5, airbase)
|
||||
self:__Takeoff(-0.5, airbase)
|
||||
end
|
||||
|
||||
elseif newstatus==OPSGROUP.ElementStatus.AIRBORNE then
|
||||
@@ -2490,7 +2487,7 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
||||
---
|
||||
|
||||
if self:_AllSimilarStatus(newstatus) then
|
||||
self:__FlightAirborne(-0.5)
|
||||
self:__Airborne(-0.5)
|
||||
end
|
||||
|
||||
elseif newstatus==OPSGROUP.ElementStatus.LANDED then
|
||||
@@ -2499,7 +2496,7 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
||||
---
|
||||
|
||||
if self:_AllSimilarStatus(newstatus) then
|
||||
self:FlightLanded(airbase)
|
||||
self:Landed(airbase)
|
||||
end
|
||||
|
||||
elseif newstatus==OPSGROUP.ElementStatus.ARRIVED then
|
||||
@@ -2510,10 +2507,10 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
||||
if self:_AllSimilarStatus(newstatus) then
|
||||
|
||||
if self:IsLanded() then
|
||||
self:FlightArrived()
|
||||
self:Arrived()
|
||||
elseif self:IsAirborne() then
|
||||
self:FlightLanded()
|
||||
self:FlightArrived()
|
||||
self:Landed()
|
||||
self:Arrived()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1472,8 +1472,8 @@ end
|
||||
-- @param #number WeaponType Bitmask of weapon types, which are allowed to use.
|
||||
-- @param DCS#AI.Task.Designation Designation (Optional) Designation type.
|
||||
-- @param #boolean Datalink (Optional) Allows to use datalink to send the target information to attack aircraft. Enabled by default.
|
||||
-- @param #number Frequency Frequency used to communicate with the FAC.
|
||||
-- @param #number Modulation Modulation of radio for communication.
|
||||
-- @param #number Frequency Frequency in MHz used to communicate with the FAC. Default 133 MHz.
|
||||
-- @param #number Modulation Modulation of radio for communication. Default 0=AM.
|
||||
-- @param #number CallsignName Callsign enumerator name of the FAC.
|
||||
-- @param #number CallsignNumber Callsign number, e.g. Axeman-**1**.
|
||||
-- @return DCS#Task The DCS task structure.
|
||||
@@ -1483,11 +1483,11 @@ function CONTROLLABLE:TaskFAC_AttackGroup( AttackGroup, WeaponType, Designation,
|
||||
id = 'FAC_AttackGroup',
|
||||
params = {
|
||||
groupId = AttackGroup:GetID(),
|
||||
weaponType = WeaponType,
|
||||
designation = Designation,
|
||||
datalink = Datalink,
|
||||
frequency = Frequency,
|
||||
modulation = Modulation,
|
||||
weaponType = WeaponType or ENUMS.WeaponFlag.AutoDCS,
|
||||
designation = Designation or "Auto",
|
||||
datalink = Datalink and Datalink or true,
|
||||
frequency = (Frequency or 133)*1000000,
|
||||
modulation = Modulation or radio.modulation.AM,
|
||||
callname = CallsignName,
|
||||
number = CallsignNumber,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user