mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#changes
This commit is contained in:
parent
27fd726ce3
commit
9c95b91086
@ -1278,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())
|
||||
self:T({From, Event, To})
|
||||
self:T("Airbase category is "..self.airbase:GetAirbaseCategory())
|
||||
|
||||
-- Check that this is an airdrome.
|
||||
if self.airbase:GetAirbaseCategory() == Airbase.Category.SHIP then
|
||||
@ -1340,7 +1341,7 @@ end
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function ATIS:onafterStatus( From, Event, To )
|
||||
|
||||
self:T({From, Event, To})
|
||||
-- Get FSM state.
|
||||
local fsmstate = self:GetState()
|
||||
|
||||
@ -1362,7 +1363,7 @@ function ATIS:onafterStatus( From, Event, To )
|
||||
self:T( self.lid .. text )
|
||||
|
||||
if not self:Is("Stopped") then
|
||||
self:__Status( -60 )
|
||||
self:__Status( 60 )
|
||||
end
|
||||
end
|
||||
|
||||
@ -1376,7 +1377,8 @@ end
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function ATIS:onafterCheckQueue( From, Event, To )
|
||||
|
||||
self:T({From, Event, To})
|
||||
if not self:Is("Stopped") then
|
||||
if self.useSRS then
|
||||
|
||||
self:Broadcast()
|
||||
@ -1392,9 +1394,9 @@ function ATIS:onafterCheckQueue( From, Event, To )
|
||||
|
||||
end
|
||||
|
||||
if not self:Is("Stopped") then
|
||||
|
||||
-- Check back in 5 seconds.
|
||||
self:__CheckQueue( -math.abs( self.dTQueueCheck ) )
|
||||
self:__CheckQueue( math.abs( self.dTQueueCheck ) )
|
||||
end
|
||||
end
|
||||
|
||||
@ -1404,7 +1406,7 @@ end
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function ATIS:onafterBroadcast( From, Event, To )
|
||||
|
||||
self:T({From, Event, To})
|
||||
-- Get current coordinate.
|
||||
local coord = self.airbase:GetCoordinate()
|
||||
|
||||
@ -2417,6 +2419,7 @@ end
|
||||
-- @param #string To To state.
|
||||
-- @param #string Text Report text.
|
||||
function ATIS:onafterReport( From, Event, To, Text )
|
||||
self:T({From, Event, To})
|
||||
self:T( self.lid .. string.format( "Report:\n%s", Text ) )
|
||||
|
||||
if self.useSRS and self.msrs then
|
||||
|
||||
@ -152,12 +152,16 @@
|
||||
-- @field #boolean ICLSon Automatic ICLS is activated.
|
||||
-- @field #number ICLSchannel ICLS channel.
|
||||
-- @field #string ICLSmorse ICLS morse code, e.g. "STN".
|
||||
-- @field #AIRBOSS.Radio PilotRadio Radio for Pilot calls.
|
||||
-- @field #AIRBOSS.Radio LSORadio Radio for LSO calls.
|
||||
-- @field #number LSOFreq LSO radio frequency in MHz.
|
||||
-- @field #string LSOModu LSO radio modulation "AM" or "FM".
|
||||
-- @field #AIRBOSS.Radio MarshalRadio Radio for carrier calls.
|
||||
-- @field #number MarshalFreq Marshal radio frequency in MHz.
|
||||
-- @field #string MarshalModu Marshal radio modulation "AM" or "FM".
|
||||
-- @field #AIRBOSS.Radio AirbossRadio Radio for carrier calls.
|
||||
-- @field #number AirbossFreq Airboss radio frequency in MHz.
|
||||
-- @field #string AirbossModu Airboss radio modulation "AM" or "FM".
|
||||
-- @field #number TowerFreq Tower radio frequency in MHz.
|
||||
-- @field Core.Scheduler#SCHEDULER radiotimer Radio queue scheduler.
|
||||
-- @field Core.Zone#ZONE_UNIT zoneCCA Carrier controlled area (CCA), i.e. a zone of 50 NM radius around the carrier.
|
||||
@ -1880,6 +1884,7 @@ function AIRBOSS:New( carriername, alias )
|
||||
|
||||
-- Set up Airboss radio.
|
||||
self:SetMarshalRadio()
|
||||
self:SetAirbossRadio()
|
||||
|
||||
-- Set up LSO radio.
|
||||
self:SetLSORadio()
|
||||
@ -3092,6 +3097,9 @@ end
|
||||
-- @param #AIRBOSS self
|
||||
-- @param #number Frequency (Optional) Frequency in MHz. Default 264 MHz.
|
||||
-- @param #string Modulation (Optional) Modulation, "AM" or "FM". Default "AM".
|
||||
-- @param #string Voice (Optional) SRS specific voice
|
||||
-- @param #string Gender (Optional) SRS specific gender
|
||||
-- @param #string Culture (Optional) SRS specific culture
|
||||
-- @return #AIRBOSS self
|
||||
function AIRBOSS:SetLSORadio( Frequency, Modulation, Voice, Gender, Culture )
|
||||
|
||||
@ -3108,6 +3116,9 @@ function AIRBOSS:SetLSORadio( Frequency, Modulation, Voice, Gender, Culture )
|
||||
self.LSORadio.frequency = self.LSOFreq
|
||||
self.LSORadio.modulation = self.LSOModu
|
||||
self.LSORadio.alias = "LSO"
|
||||
self.LSORadio.voice = Voice
|
||||
self.LSORadio.gender = Gender or "male"
|
||||
self.LSORadio.culture = Culture or "en-US"
|
||||
|
||||
return self
|
||||
end
|
||||
@ -3156,6 +3167,9 @@ end
|
||||
-- @param #AIRBOSS self
|
||||
-- @param #number Frequency (Optional) Frequency in MHz. Default 305 MHz.
|
||||
-- @param #string Modulation (Optional) Modulation, "AM" or "FM". Default "AM".
|
||||
-- @param #string Voice (Optional) SRS specific voice
|
||||
-- @param #string Gender (Optional) SRS specific gender
|
||||
-- @param #string Culture (Optional) SRS specific culture
|
||||
-- @return #AIRBOSS self
|
||||
function AIRBOSS:SetMarshalRadio( Frequency, Modulation, Voice, Gender, Culture )
|
||||
|
||||
@ -3172,6 +3186,9 @@ function AIRBOSS:SetMarshalRadio( Frequency, Modulation, Voice, Gender, Culture
|
||||
self.MarshalRadio.frequency = self.MarshalFreq
|
||||
self.MarshalRadio.modulation = self.MarshalModu
|
||||
self.MarshalRadio.alias = "MARSHAL"
|
||||
self.MarshalRadio.voice = Voice
|
||||
self.MarshalRadio.gender = Gender or "male"
|
||||
self.MarshalRadio.culture = Culture or "en-US"
|
||||
|
||||
return self
|
||||
end
|
||||
@ -5442,6 +5459,7 @@ function AIRBOSS:_GetAircraftParameters( playerData, step )
|
||||
local skyhawk = playerData.actype == AIRBOSS.AircraftCarrier.A4EC
|
||||
local tomcat = playerData.actype == AIRBOSS.AircraftCarrier.F14A or playerData.actype == AIRBOSS.AircraftCarrier.F14B
|
||||
local harrier = playerData.actype == AIRBOSS.AircraftCarrier.AV8B
|
||||
local goshawk = playerData.actype == AIRBOSS.AircraftCarrier.T45C
|
||||
|
||||
-- Return values.
|
||||
local alt
|
||||
@ -5907,6 +5925,7 @@ function AIRBOSS:_ScanCarrierZone()
|
||||
-- Get aircraft type name.
|
||||
local actype = group:GetTypeName()
|
||||
|
||||
-- Create a new flight group
|
||||
if knownflight then
|
||||
|
||||
-- Debug output.
|
||||
@ -11536,10 +11555,6 @@ end
|
||||
-- @return #number Carrier heading in degrees.
|
||||
function AIRBOSS:GetHeadingIntoWind( magnetic, coord )
|
||||
|
||||
<<<<<<< HEAD
|
||||
-- Get direction the wind is blowing from. This is where we want to go.
|
||||
local windfrom, vwind = self:GetWind( nil, nil, coord )
|
||||
=======
|
||||
local function adjustDegreesForWindSpeed(windSpeed)
|
||||
local degreesAdjustment = 0
|
||||
-- the windspeeds are in m/s
|
||||
@ -11582,7 +11597,6 @@ function AIRBOSS:GetHeadingIntoWind( magnetic, coord )
|
||||
vwind = vwind + adjustDegreesForWindSpeed(vwind)
|
||||
|
||||
--self:I("windfrom="..windfrom.." (c)vwind="..vwind)
|
||||
>>>>>>> origin/develop
|
||||
|
||||
-- Actually, we want the runway in the wind.
|
||||
local intowind = windfrom - self.carrierparam.rwyangle
|
||||
@ -13517,8 +13531,8 @@ function AIRBOSS:CarrierTurnIntoWind( time, vdeck, uturn )
|
||||
-- Wind speed.
|
||||
local _, vwind = self:GetWind()
|
||||
|
||||
-- Speed of carrier in m/s but at least 2 knots.
|
||||
local vtot = math.max( vdeck - vwind, UTILS.KnotsToMps( 2 ) )
|
||||
-- Speed of carrier in m/s but at least 4 knots.
|
||||
local vtot = math.max( vdeck - vwind, UTILS.KnotsToMps( 4 ) )
|
||||
|
||||
-- Distance to travel
|
||||
local dist = vtot * time
|
||||
@ -14721,23 +14735,6 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
|
||||
if radio == nil or call == nil then
|
||||
return
|
||||
end
|
||||
<<<<<<< HEAD
|
||||
|
||||
-- Create a new radio transmission item.
|
||||
local transmission = {} -- #AIRBOSS.Radioitem
|
||||
|
||||
transmission.radio = radio
|
||||
transmission.call = call
|
||||
transmission.Tplay = timer.getAbsTime() + (delay or 0)
|
||||
transmission.interval = interval
|
||||
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 )
|
||||
=======
|
||||
|
||||
if not self.SRS then
|
||||
|
||||
@ -14849,48 +14846,10 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
|
||||
local text = call.subtitle
|
||||
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)
|
||||
>>>>>>> origin/develop
|
||||
self.SRSQ:NewTransmission(srstext, call.duration, self.SRS, nil, 0.1, nil, call.subtitle, call.subduration, frequency, modulation, gender, culture, voice, volume, radio.alias)
|
||||
end
|
||||
end
|
||||
|
||||
<<<<<<< HEAD
|
||||
-- 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
|
||||
=======
|
||||
--- Set SRS voice for the pilot calls.
|
||||
-- @param #AIRBOSS self
|
||||
-- @param #string Voice (Optional) SRS specific voice
|
||||
@ -14910,7 +14869,6 @@ function AIRBOSS:SetSRSPilotVoice( Voice, Gender, Culture )
|
||||
end
|
||||
|
||||
return self
|
||||
>>>>>>> origin/develop
|
||||
end
|
||||
|
||||
--- Check if a call needs a subtitle because the complete voice overs are not available.
|
||||
@ -15156,6 +15114,39 @@ function AIRBOSS:_RadioFilename( call, loud, channel )
|
||||
return filename
|
||||
end
|
||||
|
||||
--- Format text into SRS friendly string
|
||||
-- @param #AIRBOSS self
|
||||
-- @param #string text
|
||||
-- @return #string text
|
||||
function AIRBOSS:_GetNiceSRSText(text)
|
||||
text = string.gsub(text,"================================\n","")
|
||||
text = string.gsub(text,"||","parallel")
|
||||
text = string.gsub(text,"==","perpendicular")
|
||||
text = string.gsub(text,"BRC","Base recovery")
|
||||
--text = string.gsub(text,"#","Number")
|
||||
text = string.gsub(text,"%((%a+)%)","Morse %1")
|
||||
text = string.gsub(text,"°C","° Celsius")
|
||||
text = string.gsub(text,"°"," degrees")
|
||||
text = string.gsub(text," FB "," Final bearing ")
|
||||
text = string.gsub(text," ops"," operations ")
|
||||
text = string.gsub(text," kts"," knots")
|
||||
text = string.gsub(text,"TACAN","Tackan")
|
||||
text = string.gsub(text,"ICLS","I.C.L.S.")
|
||||
text = string.gsub(text,"LSO","L.S.O.")
|
||||
text = string.gsub(text,"inHg","inches of Mercury")
|
||||
text = string.gsub(text,"QFE","Q.F.E.")
|
||||
text = string.gsub(text,"hPa","hecto pascal")
|
||||
text = string.gsub(text," NM"," nautical miles")
|
||||
text = string.gsub(text," ft"," feet")
|
||||
text = string.gsub(text,"A/C","aircraft")
|
||||
text = string.gsub(text,"(#[%a%d%p%s]+)\n","")
|
||||
text = string.gsub(text,"%.000"," dot zero")
|
||||
text = string.gsub(text,"00"," double zero")
|
||||
text = string.gsub(text," 0 "," zero " )
|
||||
text = string.gsub(text,"\n","; ")
|
||||
return text
|
||||
end
|
||||
|
||||
--- Send text message to player client.
|
||||
-- Message format will be "SENDER: RECCEIVER, MESSAGE".
|
||||
-- @param #AIRBOSS self
|
||||
@ -15167,7 +15158,7 @@ end
|
||||
-- @param #boolean clear If true, clear screen from previous messages.
|
||||
-- @param #number delay Delay in seconds, before the message is displayed.
|
||||
function AIRBOSS:MessageToPlayer( playerData, message, sender, receiver, duration, clear, delay )
|
||||
|
||||
self:I({sender,receiver,message})
|
||||
if playerData and message and message ~= "" then
|
||||
|
||||
-- Default duration.
|
||||
@ -15190,8 +15181,6 @@ 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
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
if not self.SRS then
|
||||
-- Wait until previous sound finished.
|
||||
@ -15244,50 +15233,39 @@ function AIRBOSS:MessageToPlayer( playerData, message, sender, receiver, duratio
|
||||
local culture = self.MarshalRadio.culture
|
||||
|
||||
if not sender then sender = "AIRBOSS" end
|
||||
>>>>>>> origin/develop
|
||||
|
||||
-- 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
|
||||
if string.find(sender,"AIRBOSS" ) then
|
||||
frequency = self.AirbossRadio.frequency
|
||||
modulation = self.AirbossRadio.modulation
|
||||
voice = self.AirbossRadio.voice
|
||||
gender = self.AirbossRadio.gender
|
||||
culture = self.AirbossRadio.culture
|
||||
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
|
||||
--if sender == "MARSHAL" then
|
||||
--voice = self.MarshalRadio.voice
|
||||
--gender = self.MarshalRadio.gender
|
||||
--culture = self.MarshalRadio.culture
|
||||
--end
|
||||
|
||||
if sender == "LSO" then
|
||||
frequency = self.LSORadio.frequency
|
||||
modulation = self.LSORadio.modulation
|
||||
voice = self.LSORadio.voice
|
||||
gender = self.LSORadio.gender
|
||||
culture = self.LSORadio.culture
|
||||
--elseif not sender then
|
||||
-- TODO - what freq to use here?
|
||||
--frequency = self.AirbossRadio.frequency
|
||||
--modulation = self.AirbossRadio.modulation
|
||||
--sender = "AIRBOSS"
|
||||
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
|
||||
self:I(self.lid..text)
|
||||
self:I({sender,frequency,modulation,voice})
|
||||
local srstext = self:_GetNiceSRSText(text)
|
||||
self.SRSQ:NewTransmission(srstext,duration,self.SRS,nil,0.1,nil,nil,nil,frequency,modulation,gender,culture,voice,nil,sender)
|
||||
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 )
|
||||
USERSOUND:New( filename ):ToGroup( playerData.group, wait )
|
||||
end
|
||||
|
||||
-- Text message to player client.
|
||||
if playerData.client then
|
||||
MESSAGE:New( text, duration, sender, clear ):ToClient( playerData.client )
|
||||
@ -16626,7 +16604,7 @@ function AIRBOSS:_RequestSpinning( _unitName )
|
||||
-- Some advice.
|
||||
if playerData.difficulty == AIRBOSS.Difficulty.EASY then
|
||||
local text = "Climb to 1200 feet and proceed to the initial again."
|
||||
self:MessageToPlayer( playerData, text, "INSTRUCTOR", "" )
|
||||
self:MessageToPlayer( playerData, text, "AIRBOSS", "" )
|
||||
end
|
||||
|
||||
return
|
||||
@ -17381,7 +17359,7 @@ function AIRBOSS:_DisplayCarrierInfo( _unitname )
|
||||
state = "Deck closed"
|
||||
end
|
||||
if self.turning then
|
||||
state = state .. " (turning currently)"
|
||||
state = state .. " (currently turning)"
|
||||
end
|
||||
|
||||
-- Message text.
|
||||
|
||||
@ -327,6 +327,15 @@ function FLIGHTGROUP:New(group)
|
||||
|
||||
-- TODO: Add pseudo functions.
|
||||
|
||||
--- FSM Function OnAfterLandAtAirbase
|
||||
-- @function [parent=#FLIGHTGROUP] OnAfterLandAtAirbase
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From State.
|
||||
-- @param #string Event Trigger.
|
||||
-- @param #string To State.
|
||||
-- @param Wrapper.Airbase#AIRBASE Airbase.
|
||||
-- @return #FLIGHTGROUP self
|
||||
|
||||
-- Handle events:
|
||||
self:HandleEvent(EVENTS.Birth, self.OnEventBirth)
|
||||
self:HandleEvent(EVENTS.EngineStartup, self.OnEventEngineStartup)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user