mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'develop' into FF/Ops
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1517,6 +1517,23 @@ function AWACS:_SubScribeTactRadio(Group,Frequency)
|
||||
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
|
||||
@@ -1596,7 +1613,7 @@ function AWACS:_NewRadioEntry(TextTTS, TextScreen,GID,IsGroup,ToScreen,IsNew,Fro
|
||||
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
|
||||
@@ -6180,6 +6197,8 @@ function AWACS:onafterStatus(From, Event, To)
|
||||
|
||||
self:_CheckMerges()
|
||||
|
||||
self:_CheckSubscribers()
|
||||
|
||||
local outcome, targets = self:_TargetSelectionProcess(true)
|
||||
|
||||
self:_CheckTaskQueue()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.18"
|
||||
PLAYERTASK.version="0.1.19"
|
||||
|
||||
--- Generic task condition.
|
||||
-- @type PLAYERTASK.Condition
|
||||
@@ -1656,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
|
||||
@@ -2177,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)
|
||||
@@ -2483,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
|
||||
@@ -3594,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
|
||||
@@ -4063,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
|
||||
|
||||
@@ -4210,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