mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Ops
This commit is contained in:
parent
d93d0afdf3
commit
f2e417b21f
@ -2973,7 +2973,7 @@ function AUFTRAG:GetDCSMissionTask(TaskControllable)
|
|||||||
-- FAC Mission --
|
-- 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)
|
table.insert(DCStasks, DCStask)
|
||||||
|
|
||||||
|
|||||||
@ -296,13 +296,13 @@ function FLIGHTGROUP:New(group)
|
|||||||
self:AddTransition("*", "ElementOutOfAmmo", "*") -- An element is completely out of ammo.
|
self:AddTransition("*", "ElementOutOfAmmo", "*") -- An element is completely out of ammo.
|
||||||
|
|
||||||
|
|
||||||
self:AddTransition("*", "FlightParking", "Parking") -- The whole flight group is parking.
|
self:AddTransition("*", "Parking", "Parking") -- The whole flight group is parking.
|
||||||
self:AddTransition("*", "FlightTaxiing", "Taxiing") -- The whole flight group is taxiing.
|
self:AddTransition("*", "Taxiing", "Taxiing") -- The whole flight group is taxiing.
|
||||||
self:AddTransition("*", "FlightTakeoff", "Airborne") -- The whole flight group is airborne.
|
self:AddTransition("*", "Takeoff", "Airborne") -- The whole flight group is airborne.
|
||||||
self:AddTransition("*", "FlightAirborne", "Airborne") -- The whole flight group is airborne.
|
self:AddTransition("*", "Airborne", "Airborne") -- The whole flight group is airborne.
|
||||||
self:AddTransition("*", "FlightLanding", "Landing") -- The whole flight group is landing.
|
self:AddTransition("*", "Landing", "Landing") -- The whole flight group is landing.
|
||||||
self:AddTransition("*", "FlightLanded", "Landed") -- The whole flight group has landed.
|
self:AddTransition("*", "Landed", "Landed") -- The whole flight group has landed.
|
||||||
self:AddTransition("*", "FlightArrived", "Arrived") -- The whole flight group has arrived.
|
self:AddTransition("*", "Arrived", "Arrived") -- The whole flight group has arrived.
|
||||||
|
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
@ -1115,13 +1115,13 @@ function FLIGHTGROUP:OnEventEngineShutdown(EventData)
|
|||||||
self:ElementArrived(element, airbase, parking)
|
self:ElementArrived(element, airbase, parking)
|
||||||
self:T3(self.lid..string.format("EVENT: Element %s shut down engines ==> arrived", element.name))
|
self:T3(self.lid..string.format("EVENT: Element %s shut down engines ==> arrived", element.name))
|
||||||
else
|
else
|
||||||
self:T3(self.lid..string.format("EVENT: Element %s shut down engines (in air) ==> dead", element.name))
|
self:T3(self.lid..string.format("EVENT: Element %s shut down engines but is not parking. Is it dead?", element.name))
|
||||||
self:ElementDead(element)
|
--self:ElementDead(element)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
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
|
end
|
||||||
|
|
||||||
@ -1165,6 +1165,19 @@ function FLIGHTGROUP:OnEventUnitLost(EventData)
|
|||||||
-- Check that this is the right group.
|
-- Check that this is the right group.
|
||||||
if EventData and EventData.IniGroup and EventData.IniUnit and EventData.IniGroupName and EventData.IniGroupName==self.groupname then
|
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))
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -1434,12 +1447,12 @@ function FLIGHTGROUP:onafterSpawned(From, Event, To)
|
|||||||
|
|
||||||
end
|
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 #FLIGHTGROUP self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @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"))
|
self:I(self.lid..string.format("Flight is parking"))
|
||||||
|
|
||||||
local airbase=self.group:GetCoordinate():GetClosestAirbase()
|
local airbase=self.group:GetCoordinate():GetClosestAirbase()
|
||||||
@ -1471,12 +1484,12 @@ function FLIGHTGROUP:onafterFlightParking(From, Event, To)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "FlightTaxiing" event.
|
--- On after "Taxiing" event.
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @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"))
|
self:T(self.lid..string.format("Flight is taxiing"))
|
||||||
|
|
||||||
-- Parking over.
|
-- Parking over.
|
||||||
@ -1502,13 +1515,13 @@ function FLIGHTGROUP:onafterFlightTaxiing(From, Event, To)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "FlightTakeoff" event.
|
--- On after "Takeoff" event.
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
-- @param Wrapper.Airbase#AIRBASE airbase The airbase the flight landed.
|
-- @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"))
|
self:T(self.lid..string.format("Flight takeoff from %s", airbase and airbase:GetName() or "unknown airbase"))
|
||||||
|
|
||||||
-- Remove flight from all FC queues.
|
-- Remove flight from all FC queues.
|
||||||
@ -1519,12 +1532,12 @@ function FLIGHTGROUP:onafterFlightTakeoff(From, Event, To, airbase)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "FlightAirborne" event.
|
--- On after "Airborne" event.
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @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"))
|
self:I(self.lid..string.format("Flight airborne"))
|
||||||
|
|
||||||
if not self.ai then
|
if not self.ai then
|
||||||
@ -1532,25 +1545,25 @@ function FLIGHTGROUP:onafterFlightAirborne(From, Event, To)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "FlightLanding" event.
|
--- On after "Landing" event.
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @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:T(self.lid..string.format("Flight is landing"))
|
||||||
|
|
||||||
self:_SetElementStatusAll(OPSGROUP.ElementStatus.LANDING)
|
self:_SetElementStatusAll(OPSGROUP.ElementStatus.LANDING)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "FlightLanded" event.
|
--- On after "Landed" event.
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
-- @param Wrapper.Airbase#AIRBASE airbase The airbase the flight landed.
|
-- @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"))
|
self:T(self.lid..string.format("Flight landed at %s", airbase and airbase:GetName() or "unknown place"))
|
||||||
|
|
||||||
if self:IsLandingAt() then
|
if self:IsLandingAt() then
|
||||||
@ -1563,12 +1576,12 @@ function FLIGHTGROUP:onafterFlightLanded(From, Event, To, airbase)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "FlightArrived" event.
|
--- On after "Arrived" event.
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @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"))
|
self:T(self.lid..string.format("Flight arrived"))
|
||||||
|
|
||||||
-- Flight Control
|
-- Flight Control
|
||||||
@ -2445,8 +2458,8 @@ end
|
|||||||
function FLIGHTGROUP._ClearedToLand(group, flightgroup)
|
function FLIGHTGROUP._ClearedToLand(group, flightgroup)
|
||||||
flightgroup:I(flightgroup.lid..string.format("Group was cleared to land"))
|
flightgroup:I(flightgroup.lid..string.format("Group was cleared to land"))
|
||||||
|
|
||||||
-- Trigger FlightLanding event.
|
-- Trigger Landing event.
|
||||||
flightgroup:__FlightLanding(-1)
|
flightgroup:__Landing(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Function called when flight finished refuelling.
|
--- Function called when flight finished refuelling.
|
||||||
|
|||||||
@ -2452,7 +2452,7 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
|||||||
---
|
---
|
||||||
|
|
||||||
if self:_AllSimilarStatus(newstatus) then
|
if self:_AllSimilarStatus(newstatus) then
|
||||||
self:__FlightParking(-0.5)
|
self:__Parking(-0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif newstatus==OPSGROUP.ElementStatus.ENGINEON then
|
elseif newstatus==OPSGROUP.ElementStatus.ENGINEON then
|
||||||
@ -2468,7 +2468,7 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
|||||||
---
|
---
|
||||||
|
|
||||||
if self:_AllSimilarStatus(newstatus) then
|
if self:_AllSimilarStatus(newstatus) then
|
||||||
self:__FlightTaxiing(-0.5)
|
self:__Taxiing(-0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif newstatus==OPSGROUP.ElementStatus.TAKEOFF then
|
elseif newstatus==OPSGROUP.ElementStatus.TAKEOFF then
|
||||||
@ -2478,7 +2478,7 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
|||||||
|
|
||||||
if self:_AllSimilarStatus(newstatus) then
|
if self:_AllSimilarStatus(newstatus) then
|
||||||
-- Trigger takeoff event. Also triggers airborne event.
|
-- Trigger takeoff event. Also triggers airborne event.
|
||||||
self:__FlightTakeoff(-0.5, airbase)
|
self:__Takeoff(-0.5, airbase)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif newstatus==OPSGROUP.ElementStatus.AIRBORNE then
|
elseif newstatus==OPSGROUP.ElementStatus.AIRBORNE then
|
||||||
@ -2487,7 +2487,7 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
|||||||
---
|
---
|
||||||
|
|
||||||
if self:_AllSimilarStatus(newstatus) then
|
if self:_AllSimilarStatus(newstatus) then
|
||||||
self:__FlightAirborne(-0.5)
|
self:__Airborne(-0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif newstatus==OPSGROUP.ElementStatus.LANDED then
|
elseif newstatus==OPSGROUP.ElementStatus.LANDED then
|
||||||
@ -2496,7 +2496,7 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
|||||||
---
|
---
|
||||||
|
|
||||||
if self:_AllSimilarStatus(newstatus) then
|
if self:_AllSimilarStatus(newstatus) then
|
||||||
self:FlightLanded(airbase)
|
self:Landed(airbase)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif newstatus==OPSGROUP.ElementStatus.ARRIVED then
|
elseif newstatus==OPSGROUP.ElementStatus.ARRIVED then
|
||||||
@ -2507,10 +2507,10 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
|||||||
if self:_AllSimilarStatus(newstatus) then
|
if self:_AllSimilarStatus(newstatus) then
|
||||||
|
|
||||||
if self:IsLanded() then
|
if self:IsLanded() then
|
||||||
self:FlightArrived()
|
self:Arrived()
|
||||||
elseif self:IsAirborne() then
|
elseif self:IsAirborne() then
|
||||||
self:FlightLanded()
|
self:Landed()
|
||||||
self:FlightArrived()
|
self:Arrived()
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1481,8 +1481,8 @@ end
|
|||||||
-- @param #number WeaponType Bitmask of weapon types, which are allowed to use.
|
-- @param #number WeaponType Bitmask of weapon types, which are allowed to use.
|
||||||
-- @param DCS#AI.Task.Designation Designation (Optional) Designation type.
|
-- @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 #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 Frequency Frequency in MHz used to communicate with the FAC. Default 133 MHz.
|
||||||
-- @param #number Modulation Modulation of radio for communication.
|
-- @param #number Modulation Modulation of radio for communication. Default 0=AM.
|
||||||
-- @param #number CallsignName Callsign enumerator name of the FAC.
|
-- @param #number CallsignName Callsign enumerator name of the FAC.
|
||||||
-- @param #number CallsignNumber Callsign number, e.g. Axeman-**1**.
|
-- @param #number CallsignNumber Callsign number, e.g. Axeman-**1**.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
@ -1492,11 +1492,11 @@ function CONTROLLABLE:TaskFAC_AttackGroup( AttackGroup, WeaponType, Designation,
|
|||||||
id = 'FAC_AttackGroup',
|
id = 'FAC_AttackGroup',
|
||||||
params = {
|
params = {
|
||||||
groupId = AttackGroup:GetID(),
|
groupId = AttackGroup:GetID(),
|
||||||
weaponType = WeaponType,
|
weaponType = WeaponType or ENUMS.WeaponFlag.AutoDCS,
|
||||||
designation = Designation,
|
designation = Designation or "Auto",
|
||||||
datalink = Datalink,
|
datalink = Datalink and Datalink or true,
|
||||||
frequency = Frequency,
|
frequency = (Frequency or 133)*1000000,
|
||||||
modulation = Modulation,
|
modulation = Modulation or radio.modulation.AM,
|
||||||
callname = CallsignName,
|
callname = CallsignName,
|
||||||
number = CallsignNumber,
|
number = CallsignNumber,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user