mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
- Added a NoTrace option to the scheduler, so for those schedulers that have a schedule in microseconds, you may wanna use the function NoTrace(), to avoid spamming the dcs.log.
- Started with the implementation of multiple languages of speech. Got now a Russian and English prototype working. - Moved radio frequency settings to a squadron, so multiple squadrons can communicate in their own radio frequency.
This commit is contained in:
parent
fb875077d7
commit
5cdaf53727
@ -1685,6 +1685,8 @@ do -- AI_A2A_DISPATCHER
|
|||||||
DefenderSquadron.TemplatePrefixes = TemplatePrefixes
|
DefenderSquadron.TemplatePrefixes = TemplatePrefixes
|
||||||
DefenderSquadron.Captured = false -- Not captured. This flag will be set to true, when the airbase where the squadron is located, is captured.
|
DefenderSquadron.Captured = false -- Not captured. This flag will be set to true, when the airbase where the squadron is located, is captured.
|
||||||
|
|
||||||
|
self:SetSquadronLanguage( SquadronName, "EN" ) -- Squadrons speak English by default.
|
||||||
|
|
||||||
self:F( { Squadron = {SquadronName, AirbaseName, TemplatePrefixes, ResourceCount } } )
|
self:F( { Squadron = {SquadronName, AirbaseName, TemplatePrefixes, ResourceCount } } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@ -2830,6 +2832,59 @@ do -- AI_A2A_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Set the squadron language.
|
||||||
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
|
-- @param #string SquadronName The name of the squadron.
|
||||||
|
-- @param #string Language A string defining the language to be embedded within the miz file.
|
||||||
|
-- @return #AI_A2A_DISPATCHER
|
||||||
|
-- @usage
|
||||||
|
--
|
||||||
|
-- -- Now Setup the A2A dispatcher, and initialize it using the Detection object.
|
||||||
|
-- A2ADispatcher = AI_A2A_DISPATCHER:New( Detection )
|
||||||
|
--
|
||||||
|
-- -- Set for English.
|
||||||
|
-- A2ADispatcher:SetSquadronLanguage( "SquadronName", "EN" ) -- This squadron speaks English.
|
||||||
|
--
|
||||||
|
-- -- Set for Russian.
|
||||||
|
-- A2ADispatcher:SetSquadronLanguage( "SquadronName", "RU" ) -- This squadron speaks Russian.
|
||||||
|
function AI_A2A_DISPATCHER:SetSquadronLanguage( SquadronName, Language )
|
||||||
|
|
||||||
|
local DefenderSquadron = self:GetSquadron( SquadronName )
|
||||||
|
DefenderSquadron.Language = Language
|
||||||
|
|
||||||
|
if DefenderSquadron.RadioQueue then
|
||||||
|
DefenderSquadron.RadioQueue:SetLanguage( Language )
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Set the frequency of communication and the mode of communication for voice overs.
|
||||||
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
|
-- @param #string SquadronName The name of the squadron.
|
||||||
|
-- @param #number RadioFrequency The frequency of communication.
|
||||||
|
-- @param #number RadioModulation The modulation of communication.
|
||||||
|
-- @param #number RadioPower The power in Watts of communication.
|
||||||
|
function AI_A2A_DISPATCHER:SetSquadronRadioFrequency( SquadronName, RadioFrequency, RadioModulation, RadioPower )
|
||||||
|
|
||||||
|
local DefenderSquadron = self:GetSquadron( SquadronName )
|
||||||
|
DefenderSquadron.RadioFrequency = RadioFrequency
|
||||||
|
DefenderSquadron.RadioModulation = RadioModulation or radio.modulation.AM
|
||||||
|
DefenderSquadron.RadioPower = RadioPower or 100
|
||||||
|
|
||||||
|
if DefenderSquadron.RadioQueue then
|
||||||
|
DefenderSquadron.RadioQueue:Stop()
|
||||||
|
end
|
||||||
|
|
||||||
|
DefenderSquadron.RadioQueue = nil
|
||||||
|
|
||||||
|
DefenderSquadron.RadioQueue = RADIOSPEECH:New( DefenderSquadron.RadioFrequency, DefenderSquadron.RadioModulation )
|
||||||
|
DefenderSquadron.RadioQueue.power = DefenderSquadron.RadioPower
|
||||||
|
DefenderSquadron.RadioQueue:Start( 0.5 )
|
||||||
|
|
||||||
|
DefenderSquadron.RadioQueue:SetLanguage( DefenderSquadron.Language )
|
||||||
|
end
|
||||||
|
|
||||||
--- Add defender to squadron. Resource count will get smaller.
|
--- Add defender to squadron. Resource count will get smaller.
|
||||||
-- @param #AI_A2A_DISPATCHER self
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
@ -3186,7 +3241,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
|
|
||||||
if Squadron then
|
if Squadron then
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. " Wheels up.", DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. " Wheels up.", DefenderGroup )
|
||||||
AI_A2A_Fsm:__Patrol( 2 ) -- Start Patrolling
|
AI_A2A_Fsm:__Patrol( 2 ) -- Start Patrolling
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -3199,7 +3254,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
local Dispatcher = self:GetDispatcher() -- #AI_A2G_DISPATCHER
|
local Dispatcher = self:GetDispatcher() -- #AI_A2G_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
if Squadron then
|
if Squadron then
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", patrolling.", DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", patrolling.", DefenderGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||||
@ -3214,7 +3269,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
local DefenderName = DefenderGroup:GetCallsign()
|
local DefenderName = DefenderGroup:GetCallsign()
|
||||||
local Dispatcher = self:GetDispatcher() -- #AI_A2A_DISPATCHER
|
local Dispatcher = self:GetDispatcher() -- #AI_A2A_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. " returning to base.", DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. " returning to base.", DefenderGroup )
|
||||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -3396,7 +3451,11 @@ do -- AI_A2A_DISPATCHER
|
|||||||
local DefenderTarget = Dispatcher:GetDefenderTaskTarget( DefenderGroup )
|
local DefenderTarget = Dispatcher:GetDefenderTaskTarget( DefenderGroup )
|
||||||
|
|
||||||
if DefenderTarget then
|
if DefenderTarget then
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. " wheels up.", DefenderGroup )
|
if Squadron.Language == "EN" then
|
||||||
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. " wheels up.", DefenderGroup )
|
||||||
|
elseif Squadron.Language == "RU" then
|
||||||
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. " колеса вверх.", DefenderGroup )
|
||||||
|
end
|
||||||
--Fsm:__Engage( 2, DefenderTarget.Set ) -- Engage on the TargetSetUnit
|
--Fsm:__Engage( 2, DefenderTarget.Set ) -- Engage on the TargetSetUnit
|
||||||
Fsm:EngageRoute( DefenderTarget.Set ) -- Engage on the TargetSetUnit
|
Fsm:EngageRoute( DefenderTarget.Set ) -- Engage on the TargetSetUnit
|
||||||
end
|
end
|
||||||
@ -3413,7 +3472,13 @@ do -- AI_A2A_DISPATCHER
|
|||||||
local FirstUnit = AttackSetUnit:GetFirst()
|
local FirstUnit = AttackSetUnit:GetFirst()
|
||||||
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
||||||
|
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", intercepting bogeys at " .. Coordinate:ToStringA2A( DefenderGroup ), DefenderGroup )
|
if Squadron.Language == "EN" then
|
||||||
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", intercepting bogeys at " .. Coordinate:ToStringA2A( DefenderGroup, nil, Squadron.Language ), DefenderGroup )
|
||||||
|
elseif Squadron.Language == "RU" then
|
||||||
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", перехват самолетов в " .. Coordinate:ToStringA2A( DefenderGroup, nil, Squadron.Language ), DefenderGroup )
|
||||||
|
elseif Squadron.Language == "DE" then
|
||||||
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", Eindringlinge abfangen bei" .. Coordinate:ToStringA2A( DefenderGroup, nil, Squadron.Language ), DefenderGroup )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self:GetParent( Fsm ).onafterEngageRoute( self, DefenderGroup, From, Event, To, AttackSetUnit )
|
self:GetParent( Fsm ).onafterEngageRoute( self, DefenderGroup, From, Event, To, AttackSetUnit )
|
||||||
end
|
end
|
||||||
@ -3429,7 +3494,11 @@ do -- AI_A2A_DISPATCHER
|
|||||||
local FirstUnit = AttackSetUnit:GetFirst()
|
local FirstUnit = AttackSetUnit:GetFirst()
|
||||||
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
||||||
|
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", engaging bogeys at " .. Coordinate:ToStringA2A( DefenderGroup ), DefenderGroup )
|
if Squadron.Language == "EN" then
|
||||||
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", engaging bogeys at " .. Coordinate:ToStringA2A( DefenderGroup, nil, Squadron.Language ), DefenderGroup )
|
||||||
|
elseif Squadron.Language == "RU" then
|
||||||
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", захватывающие самолеты в " .. Coordinate:ToStringA2A( DefenderGroup, nil, Squadron.Language ), DefenderGroup )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self:GetParent( Fsm ).onafterEngage( self, DefenderGroup, From, Event, To, AttackSetUnit )
|
self:GetParent( Fsm ).onafterEngage( self, DefenderGroup, From, Event, To, AttackSetUnit )
|
||||||
end
|
end
|
||||||
@ -3441,7 +3510,14 @@ do -- AI_A2A_DISPATCHER
|
|||||||
local DefenderName = DefenderGroup:GetCallsign()
|
local DefenderName = DefenderGroup:GetCallsign()
|
||||||
local Dispatcher = self:GetDispatcher() -- #AI_A2A_DISPATCHER
|
local Dispatcher = self:GetDispatcher() -- #AI_A2A_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. " returning to base.", DefenderGroup )
|
|
||||||
|
if Squadron then
|
||||||
|
if Squadron.Language == "EN" then
|
||||||
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. " returning to base.", DefenderGroup )
|
||||||
|
elseif Squadron.Language == "RU" then
|
||||||
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", возвращаясь на базу.", DefenderGroup )
|
||||||
|
end
|
||||||
|
end
|
||||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -3467,7 +3543,11 @@ do -- AI_A2A_DISPATCHER
|
|||||||
local Dispatcher = self:GetDispatcher() -- #AI_A2A_DISPATCHER
|
local Dispatcher = self:GetDispatcher() -- #AI_A2A_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
|
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. " landing at base.", DefenderGroup )
|
if Squadron.Language == "EN" then
|
||||||
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. " landing at base.", DefenderGroup )
|
||||||
|
elseif Squadron.Language == "RU" then
|
||||||
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", захватывающие самолеты в посадка на базу.", DefenderGroup )
|
||||||
|
end
|
||||||
|
|
||||||
if Action and Action == "Destroy" then
|
if Action and Action == "Destroy" then
|
||||||
Dispatcher:RemoveDefenderFromSquadron( Squadron, DefenderGroup )
|
Dispatcher:RemoveDefenderFromSquadron( Squadron, DefenderGroup )
|
||||||
|
|||||||
@ -3313,6 +3313,31 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Set the frequency of communication and the mode of communication for voice overs.
|
||||||
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
|
-- @param #string SquadronName The name of the squadron.
|
||||||
|
-- @param #number RadioFrequency The frequency of communication.
|
||||||
|
-- @param #number RadioModulation The modulation of communication.
|
||||||
|
-- @param #number RadioPower The power in Watts of communication.
|
||||||
|
function AI_A2G_DISPATCHER:SetSquadronRadioFrequency( SquadronName, RadioFrequency, RadioModulation, RadioPower )
|
||||||
|
|
||||||
|
local DefenderSquadron = self:GetSquadron( SquadronName )
|
||||||
|
DefenderSquadron.RadioFrequency = RadioFrequency
|
||||||
|
DefenderSquadron.RadioModulation = RadioModulation or radio.modulation.AM
|
||||||
|
DefenderSquadron.RadioPower = RadioPower or 100
|
||||||
|
|
||||||
|
if DefenderSquadron.RadioQueue then
|
||||||
|
DefenderSquadron.RadioQueue:Stop()
|
||||||
|
end
|
||||||
|
|
||||||
|
DefenderSquadron.RadioQueue = nil
|
||||||
|
|
||||||
|
DefenderSquadron.RadioQueue = RADIOSPEECH:New( DefenderSquadron.RadioFrequency, DefenderSquadron.RadioModulation )
|
||||||
|
DefenderSquadron.RadioQueue.power = DefenderSquadron.RadioPower
|
||||||
|
DefenderSquadron.RadioQueue:Start( 0.5 )
|
||||||
|
|
||||||
|
DefenderSquadron.RadioQueue:SetLanguage( DefenderSquadron.Language )
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
@ -3674,7 +3699,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
|
|
||||||
if Squadron then
|
if Squadron then
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", wheels up.", DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", wheels up.", DefenderGroup )
|
||||||
AI_A2G_Fsm:Patrol() -- Engage on the TargetSetUnit
|
AI_A2G_Fsm:Patrol() -- Engage on the TargetSetUnit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -3687,7 +3712,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local Dispatcher = self:GetDispatcher() -- #AI_A2G_DISPATCHER
|
local Dispatcher = self:GetDispatcher() -- #AI_A2G_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
if Squadron then
|
if Squadron then
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", patrolling.", DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", patrolling.", DefenderGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||||
@ -3706,7 +3731,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local FirstUnit = AttackSetUnit:GetFirst()
|
local FirstUnit = AttackSetUnit:GetFirst()
|
||||||
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
||||||
|
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", moving on to ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", moving on to ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -3721,7 +3746,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
if FirstUnit then
|
if FirstUnit then
|
||||||
local Coordinate = FirstUnit:GetCoordinate()
|
local Coordinate = FirstUnit:GetCoordinate()
|
||||||
|
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", engaging ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", engaging ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -3732,7 +3757,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local DefenderName = DefenderGroup:GetCallsign()
|
local DefenderName = DefenderGroup:GetCallsign()
|
||||||
local Dispatcher = self:GetDispatcher() -- #AI_A2G_DISPATCHER
|
local Dispatcher = self:GetDispatcher() -- #AI_A2G_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", returning to base.", DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", returning to base.", DefenderGroup )
|
||||||
|
|
||||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||||
end
|
end
|
||||||
@ -3745,7 +3770,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local DefenderName = DefenderGroup:GetCallsign()
|
local DefenderName = DefenderGroup:GetCallsign()
|
||||||
local Dispatcher = AI_A2G_Fsm:GetDispatcher() -- #AI_A2G_DISPATCHER
|
local Dispatcher = AI_A2G_Fsm:GetDispatcher() -- #AI_A2G_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", lost control." )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", lost control." )
|
||||||
if DefenderGroup:IsAboveRunway() then
|
if DefenderGroup:IsAboveRunway() then
|
||||||
Dispatcher:RemoveDefenderFromSquadron( Squadron, DefenderGroup )
|
Dispatcher:RemoveDefenderFromSquadron( Squadron, DefenderGroup )
|
||||||
DefenderGroup:Destroy()
|
DefenderGroup:Destroy()
|
||||||
@ -3760,7 +3785,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local DefenderName = DefenderGroup:GetCallsign()
|
local DefenderName = DefenderGroup:GetCallsign()
|
||||||
local Dispatcher = self:GetDispatcher() -- #AI_A2G_DISPATCHER
|
local Dispatcher = self:GetDispatcher() -- #AI_A2G_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", landing at base.", DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", landing at base.", DefenderGroup )
|
||||||
|
|
||||||
if Action and Action == "Destroy" then
|
if Action and Action == "Destroy" then
|
||||||
Dispatcher:RemoveDefenderFromSquadron( Squadron, DefenderGroup )
|
Dispatcher:RemoveDefenderFromSquadron( Squadron, DefenderGroup )
|
||||||
@ -3817,7 +3842,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
self:F( { DefenderTarget = DefenderTarget } )
|
self:F( { DefenderTarget = DefenderTarget } )
|
||||||
|
|
||||||
if DefenderTarget then
|
if DefenderTarget then
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", wheels up.", DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", wheels up.", DefenderGroup )
|
||||||
AI_A2G_Fsm:EngageRoute( DefenderTarget.Set ) -- Engage on the TargetSetUnit
|
AI_A2G_Fsm:EngageRoute( DefenderTarget.Set ) -- Engage on the TargetSetUnit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -3833,7 +3858,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local FirstUnit = AttackSetUnit:GetFirst()
|
local FirstUnit = AttackSetUnit:GetFirst()
|
||||||
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
||||||
|
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", on route to ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", on route to ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
||||||
end
|
end
|
||||||
self:GetParent(self).onafterEngageRoute( self, DefenderGroup, From, Event, To, AttackSetUnit )
|
self:GetParent(self).onafterEngageRoute( self, DefenderGroup, From, Event, To, AttackSetUnit )
|
||||||
end
|
end
|
||||||
@ -3849,7 +3874,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
if FirstUnit then
|
if FirstUnit then
|
||||||
local Coordinate = FirstUnit:GetCoordinate()
|
local Coordinate = FirstUnit:GetCoordinate()
|
||||||
|
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", engaging ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", engaging ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -3859,7 +3884,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local DefenderName = DefenderGroup:GetCallsign()
|
local DefenderName = DefenderGroup:GetCallsign()
|
||||||
local Dispatcher = self:GetDispatcher() -- #AI_A2G_DISPATCHER
|
local Dispatcher = self:GetDispatcher() -- #AI_A2G_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", returning to base.", DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", returning to base.", DefenderGroup )
|
||||||
|
|
||||||
self:GetParent(self).onafterRTB( self, DefenderGroup, From, Event, To )
|
self:GetParent(self).onafterRTB( self, DefenderGroup, From, Event, To )
|
||||||
|
|
||||||
@ -3874,7 +3899,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local DefenderName = DefenderGroup:GetCallsign()
|
local DefenderName = DefenderGroup:GetCallsign()
|
||||||
local Dispatcher = AI_A2G_Fsm:GetDispatcher() -- #AI_A2G_DISPATCHER
|
local Dispatcher = AI_A2G_Fsm:GetDispatcher() -- #AI_A2G_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
--Dispatcher:MessageToPlayers( "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " lost control." )
|
--Dispatcher:MessageToPlayers( Squadron, "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " lost control." )
|
||||||
|
|
||||||
if DefenderGroup:IsAboveRunway() then
|
if DefenderGroup:IsAboveRunway() then
|
||||||
Dispatcher:RemoveDefenderFromSquadron( Squadron, DefenderGroup )
|
Dispatcher:RemoveDefenderFromSquadron( Squadron, DefenderGroup )
|
||||||
@ -3890,7 +3915,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local DefenderName = DefenderGroup:GetCallsign()
|
local DefenderName = DefenderGroup:GetCallsign()
|
||||||
local Dispatcher = self:GetDispatcher() -- #AI_A2G_DISPATCHER
|
local Dispatcher = self:GetDispatcher() -- #AI_A2G_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
Dispatcher:MessageToPlayers( DefenderName .. ", landing at base.", DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", landing at base.", DefenderGroup )
|
||||||
|
|
||||||
if Action and Action == "Destroy" then
|
if Action and Action == "Destroy" then
|
||||||
Dispatcher:RemoveDefenderFromSquadron( Squadron, DefenderGroup )
|
Dispatcher:RemoveDefenderFromSquadron( Squadron, DefenderGroup )
|
||||||
|
|||||||
@ -2502,7 +2502,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
||||||
|
|
||||||
if Squadron then
|
if Squadron then
|
||||||
Dispatcher:MessageToPlayers( "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " airborne." )
|
Dispatcher:MessageToPlayers( Squadron, "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " airborne." )
|
||||||
Fsm:Patrol() -- Engage on the TargetSetUnit
|
Fsm:Patrol() -- Engage on the TargetSetUnit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -2514,7 +2514,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
local DefenderName = Defender:GetName()
|
local DefenderName = Defender:GetName()
|
||||||
local Dispatcher = self:GetDispatcher() -- #AI_AIR_DISPATCHER
|
local Dispatcher = self:GetDispatcher() -- #AI_AIR_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
||||||
Dispatcher:MessageToPlayers( "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " returning." )
|
Dispatcher:MessageToPlayers( Squadron, "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " returning." )
|
||||||
|
|
||||||
Dispatcher:ClearDefenderTaskTarget( Defender )
|
Dispatcher:ClearDefenderTaskTarget( Defender )
|
||||||
end
|
end
|
||||||
@ -2527,7 +2527,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
local DefenderName = Defender:GetName()
|
local DefenderName = Defender:GetName()
|
||||||
local Dispatcher = Fsm:GetDispatcher() -- #AI_AIR_DISPATCHER
|
local Dispatcher = Fsm:GetDispatcher() -- #AI_AIR_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
||||||
Dispatcher:MessageToPlayers( "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " lost control." )
|
Dispatcher:MessageToPlayers( Squadron, "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " lost control." )
|
||||||
if Defender:IsAboveRunway() then
|
if Defender:IsAboveRunway() then
|
||||||
Dispatcher:RemoveDefenderFromSquadron( Squadron, Defender )
|
Dispatcher:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
Defender:Destroy()
|
Defender:Destroy()
|
||||||
@ -2542,7 +2542,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
local DefenderName = Defender:GetName()
|
local DefenderName = Defender:GetName()
|
||||||
local Dispatcher = self:GetDispatcher() -- #AI_AIR_DISPATCHER
|
local Dispatcher = self:GetDispatcher() -- #AI_AIR_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
||||||
Dispatcher:MessageToPlayers( "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " landing." )
|
Dispatcher:MessageToPlayers( Squadron, "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " landing." )
|
||||||
|
|
||||||
if Action and Action == "Destroy" then
|
if Action and Action == "Destroy" then
|
||||||
Dispatcher:RemoveDefenderFromSquadron( Squadron, Defender )
|
Dispatcher:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
@ -2599,7 +2599,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
self:F( { DefenderTarget = DefenderTarget } )
|
self:F( { DefenderTarget = DefenderTarget } )
|
||||||
|
|
||||||
if DefenderTarget then
|
if DefenderTarget then
|
||||||
Dispatcher:MessageToPlayers( "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " airborne." )
|
Dispatcher:MessageToPlayers( Squadron, "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " airborne." )
|
||||||
Fsm:EngageRoute( DefenderTarget.Set ) -- Engage on the TargetSetUnit
|
Fsm:EngageRoute( DefenderTarget.Set ) -- Engage on the TargetSetUnit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -2614,7 +2614,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
local FirstUnit = AttackSetUnit:GetFirst()
|
local FirstUnit = AttackSetUnit:GetFirst()
|
||||||
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
||||||
|
|
||||||
Dispatcher:MessageToPlayers( "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " on route, bearing " .. Coordinate:ToString( Defender ) )
|
Dispatcher:MessageToPlayers( Squadron, "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " on route, bearing " .. Coordinate:ToString( Defender ) )
|
||||||
end
|
end
|
||||||
|
|
||||||
function Fsm:OnAfterEngage( Defender, From, Event, To, AttackSetUnit )
|
function Fsm:OnAfterEngage( Defender, From, Event, To, AttackSetUnit )
|
||||||
@ -2627,7 +2627,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
local FirstUnit = AttackSetUnit:GetFirst()
|
local FirstUnit = AttackSetUnit:GetFirst()
|
||||||
local Coordinate = FirstUnit:GetCoordinate()
|
local Coordinate = FirstUnit:GetCoordinate()
|
||||||
|
|
||||||
Dispatcher:MessageToPlayers( "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " engaging target, bearing " .. Coordinate:ToString( Defender ) )
|
Dispatcher:MessageToPlayers( Squadron, "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " engaging target, bearing " .. Coordinate:ToString( Defender ) )
|
||||||
end
|
end
|
||||||
|
|
||||||
function Fsm:onafterRTB( Defender, From, Event, To )
|
function Fsm:onafterRTB( Defender, From, Event, To )
|
||||||
@ -2636,7 +2636,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
local DefenderName = Defender:GetName()
|
local DefenderName = Defender:GetName()
|
||||||
local Dispatcher = self:GetDispatcher() -- #AI_AIR_DISPATCHER
|
local Dispatcher = self:GetDispatcher() -- #AI_AIR_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
||||||
Dispatcher:MessageToPlayers( "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " RTB." )
|
Dispatcher:MessageToPlayers( Squadron, "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " RTB." )
|
||||||
|
|
||||||
self:GetParent(self).onafterRTB( self, Defender, From, Event, To )
|
self:GetParent(self).onafterRTB( self, Defender, From, Event, To )
|
||||||
|
|
||||||
@ -2651,7 +2651,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
local DefenderName = Defender:GetName()
|
local DefenderName = Defender:GetName()
|
||||||
local Dispatcher = Fsm:GetDispatcher() -- #AI_AIR_DISPATCHER
|
local Dispatcher = Fsm:GetDispatcher() -- #AI_AIR_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
||||||
Dispatcher:MessageToPlayers( "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " lost control." )
|
Dispatcher:MessageToPlayers( Squadron, "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " lost control." )
|
||||||
|
|
||||||
if Defender:IsAboveRunway() then
|
if Defender:IsAboveRunway() then
|
||||||
Dispatcher:RemoveDefenderFromSquadron( Squadron, Defender )
|
Dispatcher:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
@ -2667,7 +2667,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
local DefenderName = Defender:GetName()
|
local DefenderName = Defender:GetName()
|
||||||
local Dispatcher = self:GetDispatcher() -- #AI_AIR_DISPATCHER
|
local Dispatcher = self:GetDispatcher() -- #AI_AIR_DISPATCHER
|
||||||
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
local Squadron = Dispatcher:GetSquadronFromDefender( Defender )
|
||||||
Dispatcher:MessageToPlayers( "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " landing." )
|
Dispatcher:MessageToPlayers( Squadron, "Squadron " .. Squadron.Name .. ", " .. DefenderName .. " landing." )
|
||||||
|
|
||||||
if Action and Action == "Destroy" then
|
if Action and Action == "Destroy" then
|
||||||
Dispatcher:RemoveDefenderFromSquadron( Squadron, Defender )
|
Dispatcher:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
|
|||||||
@ -867,7 +867,7 @@ do -- COORDINATE
|
|||||||
-- @param #number Precision The precision.
|
-- @param #number Precision The precision.
|
||||||
-- @param Core.Settings#SETTINGS Settings
|
-- @param Core.Settings#SETTINGS Settings
|
||||||
-- @return #string The bearing text in degrees.
|
-- @return #string The bearing text in degrees.
|
||||||
function COORDINATE:GetBearingText( AngleRadians, Precision, Settings )
|
function COORDINATE:GetBearingText( AngleRadians, Precision, Settings, Language )
|
||||||
|
|
||||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
|
|
||||||
@ -883,16 +883,25 @@ do -- COORDINATE
|
|||||||
-- @param #number Distance The distance in meters.
|
-- @param #number Distance The distance in meters.
|
||||||
-- @param Core.Settings#SETTINGS Settings
|
-- @param Core.Settings#SETTINGS Settings
|
||||||
-- @return #string The distance text expressed in the units of measurement.
|
-- @return #string The distance text expressed in the units of measurement.
|
||||||
function COORDINATE:GetDistanceText( Distance, Settings )
|
function COORDINATE:GetDistanceText( Distance, Settings, Language )
|
||||||
|
|
||||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
|
local Language = Language or "EN"
|
||||||
|
|
||||||
local DistanceText
|
local DistanceText
|
||||||
|
|
||||||
if Settings:IsMetric() then
|
if Settings:IsMetric() then
|
||||||
|
if Language == "EN" then
|
||||||
DistanceText = " for " .. UTILS.Round( Distance / 1000, 2 ) .. " km"
|
DistanceText = " for " .. UTILS.Round( Distance / 1000, 2 ) .. " km"
|
||||||
|
elseif Language == "RU" then
|
||||||
|
DistanceText = " за " .. UTILS.Round( Distance / 1000, 2 ) .. " километров"
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
if Language == "EN" then
|
||||||
DistanceText = " for " .. UTILS.Round( UTILS.MetersToNM( Distance ), 2 ) .. " miles"
|
DistanceText = " for " .. UTILS.Round( UTILS.MetersToNM( Distance ), 2 ) .. " miles"
|
||||||
|
elseif Language == "RU" then
|
||||||
|
DistanceText = " за " .. UTILS.Round( UTILS.MetersToNM( Distance ), 2 ) .. " миль"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return DistanceText
|
return DistanceText
|
||||||
@ -901,14 +910,24 @@ do -- COORDINATE
|
|||||||
--- Return the altitude text of the COORDINATE.
|
--- Return the altitude text of the COORDINATE.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @return #string Altitude text.
|
-- @return #string Altitude text.
|
||||||
function COORDINATE:GetAltitudeText( Settings )
|
function COORDINATE:GetAltitudeText( Settings, Language )
|
||||||
local Altitude = self.y
|
local Altitude = self.y
|
||||||
local Settings = Settings or _SETTINGS
|
local Settings = Settings or _SETTINGS
|
||||||
|
local Language = Language or "EN"
|
||||||
|
|
||||||
if Altitude ~= 0 then
|
if Altitude ~= 0 then
|
||||||
if Settings:IsMetric() then
|
if Settings:IsMetric() then
|
||||||
|
if Language == "EN" then
|
||||||
return " at " .. UTILS.Round( self.y, -3 ) .. " meters"
|
return " at " .. UTILS.Round( self.y, -3 ) .. " meters"
|
||||||
|
elseif Language == "RU" then
|
||||||
|
return " в " .. UTILS.Round( self.y, -3 ) .. " метры"
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
if Language == "EN" then
|
||||||
return " at " .. UTILS.Round( UTILS.MetersToFeet( self.y ), -3 ) .. " feet"
|
return " at " .. UTILS.Round( UTILS.MetersToFeet( self.y ), -3 ) .. " feet"
|
||||||
|
elseif Language == "RU" then
|
||||||
|
return " в " .. UTILS.Round( self.y, -3 ) .. " ноги"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
@ -954,12 +973,12 @@ do -- COORDINATE
|
|||||||
-- @param #number Distance The distance
|
-- @param #number Distance The distance
|
||||||
-- @param Core.Settings#SETTINGS Settings
|
-- @param Core.Settings#SETTINGS Settings
|
||||||
-- @return #string The BR Text
|
-- @return #string The BR Text
|
||||||
function COORDINATE:GetBRText( AngleRadians, Distance, Settings )
|
function COORDINATE:GetBRText( AngleRadians, Distance, Settings, Language )
|
||||||
|
|
||||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
|
|
||||||
local BearingText = self:GetBearingText( AngleRadians, 0, Settings )
|
local BearingText = self:GetBearingText( AngleRadians, 0, Settings, Language )
|
||||||
local DistanceText = self:GetDistanceText( Distance, Settings )
|
local DistanceText = self:GetDistanceText( Distance, Settings, Language )
|
||||||
|
|
||||||
local BRText = BearingText .. DistanceText
|
local BRText = BearingText .. DistanceText
|
||||||
|
|
||||||
@ -972,13 +991,13 @@ do -- COORDINATE
|
|||||||
-- @param #number Distance The distance
|
-- @param #number Distance The distance
|
||||||
-- @param Core.Settings#SETTINGS Settings
|
-- @param Core.Settings#SETTINGS Settings
|
||||||
-- @return #string The BRA Text
|
-- @return #string The BRA Text
|
||||||
function COORDINATE:GetBRAText( AngleRadians, Distance, Settings )
|
function COORDINATE:GetBRAText( AngleRadians, Distance, Settings, Language )
|
||||||
|
|
||||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
|
|
||||||
local BearingText = self:GetBearingText( AngleRadians, 0, Settings )
|
local BearingText = self:GetBearingText( AngleRadians, 0, Settings, Language )
|
||||||
local DistanceText = self:GetDistanceText( Distance, Settings )
|
local DistanceText = self:GetDistanceText( Distance, Settings, Language )
|
||||||
local AltitudeText = self:GetAltitudeText( Settings )
|
local AltitudeText = self:GetAltitudeText( Settings, Language )
|
||||||
|
|
||||||
local BRAText = BearingText .. DistanceText .. AltitudeText -- When the POINT is a VEC2, there will be no altitude shown.
|
local BRAText = BearingText .. DistanceText .. AltitudeText -- When the POINT is a VEC2, there will be no altitude shown.
|
||||||
|
|
||||||
@ -1867,12 +1886,12 @@ do -- COORDINATE
|
|||||||
-- @param #COORDINATE FromCoordinate The coordinate to measure the distance and the bearing from.
|
-- @param #COORDINATE FromCoordinate The coordinate to measure the distance and the bearing from.
|
||||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
-- @return #string The BR text.
|
-- @return #string The BR text.
|
||||||
function COORDINATE:ToStringBRA( FromCoordinate, Settings )
|
function COORDINATE:ToStringBRA( FromCoordinate, Settings, Language )
|
||||||
local DirectionVec3 = FromCoordinate:GetDirectionVec3( self )
|
local DirectionVec3 = FromCoordinate:GetDirectionVec3( self )
|
||||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||||
local Distance = FromCoordinate:Get2DDistance( self )
|
local Distance = FromCoordinate:Get2DDistance( self )
|
||||||
local Altitude = self:GetAltitudeText()
|
local Altitude = self:GetAltitudeText()
|
||||||
return "BRA, " .. self:GetBRAText( AngleRadians, Distance, Settings )
|
return "BRA, " .. self:GetBRAText( AngleRadians, Distance, Settings, Language )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return a BULLS string out of the BULLS of the coalition to the COORDINATE.
|
--- Return a BULLS string out of the BULLS of the coalition to the COORDINATE.
|
||||||
@ -2023,7 +2042,7 @@ do -- COORDINATE
|
|||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
-- @return #string The coordinate Text in the configured coordinate system.
|
-- @return #string The coordinate Text in the configured coordinate system.
|
||||||
function COORDINATE:ToStringA2A( Controllable, Settings ) -- R2.2
|
function COORDINATE:ToStringA2A( Controllable, Settings, Language ) -- R2.2
|
||||||
|
|
||||||
self:F2( { Controllable = Controllable and Controllable:GetName() } )
|
self:F2( { Controllable = Controllable and Controllable:GetName() } )
|
||||||
|
|
||||||
@ -2032,23 +2051,23 @@ do -- COORDINATE
|
|||||||
if Settings:IsA2A_BRAA() then
|
if Settings:IsA2A_BRAA() then
|
||||||
if Controllable then
|
if Controllable then
|
||||||
local Coordinate = Controllable:GetCoordinate()
|
local Coordinate = Controllable:GetCoordinate()
|
||||||
return self:ToStringBRA( Coordinate, Settings )
|
return self:ToStringBRA( Coordinate, Settings, Language )
|
||||||
else
|
else
|
||||||
return self:ToStringMGRS( Settings )
|
return self:ToStringMGRS( Settings, Language )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Settings:IsA2A_BULLS() then
|
if Settings:IsA2A_BULLS() then
|
||||||
local Coalition = Controllable:GetCoalition()
|
local Coalition = Controllable:GetCoalition()
|
||||||
return self:ToStringBULLS( Coalition, Settings )
|
return self:ToStringBULLS( Coalition, Settings, Language )
|
||||||
end
|
end
|
||||||
if Settings:IsA2A_LL_DMS() then
|
if Settings:IsA2A_LL_DMS() then
|
||||||
return self:ToStringLLDMS( Settings )
|
return self:ToStringLLDMS( Settings, Language )
|
||||||
end
|
end
|
||||||
if Settings:IsA2A_LL_DDM() then
|
if Settings:IsA2A_LL_DDM() then
|
||||||
return self:ToStringLLDDM( Settings )
|
return self:ToStringLLDDM( Settings, Language )
|
||||||
end
|
end
|
||||||
if Settings:IsA2A_MGRS() then
|
if Settings:IsA2A_MGRS() then
|
||||||
return self:ToStringMGRS( Settings )
|
return self:ToStringMGRS( Settings, Language )
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -81,6 +81,7 @@ function RADIOQUEUE:New(frequency, modulation)
|
|||||||
|
|
||||||
-- Scheduler
|
-- Scheduler
|
||||||
self.scheduler=SCHEDULER:New()
|
self.scheduler=SCHEDULER:New()
|
||||||
|
self.scheduler:NoTrace()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
--
|
--
|
||||||
-- ### Authors: FlightControl
|
-- ### Authors: FlightControl
|
||||||
--
|
--
|
||||||
-- @module Core.Speech
|
-- @module Core.RadioSpeech
|
||||||
-- @image Core_Radio.JPG
|
-- @image Core_Radio.JPG
|
||||||
|
|
||||||
--- Makes the radio speak.
|
--- Makes the radio speak.
|
||||||
@ -25,6 +25,8 @@ RADIOSPEECH = {
|
|||||||
ClassName = "RADIOSPEECH",
|
ClassName = "RADIOSPEECH",
|
||||||
Vocabulary = {
|
Vocabulary = {
|
||||||
EN = {},
|
EN = {},
|
||||||
|
DE = {},
|
||||||
|
RU = {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,6 +93,7 @@ RADIOSPEECH.Vocabulary.EN = {
|
|||||||
["miles"] = { "miles", 0.45 },
|
["miles"] = { "miles", 0.45 },
|
||||||
["meters"] = { "meters", 0.41 },
|
["meters"] = { "meters", 0.41 },
|
||||||
["mi"] = { "miles", 0.45 },
|
["mi"] = { "miles", 0.45 },
|
||||||
|
["feet"] = { "feet", 0.29 },
|
||||||
|
|
||||||
["br"] = { "br", 1.1 },
|
["br"] = { "br", 1.1 },
|
||||||
["bra"] = { "bra", 0.3 },
|
["bra"] = { "bra", 0.3 },
|
||||||
@ -112,7 +115,81 @@ RADIOSPEECH.Vocabulary.EN = {
|
|||||||
["defender"] = { "defender", 0.45 },
|
["defender"] = { "defender", 0.45 },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RADIOSPEECH.Vocabulary.RU = {
|
||||||
|
["1"] = { "1", 0.34 },
|
||||||
|
["2"] = { "2", 0.30 },
|
||||||
|
["3"] = { "3", 0.23 },
|
||||||
|
["4"] = { "4", 0.51 },
|
||||||
|
["5"] = { "5", 0.31 },
|
||||||
|
["6"] = { "6", 0.44 },
|
||||||
|
["7"] = { "7", 0.25 },
|
||||||
|
["8"] = { "8", 0.43 },
|
||||||
|
["9"] = { "9", 0.45 },
|
||||||
|
["10"] = { "10", 0.53 },
|
||||||
|
["11"] = { "11", 0.66 },
|
||||||
|
["12"] = { "12", 0.70 },
|
||||||
|
["13"] = { "13", 0.66 },
|
||||||
|
["14"] = { "14", 0.80 },
|
||||||
|
["15"] = { "15", 0.65 },
|
||||||
|
["16"] = { "16", 0.75 },
|
||||||
|
["17"] = { "17", 0.74 },
|
||||||
|
["18"] = { "18", 0.85 },
|
||||||
|
["19"] = { "19", 0.80 },
|
||||||
|
["20"] = { "20", 0.58 },
|
||||||
|
["30"] = { "30", 0.51 },
|
||||||
|
["40"] = { "40", 0.51 },
|
||||||
|
["50"] = { "50", 0.67 },
|
||||||
|
["60"] = { "60", 0.76 },
|
||||||
|
["70"] = { "70", 0.68 },
|
||||||
|
["80"] = { "80", 0.84 },
|
||||||
|
["90"] = { "90", 0.71 },
|
||||||
|
["100"] = { "100", 0.35 },
|
||||||
|
["200"] = { "200", 0.59 },
|
||||||
|
["300"] = { "300", 0.53 },
|
||||||
|
["400"] = { "400", 0.70 },
|
||||||
|
["500"] = { "500", 0.50 },
|
||||||
|
["600"] = { "600", 0.58 },
|
||||||
|
["700"] = { "700", 0.64 },
|
||||||
|
["800"] = { "800", 0.77 },
|
||||||
|
["900"] = { "900", 0.75 },
|
||||||
|
["1000"] = { "1000", 0.87 },
|
||||||
|
["2000"] = { "2000", 0.83 },
|
||||||
|
["3000"] = { "3000", 0.84 },
|
||||||
|
["4000"] = { "4000", 1.00 },
|
||||||
|
["5000"] = { "5000", 0.77 },
|
||||||
|
["6000"] = { "6000", 0.90 },
|
||||||
|
["7000"] = { "7000", 0.77 },
|
||||||
|
["8000"] = { "8000", 0.92 },
|
||||||
|
["9000"] = { "9000", 0.87 },
|
||||||
|
|
||||||
|
["степени"] = { "degrees", 0.5 },
|
||||||
|
["километров"] = { "kilometers", 0.65 },
|
||||||
|
["km"] = { "kilometers", 0.65 },
|
||||||
|
["миль"] = { "miles", 0.45 },
|
||||||
|
["mi"] = { "miles", 0.45 },
|
||||||
|
["метры"] = { "meters", 0.41 },
|
||||||
|
["m"] = { "meters", 0.41 },
|
||||||
|
["ноги"] = { "feet", 0.37 },
|
||||||
|
|
||||||
|
["br"] = { "br", 1.1 },
|
||||||
|
["bra"] = { "bra", 0.3 },
|
||||||
|
|
||||||
|
|
||||||
|
["возвращаясь на базу"] = { "returning_to_base", 1.40 },
|
||||||
|
["на пути к наземной цели"] = { "on_route_to_ground_target", 1.45 },
|
||||||
|
["перехват самолетов"] = { "intercepting_bogeys", 1.22 },
|
||||||
|
["поражение наземной цели"] = { "engaging_ground_target", 1.53 },
|
||||||
|
["захватывающие самолеты"] = { "engaging_bogeys", 1.68 },
|
||||||
|
["колеса вверх"] = { "wheels_up", 0.92 },
|
||||||
|
["посадка на базу"] = { "landing at base", 1.04 },
|
||||||
|
["патрулирующий"] = { "patrolling", 0.96 },
|
||||||
|
|
||||||
|
["за"] = { "for", 0.27 },
|
||||||
|
["и"] = { "and", 0.17 },
|
||||||
|
["в"] = { "at", 0.19 },
|
||||||
|
["dot"] = { "dot", 0.51 },
|
||||||
|
["defender"] = { "defender", 0.45 },
|
||||||
|
}
|
||||||
|
|
||||||
--- Create a new RADIOSPEECH object for a given radio frequency/modulation.
|
--- Create a new RADIOSPEECH object for a given radio frequency/modulation.
|
||||||
-- @param #RADIOSPEECH self
|
-- @param #RADIOSPEECH self
|
||||||
@ -131,6 +208,11 @@ function RADIOSPEECH:New(frequency, modulation)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function RADIOSPEECH:SetLanguage( Langauge )
|
||||||
|
|
||||||
|
self.Language = Langauge
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Add Sentence to the Speech collection.
|
--- Add Sentence to the Speech collection.
|
||||||
-- @param #RADIOSPEECH self
|
-- @param #RADIOSPEECH self
|
||||||
@ -143,7 +225,7 @@ function RADIOSPEECH:AddSentenceToSpeech( RemainingSentence, Speech, Sentence, D
|
|||||||
|
|
||||||
self:I( { RemainingSentence, Speech, Sentence, Data } )
|
self:I( { RemainingSentence, Speech, Sentence, Data } )
|
||||||
|
|
||||||
local Token, RemainingSentence = RemainingSentence:match( "^ *(%w+)(.*)" )
|
local Token, RemainingSentence = RemainingSentence:match( "^ *([^ ]+)(.*)" )
|
||||||
self:I( { Token = Token, RemainingSentence = RemainingSentence } )
|
self:I( { Token = Token, RemainingSentence = RemainingSentence } )
|
||||||
|
|
||||||
-- Is there a Token?
|
-- Is there a Token?
|
||||||
@ -198,13 +280,20 @@ end
|
|||||||
--- Speak a sentence.
|
--- Speak a sentence.
|
||||||
-- @param #RADIOSPEECH self
|
-- @param #RADIOSPEECH self
|
||||||
-- @param #string Sentence The sentence to be spoken.
|
-- @param #string Sentence The sentence to be spoken.
|
||||||
function RADIOSPEECH:SpeakWords( Sentence, Speech )
|
function RADIOSPEECH:SpeakWords( Sentence, Speech, Language )
|
||||||
|
|
||||||
local Word, RemainderSentence = Sentence:match( "^[^%d%a]*(%a*)(.*)" )
|
local OriginalSentence = Sentence
|
||||||
|
|
||||||
|
-- lua does not parse UTF-8, so the match statement will fail on cyrillic using %a.
|
||||||
|
-- therefore, the only way to parse the statement is to use blank, comma or dot as a delimiter.
|
||||||
|
-- and then check if the character can be converted to a number or not.
|
||||||
|
local Word, RemainderSentence = Sentence:match( "^[., ]*([^ .,]+)(.*)" )
|
||||||
|
|
||||||
self:I( { Word = Word, Speech = Speech[Word], RemainderSentence = RemainderSentence } )
|
self:I( { Word = Word, Speech = Speech[Word], RemainderSentence = RemainderSentence } )
|
||||||
|
|
||||||
if Word and Word ~= "" then
|
|
||||||
|
if Word then
|
||||||
|
if Word ~= "" and tonumber(Word) == nil then
|
||||||
|
|
||||||
-- Construct of words
|
-- Construct of words
|
||||||
Word = Word:lower()
|
Word = Word:lower()
|
||||||
@ -212,29 +301,38 @@ function RADIOSPEECH:SpeakWords( Sentence, Speech )
|
|||||||
-- The end of the sentence has been reached. Now Speech.Next should be nil, otherwise there is an error.
|
-- The end of the sentence has been reached. Now Speech.Next should be nil, otherwise there is an error.
|
||||||
if Speech[Word].Next == nil then
|
if Speech[Word].Next == nil then
|
||||||
self:I( { Sentence = Speech[Word].Sentence, Data = Speech[Word].Data } )
|
self:I( { Sentence = Speech[Word].Sentence, Data = Speech[Word].Data } )
|
||||||
self:NewTransmission( Speech[Word].Data[1] .. ".wav", Speech[Word].Data[2], "EN/" )
|
self:NewTransmission( Speech[Word].Data[1] .. ".wav", Speech[Word].Data[2], Language .. "/" )
|
||||||
else
|
else
|
||||||
if RemainderSentence and RemainderSentence ~= "" then
|
if RemainderSentence and RemainderSentence ~= "" then
|
||||||
RemainderSentence = self:SpeakWords( RemainderSentence, Speech[Word].Next )
|
return self:SpeakWords( RemainderSentence, Speech[Word].Next, Language )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
return RemainderSentence
|
return RemainderSentence
|
||||||
|
end
|
||||||
|
return OriginalSentence
|
||||||
|
else
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Speak a sentence.
|
--- Speak a sentence.
|
||||||
-- @param #RADIOSPEECH self
|
-- @param #RADIOSPEECH self
|
||||||
-- @param #string Sentence The sentence to be spoken.
|
-- @param #string Sentence The sentence to be spoken.
|
||||||
function RADIOSPEECH:SpeakDigits( Sentence, Speech )
|
function RADIOSPEECH:SpeakDigits( Sentence, Speech, Langauge )
|
||||||
|
|
||||||
local Digits, RemainderSentence = Sentence:match( "^[^%a%d]*(%d*)(.*)" )
|
local OriginalSentence = Sentence
|
||||||
|
|
||||||
|
-- lua does not parse UTF-8, so the match statement will fail on cyrillic using %a.
|
||||||
|
-- therefore, the only way to parse the statement is to use blank, comma or dot as a delimiter.
|
||||||
|
-- and then check if the character can be converted to a number or not.
|
||||||
|
local Digits, RemainderSentence = Sentence:match( "^[., ]*([^ .,]+)(.*)" )
|
||||||
|
|
||||||
self:I( { Digits = Digits, Speech = Speech[Digits], RemainderSentence = RemainderSentence } )
|
self:I( { Digits = Digits, Speech = Speech[Digits], RemainderSentence = RemainderSentence } )
|
||||||
|
|
||||||
if Digits and Digits ~= "" then
|
if Digits then
|
||||||
|
if Digits ~= "" and tonumber( Digits ) ~= nil then
|
||||||
|
|
||||||
-- Construct numbers
|
-- Construct numbers
|
||||||
local Number = tonumber( Digits )
|
local Number = tonumber( Digits )
|
||||||
@ -252,68 +350,47 @@ function RADIOSPEECH:SpeakDigits( Sentence, Speech )
|
|||||||
Sentence = tostring( Multiple )
|
Sentence = tostring( Multiple )
|
||||||
if Speech[Sentence] then
|
if Speech[Sentence] then
|
||||||
self:I( { Speech = Speech[Sentence].Sentence, Data = Speech[Sentence].Data } )
|
self:I( { Speech = Speech[Sentence].Sentence, Data = Speech[Sentence].Data } )
|
||||||
self:NewTransmission( Speech[Sentence].Data[1] .. ".wav", Speech[Sentence].Data[2], "EN/" )
|
self:NewTransmission( Speech[Sentence].Data[1] .. ".wav", Speech[Sentence].Data[2], Langauge .. "/" )
|
||||||
end
|
end
|
||||||
Number = Number - Multiple
|
Number = Number - Multiple
|
||||||
Number = ( Number == 0 ) and -1 or Number
|
Number = ( Number == 0 ) and -1 or Number
|
||||||
end
|
end
|
||||||
|
return RemainderSentence
|
||||||
|
end
|
||||||
|
return OriginalSentence
|
||||||
|
else
|
||||||
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
return RemainderSentence
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Speak a sentence.
|
--- Speak a sentence.
|
||||||
-- @param #RADIOSPEECH self
|
-- @param #RADIOSPEECH self
|
||||||
-- @param #string Sentence The sentence to be spoken.
|
-- @param #string Sentence The sentence to be spoken.
|
||||||
function RADIOSPEECH:SpeakSymbols( Sentence, Speech )
|
function RADIOSPEECH:Speak( Sentence, Language )
|
||||||
|
|
||||||
local Symbol, RemainderSentence = Sentence:match( "^[^%a%d]*(°*)(.*)" )
|
self:I( { Sentence, Language } )
|
||||||
|
|
||||||
self:I( { Sentence = Sentence, Symbol = Symbol, Speech = Speech[Symbol], RemainderSentence = RemainderSentence } )
|
local Language = Language or "EN"
|
||||||
|
|
||||||
if Symbol and Symbol ~= "" then
|
self:I( { Language = Language } )
|
||||||
local Word = nil
|
|
||||||
if Symbol == "°" then
|
|
||||||
Word = "degrees"
|
|
||||||
end
|
|
||||||
if Word then
|
|
||||||
if Speech[Word] then
|
|
||||||
self:I( { Speech = Speech[Word].Sentence, Data = Speech[Word].Data } )
|
|
||||||
self:NewTransmission( Speech[Word].Data[1] .. ".wav", Speech[Word].Data[2], "EN/" )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return RemainderSentence
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--- Speak a sentence.
|
|
||||||
-- @param #RADIOSPEECH self
|
|
||||||
-- @param #string Sentence The sentence to be spoken.
|
|
||||||
function RADIOSPEECH:Speak( Sentence, Speech )
|
|
||||||
|
|
||||||
self:I( { Sentence, Speech } )
|
|
||||||
|
|
||||||
local Language = self.Language
|
|
||||||
|
|
||||||
-- If there is no node for Speech, then we start at the first nodes of the language.
|
-- If there is no node for Speech, then we start at the first nodes of the language.
|
||||||
if not Speech then
|
local Speech = self.Speech[Language]
|
||||||
Speech = self.Speech[Language]
|
|
||||||
end
|
|
||||||
|
|
||||||
self:I( { Speech = Speech, Language = Language } )
|
self:I( { Speech = Speech, Language = Language } )
|
||||||
|
|
||||||
self:NewTransmission( "_In.wav", 0.52, "EN/" )
|
self:NewTransmission( "_In.wav", 0.52, Language .. "/" )
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
|
|
||||||
Sentence = self:SpeakWords( Sentence, Speech )
|
Sentence = self:SpeakWords( Sentence, Speech, Language )
|
||||||
|
|
||||||
self:I( { Sentence = Sentence } )
|
self:I( { Sentence = Sentence } )
|
||||||
|
|
||||||
Sentence = self:SpeakDigits( Sentence, Speech )
|
Sentence = self:SpeakDigits( Sentence, Speech, Language )
|
||||||
|
|
||||||
self:I( { Sentence = Sentence } )
|
self:I( { Sentence = Sentence } )
|
||||||
|
|
||||||
@ -323,6 +400,6 @@ function RADIOSPEECH:Speak( Sentence, Speech )
|
|||||||
|
|
||||||
until not Sentence or Sentence == ""
|
until not Sentence or Sentence == ""
|
||||||
|
|
||||||
self:NewTransmission( "_Out.wav", 0.28, "EN/" )
|
self:NewTransmission( "_Out.wav", 0.28, Language .. "/" )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -162,6 +162,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
|
|||||||
local Randomize = Schedule.Randomize or 0
|
local Randomize = Schedule.Randomize or 0
|
||||||
local Stop = Schedule.Stop or 0
|
local Stop = Schedule.Stop or 0
|
||||||
local ScheduleID = Schedule.ScheduleID
|
local ScheduleID = Schedule.ScheduleID
|
||||||
|
local ShowTrace = Scheduler.ShowTrace
|
||||||
|
|
||||||
local Prefix = ( Repeat == 0 ) and "--->" or "+++>"
|
local Prefix = ( Repeat == 0 ) and "--->" or "+++>"
|
||||||
|
|
||||||
@ -169,13 +170,17 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
|
|||||||
--self:E( { SchedulerObject = SchedulerObject } )
|
--self:E( { SchedulerObject = SchedulerObject } )
|
||||||
if SchedulerObject then
|
if SchedulerObject then
|
||||||
local function Timer()
|
local function Timer()
|
||||||
|
if ShowTrace then
|
||||||
SchedulerObject:T( Prefix .. Name .. ":" .. Line .. " (" .. Source .. ")" )
|
SchedulerObject:T( Prefix .. Name .. ":" .. Line .. " (" .. Source .. ")" )
|
||||||
|
end
|
||||||
return ScheduleFunction( SchedulerObject, unpack( ScheduleArguments ) )
|
return ScheduleFunction( SchedulerObject, unpack( ScheduleArguments ) )
|
||||||
end
|
end
|
||||||
Status, Result = xpcall( Timer, ErrorHandler )
|
Status, Result = xpcall( Timer, ErrorHandler )
|
||||||
else
|
else
|
||||||
local function Timer()
|
local function Timer()
|
||||||
|
if ShowTrace then
|
||||||
self:T( Prefix .. Name .. ":" .. Line .. " (" .. Source .. ")" )
|
self:T( Prefix .. Name .. ":" .. Line .. " (" .. Source .. ")" )
|
||||||
|
end
|
||||||
return ScheduleFunction( unpack( ScheduleArguments ) )
|
return ScheduleFunction( unpack( ScheduleArguments ) )
|
||||||
end
|
end
|
||||||
Status, Result = xpcall( Timer, ErrorHandler )
|
Status, Result = xpcall( Timer, ErrorHandler )
|
||||||
@ -274,5 +279,9 @@ function SCHEDULEDISPATCHER:Clear( Scheduler )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function SCHEDULEDISPATCHER:NoTrace( Scheduler )
|
||||||
|
self:F2( { Scheduler = Scheduler } )
|
||||||
|
|
||||||
|
Scheduler.ShowTrace = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|||||||
@ -301,6 +301,14 @@ function SCHEDULER:Clear()
|
|||||||
_SCHEDULEDISPATCHER:Clear( self )
|
_SCHEDULEDISPATCHER:Clear( self )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- No tracing for this scheduler.
|
||||||
|
-- @param #SCHEDULER self
|
||||||
|
-- @param #number ScheduleID (optional) The ScheduleID of the planned (repeating) schedule.
|
||||||
|
function SCHEDULER:NoTrace()
|
||||||
|
|
||||||
|
_SCHEDULEDISPATCHER:NoTrace( self )
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -261,37 +261,17 @@ do -- DETECTION MANAGER
|
|||||||
return self.CC
|
return self.CC
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set the frequency of communication and the mode of communication for voice overs.
|
|
||||||
-- @param #DETECTION_MANAGER self
|
|
||||||
-- @param #number RadioFrequency The frequency of communication.
|
|
||||||
-- @param #number RadioModulation The modulation of communication.
|
|
||||||
-- @param #number RadioPower The power in Watts of communication.
|
|
||||||
function DETECTION_MANAGER:SetRadioFrequency( RadioFrequency, RadioModulation, RadioPower )
|
|
||||||
|
|
||||||
self.RadioFrequency = RadioFrequency
|
|
||||||
self.RadioModulation = RadioModulation or radio.modulation.AM
|
|
||||||
self.RadioPower = RadioPower or 100
|
|
||||||
|
|
||||||
if self.RadioQueue then
|
|
||||||
self.RadioQueue:Stop()
|
|
||||||
end
|
|
||||||
|
|
||||||
self.RadioQueue = nil
|
|
||||||
|
|
||||||
self.RadioQueue = RADIOSPEECH:New( self.RadioFrequency, self.RadioModulation )
|
|
||||||
self.RadioQueue.power = self.RadioPower
|
|
||||||
self.RadioQueue:Start( 0.5 )
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Send an information message to the players reporting to the command center.
|
--- Send an information message to the players reporting to the command center.
|
||||||
-- @param #DETECTION_MANAGER self
|
-- @param #DETECTION_MANAGER self
|
||||||
|
-- @param #table Squadron The squadron table.
|
||||||
-- @param #string Message The message to be sent.
|
-- @param #string Message The message to be sent.
|
||||||
-- @param #string SoundFile The name of the sound file .wav or .ogg.
|
-- @param #string SoundFile The name of the sound file .wav or .ogg.
|
||||||
-- @param #number SoundDuration The duration of the sound.
|
-- @param #number SoundDuration The duration of the sound.
|
||||||
-- @param #string SoundPath The path pointing to the folder in the mission file.
|
-- @param #string SoundPath The path pointing to the folder in the mission file.
|
||||||
-- @param Wrapper.Group#GROUP DefenderGroup The defender group sending the message.
|
-- @param Wrapper.Group#GROUP DefenderGroup The defender group sending the message.
|
||||||
-- @return #DETECTION_MANGER self
|
-- @return #DETECTION_MANGER self
|
||||||
function DETECTION_MANAGER:MessageToPlayers( Message, DefenderGroup )
|
function DETECTION_MANAGER:MessageToPlayers( Squadron, Message, DefenderGroup )
|
||||||
|
|
||||||
self:F( { Message = Message } )
|
self:F( { Message = Message } )
|
||||||
|
|
||||||
@ -306,18 +286,18 @@ do -- DETECTION MANAGER
|
|||||||
self.CC:MessageToCoalition( Message )
|
self.CC:MessageToCoalition( Message )
|
||||||
end
|
end
|
||||||
|
|
||||||
Message = Message:gsub( "°", "degrees" )
|
Message = Message:gsub( "°", " degrees " )
|
||||||
Message = Message:gsub( "(%d)%.(%d)", "%1dot%2" )
|
Message = Message:gsub( "(%d)%.(%d)", "%1 dot %2" )
|
||||||
|
|
||||||
-- Here we handle the transmission of the voice over.
|
-- Here we handle the transmission of the voice over.
|
||||||
-- If for a certain reason the Defender does not exist, we use the coordinate of the airbase to send the message from.
|
-- If for a certain reason the Defender does not exist, we use the coordinate of the airbase to send the message from.
|
||||||
local RadioQueue = self.RadioQueue -- Core.RadioQueue#RADIOQUEUE
|
local RadioQueue = Squadron.RadioQueue -- Core.RadioSpeech#RADIOSPEECH
|
||||||
if RadioQueue then
|
if RadioQueue then
|
||||||
local DefenderUnit = DefenderGroup:GetUnit(1)
|
local DefenderUnit = DefenderGroup:GetUnit(1)
|
||||||
if DefenderUnit and DefenderUnit:IsAlive() then
|
if DefenderUnit and DefenderUnit:IsAlive() then
|
||||||
RadioQueue:SetSenderUnitName( DefenderUnit:GetName() )
|
RadioQueue:SetSenderUnitName( DefenderUnit:GetName() )
|
||||||
end
|
end
|
||||||
RadioQueue:Speak( Message )
|
RadioQueue:Speak( Message, Squadron.Language )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|||||||
@ -143,6 +143,7 @@ function CLIENT:Register( ClientName )
|
|||||||
|
|
||||||
--self.AliveCheckScheduler = routines.scheduleFunction( self._AliveCheckScheduler, { self }, timer.getTime() + 1, 5 )
|
--self.AliveCheckScheduler = routines.scheduleFunction( self._AliveCheckScheduler, { self }, timer.getTime() + 1, 5 )
|
||||||
self.AliveCheckScheduler = SCHEDULER:New( self, self._AliveCheckScheduler, { "Client Alive " .. ClientName }, 1, 5, 0.5 )
|
self.AliveCheckScheduler = SCHEDULER:New( self, self._AliveCheckScheduler, { "Client Alive " .. ClientName }, 1, 5, 0.5 )
|
||||||
|
self.AliveCheckScheduler:NoTrace()
|
||||||
|
|
||||||
self:F( self )
|
self:F( self )
|
||||||
return self
|
return self
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user