mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Radio Queue
This commit is contained in:
@@ -254,11 +254,46 @@ do -- DETECTION MANAGER
|
||||
end
|
||||
|
||||
|
||||
--- Get the command center to communicate actions to the players.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
-- @return Tasking.CommandCenter#COMMANDCENTER The command center.
|
||||
function DETECTION_MANAGER:GetCommandCenter()
|
||||
|
||||
return self.CC
|
||||
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 = RADIOQUEUE: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.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
-- @param #string Message The message to be sent.
|
||||
-- @param #string SoundFile The name of the sound file .wav or .ogg.
|
||||
-- @param #number SoundDuration The duration of the sound.
|
||||
-- @param #string SoundPath The path pointing to the folder in the mission file.
|
||||
-- @param #table Squadron The squadron.
|
||||
-- @param Wrapper.Unit#UNIT Defender The defender sending the message.
|
||||
-- @return #DETECTION_MANGER self
|
||||
function DETECTION_MANAGER:MessageToPlayers( Message )
|
||||
function DETECTION_MANAGER:MessageToPlayers( Message, SoundFile, SoundDuration, SoundPath, Squadron, Defender )
|
||||
|
||||
self:F( { Message = Message } )
|
||||
|
||||
@@ -269,6 +304,19 @@ do -- DETECTION MANAGER
|
||||
end
|
||||
end
|
||||
|
||||
-- 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 SoundFile then
|
||||
local RadioQueue = self.RadioQueue -- Core.RadioQueue#RADIOQUEUE
|
||||
if Defender and Defender:IsAlive() then
|
||||
RadioQueue:SetSenderUnitName( Defender:GetName() )
|
||||
else
|
||||
-- Use the airbase of the squadron as the coordinate of send.
|
||||
RadioQueue:SetSenderCoordinate( Squadron.Airbase:GetCoordinate() )
|
||||
end
|
||||
RadioQueue:NewTransmission( SoundFile, SoundDuration, SoundPath )
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user