mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'develop' into tt/misc-bug-fixes
This commit is contained in:
@@ -419,6 +419,8 @@ ATIS.RunwayM2T = {
|
||||
TheChannel = -10,
|
||||
Syria = 5,
|
||||
MarianaIslands = 2,
|
||||
Falklands = 12,
|
||||
Sinai = 5,
|
||||
}
|
||||
|
||||
--- Whether ICAO phraseology is used for ATIS broadcasts.
|
||||
@@ -430,6 +432,8 @@ ATIS.RunwayM2T = {
|
||||
-- @field #boolean TheChannel true.
|
||||
-- @field #boolean Syria true.
|
||||
-- @field #boolean MarianaIslands true.
|
||||
-- @field #boolean Falklands true.
|
||||
-- @field #boolean Sinai true.
|
||||
ATIS.ICAOPhraseology = {
|
||||
Caucasus = true,
|
||||
Nevada = false,
|
||||
@@ -437,7 +441,9 @@ ATIS.ICAOPhraseology = {
|
||||
PersianGulf = true,
|
||||
TheChannel = true,
|
||||
Syria = true,
|
||||
MarianaIslands = true
|
||||
MarianaIslands = true,
|
||||
Falklands = true,
|
||||
Sinai = true,
|
||||
}
|
||||
|
||||
--- Nav point data.
|
||||
@@ -1272,7 +1278,8 @@ end
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function ATIS:onafterStart( From, Event, To )
|
||||
|
||||
self:I("Airbase category is "..self.airbase:GetAirbaseCategory())
|
||||
|
||||
-- Check that this is an airdrome.
|
||||
if self.airbase:GetAirbaseCategory() == Airbase.Category.SHIP then
|
||||
self:E( self.lid .. string.format( "ERROR: Cannot start ATIS for airbase %s! Only AIRDROMES are supported but NOT SHIPS.", self.airbasename ) )
|
||||
@@ -1823,7 +1830,10 @@ function ATIS:onafterBroadcast( From, Event, To )
|
||||
|
||||
-- Airbase name
|
||||
subtitle = string.format( "%s", self.airbasename )
|
||||
if (not self.ATISforFARPs) and self.airbasename:find( "AFB" ) == nil and self.airbasename:find( "Airport" ) == nil and self.airbasename:find( "Airstrip" ) == nil and self.airbasename:find( "airfield" ) == nil and self.airbasename:find( "AB" ) == nil then
|
||||
if (not self.ATISforFARPs) and self.airbasename:find( "AFB" ) == nil and self.airbasename:find( "Airport" ) == nil
|
||||
and self.airbasename:find( "Airstrip" ) == nil and self.airbasename:find( "airfield" ) == nil and self.airbasename:find( "AB" ) == nil
|
||||
and self.airbasename:find( "Field" ) == nil
|
||||
then
|
||||
subtitle = subtitle .. " Airport"
|
||||
end
|
||||
if not self.useSRS then
|
||||
|
||||
@@ -1735,10 +1735,10 @@ AIRBOSS.Difficulty = {
|
||||
-- @field #table trapsheet Groove data table recorded every 0.5 seconds.
|
||||
-- @field #boolean trapon If true, save trap sheets.
|
||||
-- @field #string debriefschedulerID Debrief scheduler ID.
|
||||
--
|
||||
--
|
||||
-- @field Sound.SRS#MSRS SRS
|
||||
-- @field Sound.SRS#MSRSQUEUE SRSQ
|
||||
--
|
||||
--
|
||||
-- @extends #AIRBOSS.FlightGroup
|
||||
|
||||
--- Main group level radio menu: F10 Other/Airboss.
|
||||
@@ -3058,7 +3058,7 @@ end
|
||||
-- @param #number Port Port of the SRS server, defaults to 5002.
|
||||
-- @param #string Culture (Optional, Airboss Culture) Culture, defaults to "en-US".
|
||||
-- @param #string Gender (Optional, Airboss Gender) Gender, e.g. "male" or "female". Defaults to "male".
|
||||
-- @param #string Voice (Optional, Airboss Voice) Set to use a specific voice. Will **override gender and culture** settings.
|
||||
-- @param #string Voice (Optional, Airboss Voice) Set to use a specific voice. Will **override gender and culture** settings.
|
||||
-- @param #string GoogleCreds (Optional) Path to Google credentials, e.g. "C:\\Program Files\\DCS-SimpleRadio-Standalone\\yourgooglekey.json".
|
||||
-- @param #number Volume (Optional) E.g. 0.75. Defaults to 1.0 (loudest).
|
||||
-- @param #table AltBackend (Optional) See MSRS for details.
|
||||
@@ -3087,10 +3087,10 @@ function AIRBOSS:EnableSRS(PathToSRS,Port,Culture,Gender,Voice,GoogleCreds,Volum
|
||||
-- SRSQUEUE
|
||||
self.SRSQ = MSRSQUEUE:New("AIRBOSS")
|
||||
self.SRSQ:SetTransmitOnlyWithPlayers(true)
|
||||
if not self.PilotRadio then
|
||||
if not self.PilotRadio then
|
||||
self:SetSRSPilotVoice()
|
||||
end
|
||||
return self
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set LSO radio frequency and modulation. Default frequency is 264 MHz AM.
|
||||
@@ -5924,9 +5924,11 @@ function AIRBOSS:_ScanCarrierZone()
|
||||
-- Get aircraft type name.
|
||||
local actype = group:GetTypeName()
|
||||
|
||||
-- Create a new flight group
|
||||
if knownflight then
|
||||
|
||||
-- Debug output.
|
||||
self:T2(self.lid..string.format("Known flight group %s of type %s in CCA.", groupname, actype))
|
||||
|
||||
-- Check if flight is AI and if we want to handle it at all.
|
||||
if knownflight.ai and knownflight.flag == -100 and self.handleai then
|
||||
|
||||
@@ -5943,9 +5945,10 @@ function AIRBOSS:_ScanCarrierZone()
|
||||
flight.airboss = self
|
||||
end
|
||||
|
||||
-- Send AI flight to marshal stack.
|
||||
-- Send AI flight to marshal stack if group closes in more than 5 and has initial flag value.
|
||||
if putintomarshal then
|
||||
|
||||
|
||||
-- Get the next free stack for current recovery case.
|
||||
local stack = self:_GetFreeStack( knownflight.ai )
|
||||
|
||||
@@ -11553,7 +11556,7 @@ function AIRBOSS:GetHeadingIntoWind( magnetic, coord )
|
||||
local function adjustDegreesForWindSpeed(windSpeed)
|
||||
local degreesAdjustment = 0
|
||||
-- the windspeeds are in m/s
|
||||
|
||||
|
||||
-- +0 degrees at 15m/s = 37kts
|
||||
-- +0 degrees at 14m/s = 35kts
|
||||
-- +0 degrees at 13m/s = 33kts
|
||||
@@ -11568,7 +11571,7 @@ function AIRBOSS:GetHeadingIntoWind( magnetic, coord )
|
||||
-- +20 degrees at 4m/s = 26kts
|
||||
-- +20 degrees at 3m/s = 26kts
|
||||
-- +30 degrees at 2m/s = 26kts 1s
|
||||
|
||||
|
||||
if windSpeed > 0 and windSpeed < 3 then
|
||||
degreesAdjustment = 30
|
||||
elseif windSpeed >= 3 and windSpeed < 5 then
|
||||
@@ -11580,17 +11583,17 @@ function AIRBOSS:GetHeadingIntoWind( magnetic, coord )
|
||||
elseif windSpeed >= 13 then
|
||||
degreesAdjustment = 0
|
||||
end
|
||||
|
||||
|
||||
return degreesAdjustment
|
||||
end
|
||||
|
||||
-- Get direction the wind is blowing from. This is where we want to go.
|
||||
local windfrom, vwind = self:GetWind( nil, nil, coord )
|
||||
|
||||
|
||||
--self:I("windfrom="..windfrom.." vwind="..vwind)
|
||||
|
||||
|
||||
vwind = vwind + adjustDegreesForWindSpeed(vwind)
|
||||
|
||||
|
||||
--self:I("windfrom="..windfrom.." (c)vwind="..vwind)
|
||||
|
||||
-- Actually, we want the runway in the wind.
|
||||
@@ -14730,12 +14733,12 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
|
||||
if radio == nil or call == nil then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if not self.SRS then
|
||||
|
||||
|
||||
-- Create a new radio transmission item.
|
||||
local transmission = {} -- #AIRBOSS.Radioitem
|
||||
|
||||
|
||||
transmission.radio = radio
|
||||
transmission.call = call
|
||||
transmission.Tplay = timer.getAbsTime() + (delay or 0)
|
||||
@@ -14743,58 +14746,58 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
|
||||
transmission.isplaying = false
|
||||
transmission.Tstarted = nil
|
||||
transmission.loud = loud and call.loud
|
||||
|
||||
|
||||
-- Player onboard number if sender has one.
|
||||
if self:_IsOnboard( call.modexsender ) then
|
||||
self:_Number2Radio( radio, call.modexsender, delay, 0.3, pilotcall )
|
||||
end
|
||||
|
||||
|
||||
-- Play onboard number if receiver has one.
|
||||
if self:_IsOnboard( call.modexreceiver ) then
|
||||
self:_Number2Radio( radio, call.modexreceiver, delay, 0.3, pilotcall )
|
||||
end
|
||||
|
||||
|
||||
-- Add transmission to the right queue.
|
||||
local caller = ""
|
||||
if radio.alias == "LSO" then
|
||||
|
||||
|
||||
table.insert( self.RQLSO, transmission )
|
||||
|
||||
|
||||
caller = "LSOCall"
|
||||
|
||||
|
||||
-- Schedule radio queue checks.
|
||||
if not self.RQLid then
|
||||
self:T( self.lid .. string.format( "Starting LSO radio queue." ) )
|
||||
self.RQLid = self.radiotimer:Schedule( nil, AIRBOSS._CheckRadioQueue, { self, self.RQLSO, "LSO" }, 0.02, 0.05 )
|
||||
end
|
||||
|
||||
|
||||
elseif radio.alias == "MARSHAL" then
|
||||
|
||||
|
||||
table.insert( self.RQMarshal, transmission )
|
||||
|
||||
|
||||
caller = "MarshalCall"
|
||||
|
||||
|
||||
if not self.RQMid then
|
||||
self:T( self.lid .. string.format( "Starting Marhal radio queue." ) )
|
||||
self.RQMid = self.radiotimer:Schedule( nil, AIRBOSS._CheckRadioQueue, { self, self.RQMarshal, "MARSHAL" }, 0.02, 0.05 )
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
-- Append radio click sound at the end of the transmission.
|
||||
if click then
|
||||
self:RadioTransmission( radio, self[caller].CLICK, false, delay )
|
||||
end
|
||||
|
||||
|
||||
else
|
||||
-- SRS transmission
|
||||
|
||||
|
||||
local frequency = self.MarshalRadio.frequency
|
||||
local modulation = self.MarshalRadio.modulation
|
||||
local voice = nil
|
||||
local gender = nil
|
||||
local culture = nil
|
||||
|
||||
|
||||
if radio.alias == "AIRBOSS" then
|
||||
frequency = self.AirbossRadio.frequency
|
||||
modulation = self.AirbossRadio.modulation
|
||||
@@ -14802,13 +14805,13 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
|
||||
gender = self.AirbossRadio.gender
|
||||
culture = self.AirbossRadio.culture
|
||||
end
|
||||
|
||||
|
||||
if radio.alias == "MARSHAL" then
|
||||
voice = self.MarshalRadio.voice
|
||||
gender = self.MarshalRadio.gender
|
||||
culture = self.MarshalRadio.culture
|
||||
end
|
||||
|
||||
|
||||
if radio.alias == "LSO" then
|
||||
frequency = self.LSORadio.frequency
|
||||
modulation = self.LSORadio.modulation
|
||||
@@ -14816,7 +14819,7 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
|
||||
gender = self.LSORadio.gender
|
||||
culture = self.LSORadio.culture
|
||||
end
|
||||
|
||||
|
||||
if pilotcall then
|
||||
voice = self.PilotRadio.voice
|
||||
gender = self.PilotRadio.gender
|
||||
@@ -14830,16 +14833,16 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
|
||||
modulation = self.AirbossRadio.modulation
|
||||
radio.alias = "AIRBOSS"
|
||||
end
|
||||
|
||||
|
||||
local volume = nil
|
||||
|
||||
|
||||
if loud then
|
||||
volume = 1.0
|
||||
end
|
||||
|
||||
|
||||
--local text = tostring(call.modexreceiver).."; "..radio.alias.."; "..call.subtitle
|
||||
local text = call.subtitle
|
||||
self:I(self.lid..text)
|
||||
self:I(self.lid..text)
|
||||
local srstext = self:_GetNiceSRSText(text)
|
||||
self.SRSQ:NewTransmission(srstext, call.duration, self.SRS, tstart, 0.1, subgroups, call.subtitle, call.subduration, frequency, modulation, gender, culture, voice, volume, radio.alias)
|
||||
end
|
||||
@@ -14858,11 +14861,11 @@ function AIRBOSS:SetSRSPilotVoice( Voice, Gender, Culture )
|
||||
self.PilotRadio.voice = Voice or MSRS.Voices.Microsoft.David
|
||||
self.PilotRadio.gender = Gender or "male"
|
||||
self.PilotRadio.culture = Culture or "en-US"
|
||||
|
||||
|
||||
if (not Voice) and self.SRS and self.SRS.google then
|
||||
self.PilotRadio.voice = MSRS.Voices.Google.Standard.en_US_Standard_J
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -15176,44 +15179,44 @@ function AIRBOSS:MessageToPlayer( playerData, message, sender, receiver, duratio
|
||||
-- SCHEDULER:New(nil, self.MessageToPlayer, {self, playerData, message, sender, receiver, duration, clear}, delay)
|
||||
self:ScheduleOnce( delay, self.MessageToPlayer, self, playerData, message, sender, receiver, duration, clear )
|
||||
else
|
||||
|
||||
|
||||
if not self.SRS then
|
||||
-- Wait until previous sound finished.
|
||||
local wait = 0
|
||||
|
||||
|
||||
-- Onboard number to get the attention.
|
||||
if receiver == playerData.onboard then
|
||||
|
||||
|
||||
-- Which voice over number to use.
|
||||
if sender and (sender == "LSO" or sender == "MARSHAL" or sender == "AIRBOSS") then
|
||||
|
||||
|
||||
-- User sound of board number.
|
||||
wait = wait + self:_Number2Sound( playerData, sender, receiver )
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Negative.
|
||||
if string.find( text:lower(), "negative" ) then
|
||||
local filename = self:_RadioFilename( self.MarshalCall.NEGATIVE, false, "MARSHAL" )
|
||||
USERSOUND:New( filename ):ToGroup( playerData.group, wait )
|
||||
wait = wait + self.MarshalCall.NEGATIVE.duration
|
||||
end
|
||||
|
||||
|
||||
-- Affirm.
|
||||
if string.find( text:lower(), "affirm" ) then
|
||||
local filename = self:_RadioFilename( self.MarshalCall.AFFIRMATIVE, false, "MARSHAL" )
|
||||
USERSOUND:New( filename ):ToGroup( playerData.group, wait )
|
||||
wait = wait + self.MarshalCall.AFFIRMATIVE.duration
|
||||
end
|
||||
|
||||
|
||||
-- Roger.
|
||||
if string.find( text:lower(), "roger" ) then
|
||||
local filename = self:_RadioFilename( self.MarshalCall.ROGER, false, "MARSHAL" )
|
||||
USERSOUND:New( filename ):ToGroup( playerData.group, wait )
|
||||
wait = wait + self.MarshalCall.ROGER.duration
|
||||
end
|
||||
|
||||
|
||||
-- Play click sound to end message.
|
||||
if wait > 0 then
|
||||
local filename = self:_RadioFilename( self.MarshalCall.CLICK )
|
||||
@@ -15226,7 +15229,7 @@ function AIRBOSS:MessageToPlayer( playerData, message, sender, receiver, duratio
|
||||
local voice = self.MarshalRadio.voice
|
||||
local gender = self.MarshalRadio.gender
|
||||
local culture = self.MarshalRadio.culture
|
||||
|
||||
|
||||
if not sender then sender = "AIRBOSS" end
|
||||
|
||||
if string.find(sender,"AIRBOSS" ) then
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
-- ===
|
||||
--
|
||||
-- ### Author: **applevangelist**
|
||||
-- @date Last Update December 2022
|
||||
-- @date Last Update July 2023
|
||||
-- @module Ops.AWACS
|
||||
-- @image OPS_AWACS.jpg
|
||||
|
||||
@@ -63,6 +63,7 @@ do
|
||||
-- @field Utilities.FiFo#FIFO RadioQueue
|
||||
-- @field Utilities.FiFo#FIFO PrioRadioQueue
|
||||
-- @field Utilities.FiFo#FIFO CAPAirwings
|
||||
-- @field Utilities.FiFo#FIFO TacticalQueue
|
||||
-- @field #number AwacsTimeOnStation
|
||||
-- @field #number AwacsTimeStamp
|
||||
-- @field #number EscortsTimeOnStation
|
||||
@@ -113,6 +114,13 @@ do
|
||||
-- @field Wrapper.Group#GROUP GCIGroup EWR group object for GCI ops
|
||||
-- @field #string locale Localization
|
||||
-- @field #boolean IncludeHelicopters
|
||||
-- @field #boolean TacticalMenu
|
||||
-- @field #table TacticalFrequencies
|
||||
-- @field #table TacticalSubscribers
|
||||
-- @field #number TacticalBaseFreq
|
||||
-- @field #number TacticalIncrFreq
|
||||
-- @field #number TacticalModulation
|
||||
-- @field #number TacticalInterval
|
||||
-- @extends Core.Fsm#FSM
|
||||
|
||||
|
||||
@@ -499,7 +507,7 @@ do
|
||||
-- @field #AWACS
|
||||
AWACS = {
|
||||
ClassName = "AWACS", -- #string
|
||||
version = "0.2.55", -- #string
|
||||
version = "0.2.57", -- #string
|
||||
lid = "", -- #string
|
||||
coalition = coalition.side.BLUE, -- #number
|
||||
coalitiontxt = "blue", -- #string
|
||||
@@ -532,6 +540,7 @@ AWACS = {
|
||||
ContactsAO = {}, -- Utilities.FiFo#FIFO
|
||||
RadioQueue = {}, -- Utilities.FiFo#FIFO
|
||||
PrioRadioQueue = {}, -- Utilities.FiFo#FIFO
|
||||
TacticalQueue = {}, -- Utilities.FiFo#FIFO
|
||||
AwacsTimeOnStation = 4,
|
||||
AwacsTimeStamp = 0,
|
||||
EscortsTimeOnStation = 4,
|
||||
@@ -587,6 +596,13 @@ AWACS = {
|
||||
GCIGroup = nil,
|
||||
locale = "en",
|
||||
IncludeHelicopters = false,
|
||||
TacticalMenu = false,
|
||||
TacticalFrequencies = {},
|
||||
TacticalSubscribers = {},
|
||||
TacticalBaseFreq = 130,
|
||||
TacticalIncrFreq = 0.5,
|
||||
TacticalModulation = radio.modulation.AM,
|
||||
TacticalInterval = 120,
|
||||
}
|
||||
|
||||
---
|
||||
@@ -917,7 +933,7 @@ AWACS.TaskStatus = {
|
||||
--@field #boolean FromAI
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO-List 0.2.52
|
||||
-- TODO-List 0.2.53
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--
|
||||
-- DONE - WIP - Player tasking, VID
|
||||
@@ -1110,6 +1126,7 @@ function AWACS:New(Name,AirWing,Coalition,AirbaseName,AwacsOrbit,OpsZone,Station
|
||||
self.Volume = 1.0
|
||||
self.RadioQueue = FIFO:New() -- Utilities.FiFo#FIFO
|
||||
self.PrioRadioQueue = FIFO:New() -- Utilities.FiFo#FIFO
|
||||
self.TacticalQueue = FIFO:New() -- Utilities.FiFo#FIFO
|
||||
self.maxspeakentries = 3
|
||||
self.GoogleTTSPadding = 1
|
||||
self.WindowsTTSPadding = 2.5
|
||||
@@ -1180,6 +1197,15 @@ function AWACS:New(Name,AirWing,Coalition,AirbaseName,AwacsOrbit,OpsZone,Station
|
||||
|
||||
self.clientmenus = FIFO:New() -- Utilities.FiFo#FIFO
|
||||
|
||||
-- Tactical Menu
|
||||
self.TacticalMenu = false
|
||||
self.TacticalBaseFreq = 130
|
||||
self.TacticalIncrFreq = 0.5
|
||||
self.TacticalModulation = radio.modulation.AM
|
||||
self.acticalFrequencies = {}
|
||||
self.TacticalSubscribers = {}
|
||||
self.TacticalInterval = 120
|
||||
|
||||
-- SET for Intel Detection
|
||||
self.DetectionSet=SET_GROUP:New()
|
||||
|
||||
@@ -1204,6 +1230,7 @@ function AWACS:New(Name,AirWing,Coalition,AirbaseName,AwacsOrbit,OpsZone,Station
|
||||
self:AddTransition("*", "LostCluster", "*")
|
||||
self:AddTransition("*", "LostContact", "*")
|
||||
self:AddTransition("*", "CheckRadioQueue", "*")
|
||||
self:AddTransition("*", "CheckTacticalQueue", "*")
|
||||
self:AddTransition("*", "EscortShiftChange", "*")
|
||||
self:AddTransition("*", "AwacsShiftChange", "*")
|
||||
self:AddTransition("*", "FlightOnMission", "*")
|
||||
@@ -1354,6 +1381,159 @@ end
|
||||
-- Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- [User] Set the tactical information option, create 10 radio channels groups can subscribe and get Bogey Dope on a specific frequency automatically.
|
||||
-- @param #AWACS self
|
||||
-- @param #number BaseFreq Base Frequency to use, defaults to 130.
|
||||
-- @param #number Increase Increase to use, defaults to 0.5, thus channels created are 130, 130.5, 131 .. etc.
|
||||
-- @param #number Modulation Modulation to use, defaults to radio.modulation.AM.
|
||||
-- @param #number Interval Seconds between each update call.
|
||||
-- @param #number Number Number of Frequencies to create, can be 1..10.
|
||||
-- @return #AWACS self
|
||||
function AWACS:SetTacticalRadios(BaseFreq,Increase,Modulation,Interval,Number)
|
||||
self:T(self.lid.."SetTacticalRadios")
|
||||
self.TacticalMenu = true
|
||||
self.TacticalBaseFreq = BaseFreq or 130
|
||||
self.TacticalIncrFreq = Increase or 0.5
|
||||
self.TacticalModulation = Modulation or radio.modulation.AM
|
||||
self.TacticalInterval = Interval or 120
|
||||
local number = Number or 10
|
||||
if number < 1 then number = 1 end
|
||||
if number > 10 then number = 10 end
|
||||
for i=1,number do
|
||||
local freq = self.TacticalBaseFreq + ((i-1)*self.TacticalIncrFreq)
|
||||
self.TacticalFrequencies[freq] = freq
|
||||
end
|
||||
if self.AwacsSRS then
|
||||
self.TacticalSRS = MSRS:New(self.PathToSRS,self.TacticalBaseFreq,self.TacticalModulation,self.Volume)
|
||||
self.TacticalSRS:SetCoalition(self.coalition)
|
||||
self.TacticalSRS:SetGender(self.Gender)
|
||||
self.TacticalSRS:SetCulture(self.Culture)
|
||||
self.TacticalSRS:SetVoice(self.Voice)
|
||||
self.TacticalSRS:SetPort(self.Port)
|
||||
self.TacticalSRS:SetLabel("AWACS")
|
||||
if self.PathToGoogleKey then
|
||||
self.TacticalSRS:SetGoogle(self.PathToGoogleKey)
|
||||
end
|
||||
self.TacticalSRSQ = MSRSQUEUE:New("Tactical AWACS")
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- TODO
|
||||
-- [Internal] _RefreshMenuNonSubscribed
|
||||
-- @param #AWACS self
|
||||
-- @return #AWACS self
|
||||
function AWACS:_RefreshMenuNonSubscribed()
|
||||
self:T(self.lid.."_RefreshMenuNonSubscribed")
|
||||
local aliveset = self.clientset:GetAliveSet()
|
||||
|
||||
for _,_group in pairs(aliveset) do
|
||||
-- go through set and re-build the sub-menu
|
||||
local grp = _group -- Wrapper.Client#CLIENT
|
||||
local Group = grp:GetGroup()
|
||||
local gname = nil
|
||||
if Group and Group:IsAlive() then
|
||||
gname = Group:GetName()
|
||||
self:T(gname)
|
||||
end
|
||||
local menustr = self.clientmenus:ReadByID(gname)
|
||||
local menu = menustr.tactical -- Core.Menu#MENU_GROUP
|
||||
if not self.TacticalSubscribers[gname] and menu then
|
||||
menu:RemoveSubMenus()
|
||||
for _,_freq in UTILS.spairs(self.TacticalFrequencies) do
|
||||
local modu = UTILS.GetModulationName(self.TacticalModulation)
|
||||
local text = string.format("Subscribe to %.3f %s",_freq,modu)
|
||||
local entry = MENU_GROUP_COMMAND:New(Group,text,menu,self._SubScribeTactRadio,self,Group,_freq)
|
||||
end
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Internal] _UnsubScribeTactRadio
|
||||
-- @param #AWACS self
|
||||
-- @param Wrapper.Group#GROUP Group
|
||||
-- @return #AWACS self
|
||||
function AWACS:_UnsubScribeTactRadio(Group)
|
||||
self:T(self.lid.."_UnsubScribeTactRadio")
|
||||
local text = ""
|
||||
local textScreen = ""
|
||||
local GID, Outcome = self:_GetManagedGrpID(Group)
|
||||
local gcallsign = self:_GetCallSign(Group,GID) or "Ghost 1"
|
||||
local gname = Group:GetName() or "unknown"
|
||||
|
||||
if Outcome and self.TacticalSubscribers[gname] then
|
||||
-- Pilot is checked in
|
||||
local Freq = self.TacticalSubscribers[gname]
|
||||
self.TacticalFrequencies[Freq] = Freq
|
||||
self.TacticalSubscribers[gname] = nil
|
||||
local modu = self.TacticalModulation == 0 and "AM" or "FM"
|
||||
text = string.format("%s, %s, switch back to AWACS main frequency!",gcallsign,self.callsigntxt)
|
||||
self:_NewRadioEntry(text,text,GID,true,true,true,false,true)
|
||||
self:_RefreshMenuNonSubscribed()
|
||||
elseif self.AwacsFG then
|
||||
-- no, unknown
|
||||
local nocheckin = self.gettext:GetEntry("NOTCHECKEDIN",self.locale)
|
||||
text = string.format(nocheckin,self:_GetCallSign(Group,GID) or "Ghost 1", self.callsigntxt)
|
||||
self:_NewRadioEntry(text,text,GID,Outcome,true,true,false)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Internal] _SubScribeTactRadio
|
||||
-- @param #AWACS self
|
||||
-- @param Wrapper.Group#GROUP Group
|
||||
-- @param #number Frequency
|
||||
-- @return #AWACS self
|
||||
function AWACS:_SubScribeTactRadio(Group,Frequency)
|
||||
self:T(self.lid.."_SubScribeTactRadio")
|
||||
local text = ""
|
||||
local textScreen = ""
|
||||
local GID, Outcome = self:_GetManagedGrpID(Group)
|
||||
local gcallsign = self:_GetCallSign(Group,GID) or "Ghost 1"
|
||||
local gname = Group:GetName() or "unknown"
|
||||
|
||||
if Outcome then
|
||||
-- Pilot is checked in
|
||||
self.TacticalSubscribers[gname] = Frequency
|
||||
self.TacticalFrequencies[Frequency] = nil
|
||||
local modu = self.TacticalModulation == 0 and "AM" or "FM"
|
||||
text = string.format("%s, %s, switch to %.3f %s for tactical information!",gcallsign,self.callsigntxt,Frequency,modu)
|
||||
self:_NewRadioEntry(text,text,GID,true,true,true,false,true)
|
||||
local menustr = self.clientmenus:ReadByID(gname)
|
||||
local menu = menustr.tactical -- Core.Menu#MENU_GROUP
|
||||
if menu then
|
||||
menu:RemoveSubMenus()
|
||||
local text = string.format("Unsubscribe %.3f %s",Frequency,modu)
|
||||
local entry = MENU_GROUP_COMMAND:New(Group,text,menu,self._UnsubScribeTactRadio,self,Group)
|
||||
end
|
||||
elseif self.AwacsFG then
|
||||
-- no, unknown
|
||||
local nocheckin = self.gettext:GetEntry("NOTCHECKEDIN",self.locale)
|
||||
text = string.format(nocheckin,self:_GetCallSign(Group,GID) or "Ghost 1", self.callsigntxt)
|
||||
self:_NewRadioEntry(text,text,GID,Outcome,true,true,false)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Internal] _CheckSubscribers
|
||||
-- @param #AWACS self
|
||||
-- @return #AWACS self
|
||||
function AWACS:_CheckSubscribers()
|
||||
self:T(self.lid.."_InitLocalization")
|
||||
|
||||
for _name,_freq in pairs(self.TacticalSubscribers or {}) do
|
||||
local grp = GROUP:FindByName(_name)
|
||||
if (not grp) or (not grp:IsAlive()) then
|
||||
self.TacticalFrequencies[_freq] = _freq
|
||||
self.TacticalSubscribers[_name] = nil
|
||||
end
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Internal] Init localization
|
||||
-- @param #AWACS self
|
||||
-- @return #AWACS self
|
||||
@@ -1426,19 +1606,22 @@ end
|
||||
-- @param #boolean IsNew New
|
||||
-- @param #boolean FromAI From AI
|
||||
-- @param #boolean IsPrio Priority entry
|
||||
-- @param #boolean Tactical Is for tactical info
|
||||
-- @return #AWACS self
|
||||
function AWACS:_NewRadioEntry(TextTTS, TextScreen,GID,IsGroup,ToScreen,IsNew,FromAI,IsPrio)
|
||||
function AWACS:_NewRadioEntry(TextTTS, TextScreen,GID,IsGroup,ToScreen,IsNew,FromAI,IsPrio,Tactical)
|
||||
self:T(self.lid.."_NewRadioEntry")
|
||||
local RadioEntry = {} -- #AWACS.RadioEntry
|
||||
RadioEntry.IsNew = IsNew
|
||||
RadioEntry.TextTTS = TextTTS
|
||||
RadioEntry.TextScreen = TextScreen
|
||||
RadioEntry.TextScreen = TextScreen or TextTTS
|
||||
RadioEntry.GroupID = GID
|
||||
RadioEntry.ToScreen = ToScreen
|
||||
RadioEntry.Duration = STTS.getSpeechTime(TextTTS,0.95,false) or 8
|
||||
RadioEntry.FromAI = FromAI
|
||||
RadioEntry.IsGroup = IsGroup
|
||||
if IsPrio then
|
||||
if Tactical then
|
||||
self.TacticalQueue:Push(RadioEntry)
|
||||
elseif IsPrio then
|
||||
self.PrioRadioQueue:Push(RadioEntry)
|
||||
else
|
||||
self.RadioQueue:Push(RadioEntry)
|
||||
@@ -1618,7 +1801,7 @@ function AWACS:_EventHandler(EventData)
|
||||
if WeaponDesc.category == 1 then
|
||||
Type = "Missile"
|
||||
-- AAM
|
||||
local guidance = WeaponDesc.guidance -- IR=2, Radar Active=3, Radar Semi Active=4, Radar Passive = 5
|
||||
local guidance = WeaponDesc.guidance or 4 -- IR=2, Radar Active=3, Radar Semi Active=4, Radar Passive = 5
|
||||
if guidance == 2 then
|
||||
warndist = 10
|
||||
elseif guidance == 3 then
|
||||
@@ -2689,8 +2872,9 @@ end
|
||||
-- @param #AWACS self
|
||||
-- @param #string Callsign Callsign to address
|
||||
-- @param #number GID GroupID for comms
|
||||
-- @param #boolean Tactical Is for tactical info
|
||||
-- @return #AWACS self
|
||||
function AWACS:_CreateBogeyDope(Callsign,GID)
|
||||
function AWACS:_CreateBogeyDope(Callsign,GID,Tactical)
|
||||
self:T(self.lid.."_CreateBogeyDope for "..Callsign.." GID "..GID)
|
||||
|
||||
local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
||||
@@ -2716,7 +2900,7 @@ function AWACS:_CreateBogeyDope(Callsign,GID)
|
||||
local tag = contact.TargetGroupNaming
|
||||
local reportingname = contact.ReportingName
|
||||
-- DONE - add tag
|
||||
self:_AnnounceContact(contact,false,group,true,tag,false,reportingname)
|
||||
self:_AnnounceContact(contact,false,group,true,tag,false,reportingname,Tactical)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2841,8 +3025,9 @@ end
|
||||
--- [Internal] AWACS Menu for Bogey Dope
|
||||
-- @param #AWACS self
|
||||
-- @param Wrapper.Group#GROUP Group Group to use
|
||||
-- @param #boolean Tactical Check for tactical info
|
||||
-- @return #AWACS self
|
||||
function AWACS:_BogeyDope(Group)
|
||||
function AWACS:_BogeyDope(Group,Tactical)
|
||||
self:T(self.lid.."_BogeyDope")
|
||||
local text = ""
|
||||
local textScreen = ""
|
||||
@@ -2853,8 +3038,7 @@ function AWACS:_BogeyDope(Group)
|
||||
-- no intel yet!
|
||||
local clean = self.gettext:GetEntry("CLEAN",self.locale)
|
||||
text = string.format(clean,self:_GetCallSign(Group,GID) or "Ghost 1", self.callsigntxt)
|
||||
self:_NewRadioEntry(text,text,0,false,true,true,false,true)
|
||||
|
||||
self:_NewRadioEntry(text,text,0,false,true,true,false,true,Tactical)
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -2896,7 +3080,7 @@ function AWACS:_BogeyDope(Group)
|
||||
local clean = self.gettext:GetEntry("CLEAN",self.locale)
|
||||
text = string.format(clean,self:_GetCallSign(Group,GID) or "Ghost 1", self.callsigntxt)
|
||||
|
||||
self:_NewRadioEntry(text,textScreen,GID,Outcome,Outcome,true,false,true)
|
||||
self:_NewRadioEntry(text,textScreen,GID,Outcome,Outcome,true,false,true,Tactical)
|
||||
|
||||
else
|
||||
|
||||
@@ -2915,9 +3099,9 @@ function AWACS:_BogeyDope(Group)
|
||||
textScreen = string.format("%s%d %s.\n",textScreen,contactsAO,groupstxt)
|
||||
end
|
||||
|
||||
self:_NewRadioEntry(text,textScreen,GID,Outcome,true,true,false,true)
|
||||
self:_NewRadioEntry(text,textScreen,GID,Outcome,true,true,false,true,Tactical)
|
||||
|
||||
self:_CreateBogeyDope(self:_GetCallSign(Group,GID) or "Ghost 1",GID)
|
||||
self:_CreateBogeyDope(self:_GetCallSign(Group,GID) or "Ghost 1",GID,Tactical)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2925,7 +3109,7 @@ function AWACS:_BogeyDope(Group)
|
||||
-- no, unknown
|
||||
local nocheckin = self.gettext:GetEntry("NOTCHECKEDIN",self.locale)
|
||||
text = string.format(nocheckin,self:_GetCallSign(Group,GID) or "Ghost 1", self.callsigntxt)
|
||||
self:_NewRadioEntry(text,text,GID,Outcome,true,true,false)
|
||||
self:_NewRadioEntry(text,text,GID,Outcome,true,true,false,Tactical)
|
||||
|
||||
end
|
||||
return self
|
||||
@@ -3528,11 +3712,17 @@ function AWACS:_CheckOut(Group,GID,dead)
|
||||
local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
||||
local Stack = managedgroup.AnchorStackNo
|
||||
local Angels = managedgroup.AnchorStackAngels
|
||||
local GroupName = managedgroup.GroupName
|
||||
-- remove menus
|
||||
if managedgroup.IsPlayer then
|
||||
if self.clientmenus:HasUniqueID(managedgroup.GroupName) then
|
||||
local menus = self.clientmenus:PullByID(managedgroup.GroupName) --#AWACS.MenuStructure
|
||||
if self.clientmenus:HasUniqueID(GroupName) then
|
||||
local menus = self.clientmenus:PullByID(GroupName) --#AWACS.MenuStructure
|
||||
menus.basemenu:Remove()
|
||||
if self.TacticalSubscribers[GroupName] then
|
||||
local Freq = self.TacticalSubscribers[GroupName]
|
||||
self.TacticalFrequencies[Freq] = Freq
|
||||
self.TacticalSubscribers[GroupName] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
-- delete open tasks
|
||||
@@ -3614,6 +3804,22 @@ function AWACS:_SetClientMenus()
|
||||
local friendly = MENU_GROUP_COMMAND:New(cgrp,"Friendly",vid,self._VID,self,cgrp,AWACS.IFF.FRIENDLY)
|
||||
end
|
||||
|
||||
local tactical
|
||||
if self.TacticalMenu then
|
||||
tactical = MENU_GROUP:New(cgrp,"Tactical Radio",basemenu)
|
||||
if self.TacticalSubscribers[cgrpname] then
|
||||
-- unsubscribe
|
||||
local entry = MENU_GROUP_COMMAND:New(cgrp,"Unsubscribe",tactical,self._UnsubScribeTactRadio,self,cgrp)
|
||||
else
|
||||
-- subscribe
|
||||
for _,_freq in UTILS.spairs(self.TacticalFrequencies) do
|
||||
local modu = UTILS.GetModulationName(self.TacticalModulation)
|
||||
local text = string.format("Subscribe to %.3f %s",_freq,modu)
|
||||
local entry = MENU_GROUP_COMMAND:New(cgrp,text,tactical,self._SubScribeTactRadio,self,cgrp,_freq)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local ainfo = MENU_GROUP_COMMAND:New(cgrp,"Awacs Info",basemenu,self._ShowAwacsInfo,self,cgrp)
|
||||
local checkout = MENU_GROUP_COMMAND:New(cgrp,"Check Out",basemenu,self._CheckOut,self,cgrp)
|
||||
|
||||
@@ -3631,6 +3837,7 @@ function AWACS:_SetClientMenus()
|
||||
unable = unable,
|
||||
abort = abort,
|
||||
commit=commit,
|
||||
tactical=tactical,
|
||||
}
|
||||
self.clientmenus:PullByID(cgrpname)
|
||||
self.clientmenus:Push(menus,cgrpname)
|
||||
@@ -4812,8 +5019,9 @@ end
|
||||
-- @param #string Tag Tag name for this contact. Alpha, Brave, Charlie ...
|
||||
-- @param #boolean IsPopup This is a pop-up group
|
||||
-- @param #string ReportingName The NATO code reporting name for the contact, e.g. "Foxbat". "Bogey" if unknown.
|
||||
-- @param #boolean Tactical
|
||||
-- @return #AWACS self
|
||||
function AWACS:_AnnounceContact(Contact,IsNew,Group,IsBogeyDope,Tag,IsPopup,ReportingName)
|
||||
function AWACS:_AnnounceContact(Contact,IsNew,Group,IsBogeyDope,Tag,IsPopup,ReportingName,Tactical)
|
||||
self:T(self.lid.."_AnnounceContact")
|
||||
-- do we have a group to talk to?
|
||||
local tag = ""
|
||||
@@ -4940,7 +5148,7 @@ function AWACS:_AnnounceContact(Contact,IsNew,Group,IsBogeyDope,Tag,IsPopup,Repo
|
||||
BRAText = string.gsub(BRAText,"BRA","brah")
|
||||
|
||||
local prio = IsNew or IsBogeyDope
|
||||
self:_NewRadioEntry(BRAText,TextScreen,GID,isGroup,true,IsNew,false,prio)
|
||||
self:_NewRadioEntry(BRAText,TextScreen,GID,isGroup,true,IsNew,false,prio,Tactical)
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -5328,6 +5536,15 @@ function AWACS:_MergedCall(GID)
|
||||
local merge = self.gettext:GetEntry("MERGED",self.locale)
|
||||
local text = string.format("%s. %s. %s.",self.callsigntxt,pilotcallsign,merge)
|
||||
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true)
|
||||
if GID and GID ~= 0 then
|
||||
local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
||||
if managedgroup and managedgroup.Group and managedgroup.Group:IsAlive() then
|
||||
local name = managedgroup.GroupName
|
||||
if self.TacticalSubscribers[name] then
|
||||
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true,true)
|
||||
end
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -5703,6 +5920,10 @@ function AWACS:onafterStart(From, Event, To)
|
||||
self:__Started(-5)
|
||||
end
|
||||
|
||||
if self.TacticalMenu then
|
||||
self:__CheckTacticalQueue(55)
|
||||
end
|
||||
|
||||
self:__Status(-30)
|
||||
return self
|
||||
end
|
||||
@@ -5976,6 +6197,8 @@ function AWACS:onafterStatus(From, Event, To)
|
||||
|
||||
self:_CheckMerges()
|
||||
|
||||
self:_CheckSubscribers()
|
||||
|
||||
local outcome, targets = self:_TargetSelectionProcess(true)
|
||||
|
||||
self:_CheckTaskQueue()
|
||||
@@ -6316,6 +6539,77 @@ function AWACS:onafterLostCluster(From,Event,To,Cluster,Mission)
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Internal] onafterCheckTacticalQueue
|
||||
-- @param #AWACS self
|
||||
-- @param #string From
|
||||
-- @param #string Event
|
||||
-- @param #string To
|
||||
-- @return #AWACS self
|
||||
function AWACS:onafterCheckTacticalQueue(From,Event,To)
|
||||
self:T({From, Event, To})
|
||||
-- do we have messages queued?
|
||||
|
||||
if self.clientset:CountAlive() == 0 then
|
||||
self:T(self.lid.."No player connected.")
|
||||
self:__CheckTacticalQueue(-5)
|
||||
return self
|
||||
end
|
||||
|
||||
for _name,_freq in pairs(self.TacticalSubscribers) do
|
||||
local Group = nil
|
||||
if _name then
|
||||
Group = GROUP:FindByName(_name)
|
||||
end
|
||||
if Group and Group:IsAlive() then
|
||||
self:_BogeyDope(Group,true)
|
||||
end
|
||||
end
|
||||
|
||||
if (self.TacticalQueue:IsNotEmpty()) then
|
||||
|
||||
while self.TacticalQueue:Count() > 0 do
|
||||
|
||||
local RadioEntry = self.TacticalQueue:Pull() -- #AWACS.RadioEntry
|
||||
self:T({RadioEntry})
|
||||
local frequency = self.TacticalBaseFreq
|
||||
if RadioEntry.GroupID and RadioEntry.GroupID ~= 0 then
|
||||
local managedgroup = self.ManagedGrps[RadioEntry.GroupID] -- #AWACS.ManagedGroup
|
||||
if managedgroup and managedgroup.Group and managedgroup.Group:IsAlive() then
|
||||
local name = managedgroup.GroupName
|
||||
frequency = self.TacticalSubscribers[name]
|
||||
end
|
||||
end
|
||||
-- AI AWACS Speaking
|
||||
local gtext = RadioEntry.TextTTS
|
||||
if self.PathToGoogleKey then
|
||||
gtext = string.format("<speak><prosody rate='medium'>%s</prosody></speak>",gtext)
|
||||
end
|
||||
self.TacticalSRSQ:NewTransmission(gtext,nil,self.TacticalSRS,nil,0.5,nil,nil,nil,frequency,self.TacticalModulation,nil,nil,nil,nil,nil)
|
||||
|
||||
self:T(RadioEntry.TextTTS)
|
||||
|
||||
if RadioEntry.ToScreen and RadioEntry.TextScreen and (not self.SuppressScreenOutput) then
|
||||
if RadioEntry.GroupID and RadioEntry.GroupID ~= 0 then
|
||||
local managedgroup = self.ManagedGrps[RadioEntry.GroupID] -- #AWACS.ManagedGroup
|
||||
if managedgroup and managedgroup.Group and managedgroup.Group:IsAlive() then
|
||||
MESSAGE:New(RadioEntry.TextScreen,20,"AWACS"):ToGroup(managedgroup.Group)
|
||||
self:T(RadioEntry.TextScreen)
|
||||
end
|
||||
else
|
||||
MESSAGE:New(RadioEntry.TextScreen,20,"AWACS"):ToCoalition(self.coalition)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end -- end while
|
||||
|
||||
if self:Is("Running") then
|
||||
self:__CheckTacticalQueue(-self.TacticalInterval)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- [Internal] onafterCheckRadioQueue
|
||||
-- @param #AWACS self
|
||||
-- @param #string From
|
||||
|
||||
@@ -1485,6 +1485,17 @@ function CHIEF:AddGciCapZone(Zone, Altitude, Speed, Heading, Leg)
|
||||
return zone
|
||||
end
|
||||
|
||||
--- Remove a GCI CAP
|
||||
-- @param #CHIEF self
|
||||
-- @param Core.Zone#ZONE Zone Zone, where the flight orbits.
|
||||
function CHIEF:RemoveGciCapZone(Zone)
|
||||
|
||||
-- Hand over to commander.
|
||||
local zone=self.commander:RemoveGciCapZone(Zone)
|
||||
|
||||
return zone
|
||||
end
|
||||
|
||||
--- Add an AWACS zone.
|
||||
-- @param #CHIEF self
|
||||
-- @param Core.Zone#ZONE Zone Zone.
|
||||
@@ -1501,6 +1512,17 @@ function CHIEF:AddAwacsZone(Zone, Altitude, Speed, Heading, Leg)
|
||||
return zone
|
||||
end
|
||||
|
||||
--- Remove a AWACS zone.
|
||||
-- @param #CHIEF self
|
||||
-- @param Core.Zone#ZONE Zone Zone, where the flight orbits.
|
||||
function CHIEF:RemoveAwacsZone(Zone)
|
||||
|
||||
-- Hand over to commander.
|
||||
local zone=self.commander:RemoveAwacsZone(Zone)
|
||||
|
||||
return zone
|
||||
end
|
||||
|
||||
--- Add a refuelling tanker zone.
|
||||
-- @param #CHIEF self
|
||||
-- @param Core.Zone#ZONE Zone Zone.
|
||||
@@ -1518,6 +1540,16 @@ function CHIEF:AddTankerZone(Zone, Altitude, Speed, Heading, Leg, RefuelSystem)
|
||||
return zone
|
||||
end
|
||||
|
||||
--- Remove a refuelling tanker zone.
|
||||
-- @param #CHIEF self
|
||||
-- @param Core.Zone#ZONE Zone Zone, where the flight orbits.
|
||||
function CHIEF:RemoveTankerZone(Zone)
|
||||
|
||||
-- Hand over to commander.
|
||||
local zone=self.commander:RemoveTankerZone(Zone)
|
||||
|
||||
return zone
|
||||
end
|
||||
|
||||
--- Set border zone set, defining your territory.
|
||||
--
|
||||
|
||||
@@ -710,6 +710,26 @@ function COMMANDER:AddGciCapZone(Zone, Altitude, Speed, Heading, Leg)
|
||||
return patrolzone
|
||||
end
|
||||
|
||||
--- Remove a GCI CAP.
|
||||
-- @param #COMMANDER self
|
||||
-- @param Core.Zone#ZONE Zone Zone, where the flight orbits.
|
||||
function COMMANDER:RemoveGciCapZone(Zone)
|
||||
|
||||
local patrolzone={} --Ops.AirWing#AIRWING.PatrolZone
|
||||
|
||||
patrolzone.zone=Zone
|
||||
for i,_patrolzone in pairs(self.gcicapZones) do
|
||||
if _patrolzone.zone == patrolzone.zone then
|
||||
if _patrolzone.mission and _patrolzone.mission:IsNotOver() then
|
||||
_patrolzone.mission:Cancel()
|
||||
end
|
||||
table.remove(self.gcicapZones, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
return patrolzone
|
||||
end
|
||||
|
||||
--- Add an AWACS zone.
|
||||
-- @param #COMMANDER self
|
||||
-- @param Core.Zone#ZONE Zone Zone.
|
||||
@@ -735,6 +755,26 @@ function COMMANDER:AddAwacsZone(Zone, Altitude, Speed, Heading, Leg)
|
||||
return awacszone
|
||||
end
|
||||
|
||||
--- Remove a AWACS zone.
|
||||
-- @param #COMMANDER self
|
||||
-- @param Core.Zone#ZONE Zone Zone, where the flight orbits.
|
||||
function COMMANDER:RemoveAwacsZone(Zone)
|
||||
|
||||
local awacszone={} --Ops.AirWing#AIRWING.PatrolZone
|
||||
|
||||
awacszone.zone=Zone
|
||||
for i,_awacszone in pairs(self.awacsZones) do
|
||||
if _awacszone.zone == awacszone.zone then
|
||||
if _awacszone.mission and _awacszone.mission:IsNotOver() then
|
||||
_awacszone.mission:Cancel()
|
||||
end
|
||||
table.remove(self.awacsZones, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
return awacszone
|
||||
end
|
||||
|
||||
--- Add a refuelling tanker zone.
|
||||
-- @param #COMMANDER self
|
||||
-- @param Core.Zone#ZONE Zone Zone.
|
||||
@@ -762,6 +802,26 @@ function COMMANDER:AddTankerZone(Zone, Altitude, Speed, Heading, Leg, RefuelSyst
|
||||
return tankerzone
|
||||
end
|
||||
|
||||
--- Remove a refuelling tanker zone.
|
||||
-- @param #COMMANDER self
|
||||
-- @param Core.Zone#ZONE Zone Zone, where the flight orbits.
|
||||
function COMMANDER:RemoveTankerZone(Zone)
|
||||
|
||||
local tankerzone={} --Ops.AirWing#AIRWING.PatrolZone
|
||||
|
||||
tankerzone.zone=Zone
|
||||
for i,_tankerzone in pairs(self.tankerZones) do
|
||||
if _tankerzone.zone == tankerzone.zone then
|
||||
if _tankerzone.mission and _tankerzone.mission:IsNotOver() then
|
||||
_tankerzone.mission:Cancel()
|
||||
end
|
||||
table.remove(self.tankerZones, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
return tankerzone
|
||||
end
|
||||
|
||||
--- Check if this mission is already in the queue.
|
||||
-- @param #COMMANDER self
|
||||
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
|
||||
|
||||
@@ -325,7 +325,322 @@ function FLIGHTGROUP:New(group)
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #number delay Delay in seconds.
|
||||
|
||||
-- TODO: Add pseudo functions.
|
||||
--- FSM Function OnAfterElementSpawned.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterElementSpawned
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element The flight group element.
|
||||
|
||||
--- FSM Function OnAfterElementParking.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterElementParking
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element The flight group element.
|
||||
-- @param Wrapper.Airbase#AIRBASE.ParkingSpot Spot Parking Spot.
|
||||
|
||||
--- FSM Function OnAfterElementEngineOn.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterElementEngineOn
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element The flight group element.
|
||||
|
||||
--- FSM Function OnAfterElementTaxiing.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterElementTaxiing
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element The flight group element.
|
||||
|
||||
--- FSM Function OnAfterElementTakeoff.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterElementTakeoff
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element The flight group element.
|
||||
-- @param Wrapper.Airbase#AIRBASE airbase The airbase if applicable or nil.
|
||||
|
||||
--- FSM Function OnAfterElementAirborne.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterElementAirborne
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element The flight group element.
|
||||
|
||||
--- FSM Function OnAfterElementLanded.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterElementLanded
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element The flight group element.
|
||||
-- @param Wrapper.Airbase#AIRBASE airbase The airbase if applicable or nil.
|
||||
|
||||
--- FSM Function OnAfterElementArrived.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterElementArrived
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element The flight group element.
|
||||
-- @param Wrapper.Airbase#AIRBASE airbase The airbase, where the element arrived.
|
||||
-- @param Wrapper.Airbase#AIRBASE.ParkingSpot Parking The Parking spot the element has.
|
||||
|
||||
--- FSM Function OnAfterElementDestroyed.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterElementDestroyed
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element The flight group element.
|
||||
|
||||
--- FSM Function OnAfterElementDead.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterElementDead
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element The flight group element.
|
||||
|
||||
--- FSM Function OnAfterSpawned.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterSpawned
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterParking.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterParking
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterTaxiing.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterTaxiing
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterTakeoff.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterTakeoff
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterAirborne.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterAirborne
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterCruise.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterCruise
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterLanding.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterLanding
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterLanded.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterLanded
|
||||
-- @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.
|
||||
|
||||
--- FSM Function OnAfterLandedAt.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterLandedAt
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterArrived.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterArrived
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterDead.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterDead
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterUpdateRoute.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterUpdateRoute
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param #number n Next waypoint index. Default is the one coming after that one that has been passed last.
|
||||
-- @param #number N Waypoint Max waypoint index to be included in the route. Default is the final waypoint.
|
||||
|
||||
--- FSM Function OnAfterOutOfMissilesAA.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterOutOfMissilesAA
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterOutOfMissilesAG.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterOutOfMissilesAG
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterRTB.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterRTB
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Wrapper.Airbase#AIRBASE airbase The airbase to hold at.
|
||||
-- @param #number SpeedTo Speed used for traveling from current position to holding point in knots. Default 75% of max speed.
|
||||
-- @param #number SpeedHold Holding speed in knots. Default 250 kts.
|
||||
-- @param #number SpeedLand Landing speed in knots. Default 170 kts.
|
||||
|
||||
--- FSM Function OnAfterLandAtAirbase.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterLandAtAirbase
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Wrapper.Airbase#AIRBASE airbase The airbase to hold at.
|
||||
|
||||
--- FSM Function OnAfterWait.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterWait
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param #number Duration Duration how long the group will be waiting in seconds. Default `nil` (=forever).
|
||||
-- @param #number Altitude Altitude in feet. Default 10,000 ft for airplanes and 1,000 feet for helos.
|
||||
-- @param #number Speed Speed in knots. Default 250 kts for airplanes and 20 kts for helos.
|
||||
|
||||
--- FSM Function OnAfterRefuel.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterRefuel
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Core.Point#COORDINATE Coordinate The coordinate.
|
||||
|
||||
--- FSM Function OnAfterRefueled.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterRefueled
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterDisengage.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterDisengage
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Core.Set#SET_UNIT TargetUnitSet
|
||||
|
||||
--- FSM Function OnAfterEngageTarget.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterEngageTarget
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param #table Target Target object. Can be a UNIT, STATIC, GROUP, SET_UNIT or SET_GROUP object.
|
||||
|
||||
--- FSM Function OnAfterLandAt.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterLandAt
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Core.Set#SET_UNIT TargetUnitSet
|
||||
|
||||
--- FSM Function OnAfterFuelLow.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterFuelLow
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnAfterFuelCritical.
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterFuelCritical
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- FSM Function OnBeforeUpdateRoute.
|
||||
-- @function [parent=#FLIGHTGROUP] OnBeforeUpdateRoute
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param #number n Next waypoint index. Default is the one coming after that one that has been passed last.
|
||||
-- @param #number N Waypoint Max waypoint index to be included in the route. Default is the final waypoint.
|
||||
-- @return #boolean Transision allowed?
|
||||
|
||||
--- FSM Function OnBeforeRTB.
|
||||
-- @function [parent=#FLIGHTGROUP] OnBeforeRTB
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Wrapper.Airbase#AIRBASE airbase The airbase to hold at.
|
||||
-- @param #number SpeedTo Speed used for travelling from current position to holding point in knots.
|
||||
-- @param #number SpeedHold Holding speed in knots.
|
||||
|
||||
--- FSM Function OnBeforeLandAtAirbase.
|
||||
-- @function [parent=#FLIGHTGROUP] OnBeforeLandAtAirbase
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Wrapper.Airbase#AIRBASE airbase The airbase to hold at.
|
||||
|
||||
--- FSM Function OnBeforeWait.
|
||||
-- @function [parent=#FLIGHTGROUP] OnBeforeWait
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param #number Duration Duration how long the group will be waiting in seconds. Default `nil` (=forever).
|
||||
-- @param #number Altitude Altitude in feet. Default 10,000 ft for airplanes and 1,000 feet for helos.
|
||||
-- @param #number Speed Speed in knots. Default 250 kts for airplanes and 20 kts for helos.
|
||||
|
||||
--- FSM Function OnBeforeLandAt.
|
||||
-- @function [parent=#FLIGHTGROUP] OnBeforeLandAt
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Core.Point#COORDINATE Coordinate The coordinate where to land. Default is current position.
|
||||
-- @param #number Duration The duration in seconds to remain on ground. Default 600 sec (10 min).
|
||||
|
||||
-- TODO: Add pseudo functions ? Normally done, but should be double check
|
||||
|
||||
-- Handle events:
|
||||
self:HandleEvent(EVENTS.Birth, self.OnEventBirth)
|
||||
@@ -4176,11 +4491,13 @@ function FLIGHTGROUP:GetClosestAirbase()
|
||||
|
||||
local coord=group:GetCoordinate()
|
||||
local coalition=self:GetCoalition()
|
||||
|
||||
local airbase=coord:GetClosestAirbase() --(nil, coalition)
|
||||
|
||||
return airbase
|
||||
|
||||
|
||||
if coord then
|
||||
local airbase=coord:GetClosestAirbase() --(nil, coalition)
|
||||
return airbase
|
||||
else
|
||||
return nil
|
||||
end
|
||||
else
|
||||
|
||||
return nil
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
-- ===
|
||||
-- @module Ops.PlayerTask
|
||||
-- @image OPS_PlayerTask.jpg
|
||||
-- @date Last Update June 2023
|
||||
-- @date Last Update July 2023
|
||||
|
||||
|
||||
do
|
||||
@@ -98,7 +98,7 @@ PLAYERTASK = {
|
||||
|
||||
--- PLAYERTASK class version.
|
||||
-- @field #string version
|
||||
PLAYERTASK.version="0.1.17"
|
||||
PLAYERTASK.version="0.1.19"
|
||||
|
||||
--- Generic task condition.
|
||||
-- @type PLAYERTASK.Condition
|
||||
@@ -1008,6 +1008,7 @@ do
|
||||
-- @field Core.ClientMenu#CLIENTMENUMANAGER ActiveTaskMenuTemplate
|
||||
-- @field Core.ClientMenu#CLIENTMENU ActiveTopMenu
|
||||
-- @field Core.ClientMenu#CLIENTMENU ActiveInfoMenu
|
||||
-- @field Core.ClientMenu#CLIENTMENU MenuNoTask
|
||||
-- @extends Core.Fsm#FSM
|
||||
|
||||
---
|
||||
@@ -1336,6 +1337,7 @@ PLAYERTASKCONTROLLER = {
|
||||
InfoHasCoordinate = false,
|
||||
UseTypeNames = false,
|
||||
Scoring = nil,
|
||||
MenuNoTask = nil,
|
||||
}
|
||||
|
||||
---
|
||||
@@ -1654,13 +1656,6 @@ function PLAYERTASKCONTROLLER:New(Name, Coalition, Type, ClientFilter)
|
||||
local starttime = math.random(5,10)
|
||||
self:__Status(starttime)
|
||||
|
||||
-- Player leaves
|
||||
self:HandleEvent(EVENTS.PlayerLeaveUnit, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.Ejection, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.Crash, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.PilotDead, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.PlayerEnterAircraft, self._EventHandler)
|
||||
|
||||
self:I(self.lid..self.version.." Started.")
|
||||
|
||||
return self
|
||||
@@ -2175,7 +2170,7 @@ end
|
||||
-- @return #PLAYERTASKCONTROLLER self
|
||||
function PLAYERTASKCONTROLLER:_EventHandler(EventData)
|
||||
self:T(self.lid.."_EventHandler: "..EventData.id)
|
||||
self:T(self.lid.."_EventHandler: "..EventData.IniPlayerName)
|
||||
--self:T(self.lid.."_EventHandler: "..EventData.IniPlayerName)
|
||||
if EventData.id == EVENTS.PlayerLeaveUnit or EventData.id == EVENTS.Ejection or EventData.id == EVENTS.Crash or EventData.id == EVENTS.PilotDead then
|
||||
if EventData.IniPlayerName then
|
||||
self:T(self.lid.."Event for player: "..EventData.IniPlayerName)
|
||||
@@ -2481,6 +2476,15 @@ function PLAYERTASKCONTROLLER:_CheckTaskQueue()
|
||||
self:T("*****Removing player " .. _id)
|
||||
self.TasksPerPlayer:PullByID(_id)
|
||||
end
|
||||
local clients=task:GetClientObjects()
|
||||
for _,client in pairs(clients) do
|
||||
self:_RemoveMenuEntriesForTask(task,client)
|
||||
--self:_SwitchMenuForClient(client,"Info")
|
||||
end
|
||||
for _,client in pairs(clients) do
|
||||
-- self:_RemoveMenuEntriesForTask(Task,client)
|
||||
self:_SwitchMenuForClient(client,"Info",5)
|
||||
end
|
||||
-- Follow-up tasks?
|
||||
local nexttasks = {}
|
||||
if task.FinalState == "Success" then
|
||||
@@ -3469,6 +3473,19 @@ function PLAYERTASKCONTROLLER:_UpdateJoinMenuTemplate()
|
||||
local actinfomenu = self.ActiveInfoMenu
|
||||
--local entrynumbers = {}
|
||||
--local existingentries = {}
|
||||
|
||||
if self.TaskQueue:Count() == 0 and self.MenuNoTask == nil then
|
||||
local menunotasks = self.gettext:GetEntry("MENUNOTASKS",self.locale)
|
||||
self.MenuNoTask = controller:NewEntry(menunotasks,self.JoinMenu)
|
||||
controller:AddEntry(self.MenuNoTask)
|
||||
end
|
||||
|
||||
if self.TaskQueue:Count() > 0 and self.MenuNoTask ~= nil then
|
||||
controller:DeleteGenericEntry(self.MenuNoTask)
|
||||
controller:DeleteF10Entry(self.MenuNoTask)
|
||||
self.MenuNoTask = nil
|
||||
end
|
||||
|
||||
local maxn = self.menuitemlimit
|
||||
-- Generate task type menu items
|
||||
for _type,_ in pairs(taskpertype) do
|
||||
@@ -3579,28 +3596,28 @@ function PLAYERTASKCONTROLLER:_RemoveMenuEntriesForTask(Task,Client)
|
||||
if Task then
|
||||
if Task.UUIDS and self.JoinTaskMenuTemplate then
|
||||
--self:I("***** JoinTaskMenuTemplate")
|
||||
UTILS.PrintTableToLog(Task.UUIDS)
|
||||
--UTILS.PrintTableToLog(Task.UUIDS)
|
||||
local controller = self.JoinTaskMenuTemplate
|
||||
for _,_uuid in pairs(Task.UUIDS) do
|
||||
local Entry = controller:FindEntryByUUID(_uuid)
|
||||
if Entry then
|
||||
controller:DeleteF10Entry(Entry,Client)
|
||||
controller:DeleteGenericEntry(Entry)
|
||||
UTILS.PrintTableToLog(controller.menutree)
|
||||
--UTILS.PrintTableToLog(controller.menutree)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if Task.AUUIDS and self.ActiveTaskMenuTemplate then
|
||||
--self:I("***** ActiveTaskMenuTemplate")
|
||||
UTILS.PrintTableToLog(Task.AUUIDS)
|
||||
--UTILS.PrintTableToLog(Task.AUUIDS)
|
||||
for _,_uuid in pairs(Task.AUUIDS) do
|
||||
local controller = self.ActiveTaskMenuTemplate
|
||||
local Entry = controller:FindEntryByUUID(_uuid)
|
||||
if Entry then
|
||||
controller:DeleteF10Entry(Entry,Client)
|
||||
controller:DeleteGenericEntry(Entry)
|
||||
UTILS.PrintTableToLog(controller.menutree)
|
||||
--UTILS.PrintTableToLog(controller.menutree)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -3641,8 +3658,13 @@ function PLAYERTASKCONTROLLER:_CreateJoinMenuTemplate()
|
||||
self.JoinInfoMenu = JoinTaskMenuTemplate:NewEntry(menutaskinfo,self.JoinTopMenu)
|
||||
end
|
||||
|
||||
if self.TaskQueue:Count() == 0 then
|
||||
JoinTaskMenuTemplate:NewEntry(menunotasks,self.JoinMenu)
|
||||
if self.TaskQueue:Count() == 0 and self.MenuNoTask == nil then
|
||||
self.MenuNoTask = JoinTaskMenuTemplate:NewEntry(menunotasks,self.JoinMenu)
|
||||
end
|
||||
|
||||
if self.TaskQueue:Count() > 0 and self.MenuNoTask ~= nil then
|
||||
JoinTaskMenuTemplate:DeleteGenericEntry(self.MenuNoTask)
|
||||
self.MenuNoTask = nil
|
||||
end
|
||||
|
||||
self.JoinTaskMenuTemplate = JoinTaskMenuTemplate
|
||||
@@ -4043,6 +4065,12 @@ function PLAYERTASKCONTROLLER:onafterStart(From, Event, To)
|
||||
self:T(self.lid.."onafterStart")
|
||||
self:_CreateJoinMenuTemplate()
|
||||
self:_CreateActiveTaskMenuTemplate()
|
||||
-- Player Events
|
||||
self:HandleEvent(EVENTS.PlayerLeaveUnit, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.Ejection, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.Crash, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.PilotDead, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.PlayerEnterAircraft, self._EventHandler)
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -4190,6 +4218,15 @@ function PLAYERTASKCONTROLLER:onafterTaskFailed(From, Event, To, Task)
|
||||
taskname = string.format(failtxttts, self.MenuName or self.Name, Task.PlayerTaskNr, tostring(Task.TTSType))
|
||||
self.SRSQueue:NewTransmission(taskname,nil,self.SRS,nil,2)
|
||||
end
|
||||
local clients=Task:GetClientObjects()
|
||||
for _,client in pairs(clients) do
|
||||
self:_RemoveMenuEntriesForTask(Task,client)
|
||||
--self:_SwitchMenuForClient(client,"Info")
|
||||
end
|
||||
for _,client in pairs(clients) do
|
||||
-- self:_RemoveMenuEntriesForTask(Task,client)
|
||||
self:_SwitchMenuForClient(client,"Info",5)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user