From 510ff2f32f0dd1961b4fb249c28fb7620efb0eed Mon Sep 17 00:00:00 2001 From: Grey-Echo Date: Thu, 20 Apr 2017 00:19:52 +0200 Subject: [PATCH] Implement BEACON:StopRadioBeacon --- Moose Development/Moose/Core/Radio.lua | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Core/Radio.lua b/Moose Development/Moose/Core/Radio.lua index 69577cae3..6c95fcdc2 100644 --- a/Moose Development/Moose/Core/Radio.lua +++ b/Moose Development/Moose/Core/Radio.lua @@ -458,7 +458,7 @@ function BEACON:AATACAN(TACANChannel, Message, Bearing, BeaconDuration) return self end ---- Stops the BEACON +--- Stops the AA TACAN BEACON -- @param #BEACON self -- @return #BEACON self function BEACON:StopAATACAN() @@ -530,6 +530,22 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati if IsValid then self:T2({"Activating Beacon on ", Frequency, Modulation}) - trigger.action.radioTransmission(FileName, self.Positionable:GetPositionVec3(), Modulation, true, Frequency, Power) - end + -- Note that this is looped. I have to give this transmission a unique name, I use the class ID + trigger.action.radioTransmission(FileName, self.Positionable:GetPositionVec3(), Modulation, true, Frequency, Power, tostring(self.ID)) + + if BeaconDuration then -- Schedule the stop of the BEACON if asked by the MD + SCHEDULER:New( nil, + function() + self:StopRadioBeacon() + end, {}, BeaconDuration) + end + end end + +--- Stops the AA TACAN BEACON +-- @param #BEACON self +-- @return #BEACON self +function BEACON:StopRadioBeacon() + -- The unique name of the transmission is the class ID + trigger.action.stopRadioTransmission(tostring(self.ID)) +end \ No newline at end of file