mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
WAREHOUSE, AIRWING & SQUADRON
- Added function for hot start to SQUADRON - Addressed bug #1560
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
-- @field #table pointsCAP Table of CAP points.
|
||||
-- @field #table pointsTANKER Table of Tanker points.
|
||||
-- @field #table pointsAWACS Table of AWACS points.
|
||||
-- @field #boolean markpoints Display markers on the F10 map.
|
||||
-- @field Ops.WingCommander#WINGCOMMANDER wingcommander The wing commander responsible for this airwing.
|
||||
--
|
||||
-- @field Ops.RescueHelo#RESCUEHELO rescuehelo The rescue helo.
|
||||
@@ -153,7 +154,7 @@ AIRWING = {
|
||||
|
||||
--- AIRWING class version.
|
||||
-- @field #string version
|
||||
AIRWING.version="0.5.1"
|
||||
AIRWING.version="0.5.2"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ToDo list
|
||||
@@ -210,7 +211,7 @@ function AIRWING:New(warehousename, airwingname)
|
||||
self.nflightsTANKERprobe=0
|
||||
self.nflightsRecoveryTanker=0
|
||||
self.nflightsRescueHelo=0
|
||||
self.markpoints = false
|
||||
self.markpoints=false
|
||||
|
||||
------------------------
|
||||
--- Pseudo Functions ---
|
||||
@@ -1551,6 +1552,9 @@ function AIRWING:onafterNewAsset(From, Event, To, asset, assignment)
|
||||
|
||||
asset.nunits=squad.ngrouping
|
||||
end
|
||||
|
||||
-- Set takeoff type.
|
||||
asset.takeoffType=squad.takeoffType
|
||||
|
||||
-- Create callsign and modex (needs to be after grouping).
|
||||
squad:GetCallsign(asset)
|
||||
@@ -1616,84 +1620,86 @@ function AIRWING:onafterAssetSpawned(From, Event, To, group, asset, request)
|
||||
|
||||
-- Call parent warehouse function first.
|
||||
self:GetParent(self).onafterAssetSpawned(self, From, Event, To, group, asset, request)
|
||||
|
||||
-- Create a flight group.
|
||||
local flightgroup=self:_CreateFlightGroup(asset)
|
||||
|
||||
|
||||
---
|
||||
-- Asset
|
||||
---
|
||||
|
||||
-- Set asset flightgroup.
|
||||
asset.flightgroup=flightgroup
|
||||
|
||||
-- Not requested any more.
|
||||
asset.requested=nil
|
||||
|
||||
-- Did not return yet.
|
||||
asset.Treturned=nil
|
||||
|
||||
---
|
||||
-- Squadron
|
||||
---
|
||||
|
||||
-- Get the SQUADRON of the asset.
|
||||
local squadron=self:GetSquadronOfAsset(asset)
|
||||
|
||||
-- Get TACAN channel.
|
||||
local Tacan=squadron:FetchTacan()
|
||||
if Tacan then
|
||||
asset.tacan=Tacan
|
||||
end
|
||||
|
||||
-- Set radio frequency and modulation
|
||||
local radioFreq, radioModu=squadron:GetRadio()
|
||||
if radioFreq then
|
||||
flightgroup:SwitchRadio(radioFreq, radioModu)
|
||||
end
|
||||
-- Check if we have a squadron or if this was some other request.
|
||||
if squadron then
|
||||
|
||||
-- Create a flight group.
|
||||
local flightgroup=self:_CreateFlightGroup(asset)
|
||||
|
||||
---
|
||||
-- Asset
|
||||
---
|
||||
|
||||
if squadron.fuellow then
|
||||
flightgroup:SetFuelLowThreshold(squadron.fuellow)
|
||||
end
|
||||
|
||||
if squadron.fuellowRefuel then
|
||||
flightgroup:SetFuelLowRefuel(squadron.fuellowRefuel)
|
||||
end
|
||||
|
||||
---
|
||||
-- Mission
|
||||
---
|
||||
|
||||
-- Get Mission (if any).
|
||||
local mission=self:GetMissionByID(request.assignment)
|
||||
|
||||
-- Add mission to flightgroup queue.
|
||||
if mission then
|
||||
-- Set asset flightgroup.
|
||||
asset.flightgroup=flightgroup
|
||||
|
||||
-- Not requested any more.
|
||||
asset.requested=nil
|
||||
|
||||
-- Did not return yet.
|
||||
asset.Treturned=nil
|
||||
|
||||
---
|
||||
-- Squadron
|
||||
---
|
||||
|
||||
-- Get TACAN channel.
|
||||
local Tacan=squadron:FetchTacan()
|
||||
if Tacan then
|
||||
mission:SetTACAN(Tacan, Morse, UnitName, Band)
|
||||
asset.tacan=Tacan
|
||||
end
|
||||
|
||||
-- Set radio frequency and modulation
|
||||
local radioFreq, radioModu=squadron:GetRadio()
|
||||
if radioFreq then
|
||||
flightgroup:SwitchRadio(radioFreq, radioModu)
|
||||
end
|
||||
|
||||
-- Add mission to flightgroup queue.
|
||||
asset.flightgroup:AddMission(mission)
|
||||
|
||||
-- Trigger event.
|
||||
self:FlightOnMission(flightgroup, mission)
|
||||
|
||||
else
|
||||
|
||||
if Tacan then
|
||||
flightgroup:SwitchTACAN(Tacan, Morse, UnitName, Band)
|
||||
if squadron.fuellow then
|
||||
flightgroup:SetFuelLowThreshold(squadron.fuellow)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
if squadron.fuellowRefuel then
|
||||
flightgroup:SetFuelLowRefuel(squadron.fuellowRefuel)
|
||||
end
|
||||
|
||||
-- Add group to the detection set of the WINGCOMMANDER.
|
||||
if self.wingcommander and self.wingcommander.chief then
|
||||
self.wingcommander.chief.detectionset:AddGroup(asset.flightgroup.group)
|
||||
---
|
||||
-- Mission
|
||||
---
|
||||
|
||||
-- Get Mission (if any).
|
||||
local mission=self:GetMissionByID(request.assignment)
|
||||
|
||||
-- Add mission to flightgroup queue.
|
||||
if mission then
|
||||
|
||||
if Tacan then
|
||||
mission:SetTACAN(Tacan, Morse, UnitName, Band)
|
||||
end
|
||||
|
||||
-- Add mission to flightgroup queue.
|
||||
asset.flightgroup:AddMission(mission)
|
||||
|
||||
-- Trigger event.
|
||||
self:FlightOnMission(flightgroup, mission)
|
||||
|
||||
else
|
||||
|
||||
if Tacan then
|
||||
flightgroup:SwitchTACAN(Tacan, Morse, UnitName, Band)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Add group to the detection set of the WINGCOMMANDER.
|
||||
if self.wingcommander and self.wingcommander.chief then
|
||||
self.wingcommander.chief.detectionset:AddGroup(asset.flightgroup.group)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1822,34 +1828,6 @@ function AIRWING:_CreateFlightGroup(asset)
|
||||
-- Set home base.
|
||||
flightgroup.homebase=self.airbase
|
||||
|
||||
--[[
|
||||
|
||||
--- Check if out of missiles. For A2A missions ==> RTB.
|
||||
function flightgroup:OnAfterOutOfMissiles()
|
||||
local airwing=flightgroup:GetAirWing()
|
||||
|
||||
end
|
||||
|
||||
--- Check if out of missiles. For A2G missions ==> RTB. But need to check A2G missiles, rockets as well.
|
||||
function flightgroup:OnAfterOutOfBombs()
|
||||
local airwing=flightgroup:GetAirWing()
|
||||
|
||||
end
|
||||
|
||||
--- Mission started.
|
||||
function flightgroup:OnAfterMissionStart(From, Event, To, Mission)
|
||||
local airwing=flightgroup:GetAirWing()
|
||||
|
||||
end
|
||||
|
||||
--- Flight is DEAD.
|
||||
function flightgroup:OnAfterFlightDead(From, Event, To)
|
||||
local airwing=flightgroup:GetAirWing()
|
||||
|
||||
end
|
||||
|
||||
]]
|
||||
|
||||
return flightgroup
|
||||
end
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
-- @field #table tacanChannel List of TACAN channels available to the squadron.
|
||||
-- @field #number radioFreq Radio frequency in MHz the squad uses.
|
||||
-- @field #number radioModu Radio modulation the squad uses.
|
||||
-- @field #number takeoffType Take of type.
|
||||
-- @extends Core.Fsm#FSM
|
||||
|
||||
--- *It is unbelievable what a squadron of twelve aircraft did to tip the balance.* -- Adolf Galland
|
||||
@@ -87,12 +88,13 @@ SQUADRON = {
|
||||
|
||||
--- SQUADRON class version.
|
||||
-- @field #string version
|
||||
SQUADRON.version="0.5.0"
|
||||
SQUADRON.version="0.5.2"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: Parking spots for squadrons?
|
||||
-- DONE: Engage radius.
|
||||
-- DONE: Modex.
|
||||
-- DONE: Call signs.
|
||||
@@ -282,6 +284,41 @@ function SQUADRON:SetGrouping(nunits)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Set takeoff type. All assets of this squadron will be spawned with cold (default) or hot engines.
|
||||
-- Spawning on runways is not supported.
|
||||
-- @param #SQUADRON self
|
||||
-- @param #string TakeoffType Take off type: "Cold" (default) or "Hot" with engines on.
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetTakeoffType(TakeoffType)
|
||||
TakeoffType=TakeoffType or "Cold"
|
||||
if TakeoffType:lower()=="hot" then
|
||||
self.takeoffType=COORDINATE.WaypointType.TakeOffParkingHot
|
||||
elseif TakeoffType:lower()=="cold" then
|
||||
self.takeoffType=COORDINATE.WaypointType.TakeOffParking
|
||||
else
|
||||
self.takeoffType=COORDINATE.WaypointType.TakeOffParking
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set takeoff type cold (default).
|
||||
-- @param #SQUADRON self
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetTakeoffCold()
|
||||
self:SetTakeoffType("Cold")
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set takeoff type hot.
|
||||
-- @param #SQUADRON self
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetTakeoffHot()
|
||||
self:SetTakeoffType("Hot")
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Set mission types this squadron is able to perform.
|
||||
-- @param #SQUADRON self
|
||||
-- @param #table MissionTypes Table of mission types. Can also be passed as a #string if only one type.
|
||||
|
||||
Reference in New Issue
Block a user