From 24a166826a02645eac8e0c21687329b96fb05e22 Mon Sep 17 00:00:00 2001 From: Grey-Echo Date: Wed, 22 Mar 2017 10:17:53 +0100 Subject: [PATCH] Add RADIO:StopBroadcast() --- Moose Development/Moose/Core/Radio.lua | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Core/Radio.lua b/Moose Development/Moose/Core/Radio.lua index 88863ad86..8bc26a11a 100644 --- a/Moose Development/Moose/Core/Radio.lua +++ b/Moose Development/Moose/Core/Radio.lua @@ -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 \ No newline at end of file