Add RADIO:StopBroadcast()

This commit is contained in:
Grey-Echo 2017-03-22 10:17:53 +01:00
parent 79518ed926
commit 24a166826a

View File

@ -289,7 +289,7 @@ end
-- -- If your POSITIONABLE is not a UNIT or a GROUP, the Subtitle, SubtitleDuration and Loop are ignored
function RADIO:Broadcast()
self:F()
-- If the POSITIONABLE is actually a Unit or a Group, use the more complicated DCS command system
-- If the POSITIONABLE is actually a UNIT or a GROUP, use the more complicated DCS command system
if self.Positionable.ClassName == "UNIT" or self.Positionable.ClassName == "GROUP" then
self:T2("Broadcasting from a UNIT or a GROUP")
self.Positionable:GetDCSObject():getController():setCommand({
@ -309,3 +309,22 @@ function RADIO:Broadcast()
return self
end
--- Stops a transmission
-- @param #RADIO self
-- @return #RADIO self
-- @usage
-- -- Especially usefull to stop the broadcast of looped transmissions
-- -- Only works with broadcasts from UNIT or GROUP
function RADIO:StopBroadcast()
self:F()
-- If the POSITIONABLE is a UNIT or a GROUP, stop the transmission with the DCS "StopTransmission" command
if self.Positionable.ClassName == "UNIT" or self.Positionable.ClassName == "GROUP" then
self.Positionable:GetDCSObject():getController():setCommand({
id = "StopTransmission",
params = {}
})
else
self:E("This broadcast can't be stopped. It's not looped either, so please wait for the end of the sound file playback")
end
return self
end