From ba1575d6740095aa28bea43b169e5d505b53ebad Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 23 Apr 2026 12:41:01 +0200 Subject: [PATCH] #MSRS - Added Hound Jammer option functionality --- Moose Development/Moose/Functional/Mantis.lua | 2 +- Moose Development/Moose/Sound/SRS.lua | 67 ++++++++++++++++++- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Functional/Mantis.lua b/Moose Development/Moose/Functional/Mantis.lua index 90ea8d843..b2a370ed8 100644 --- a/Moose Development/Moose/Functional/Mantis.lua +++ b/Moose Development/Moose/Functional/Mantis.lua @@ -376,7 +376,7 @@ MANTIS.radiusscale[MANTIS.SamType.POINT] = 3 -- @field #string Point Point defense capable -- @field ARMCapacit ARMCapacity ie how many (H)ARMs the system can defend at the same time MANTIS.SamData = { - ["Hawk"] = { Range=35, Blindspot=0, Height=12, Type="Medium", Radar="Hawk" }, -- measures in km + ["Hawk"] = { Range=45, Blindspot=0, Height=12, Type="Medium", Radar="Hawk" }, -- measures in km ["NASAMS"] = { Range=14, Blindspot=0, Height=7, Type="Short", Radar="NSAMS", ARMCapacity=1 }, -- AIM 120B ["Patriot"] = { Range=99, Blindspot=0, Height=25, Type="Long", Radar="Patriot str" }, ["Rapier"] = { Range=10, Blindspot=0, Height=3, Type="Short", Radar="rapier" }, diff --git a/Moose Development/Moose/Sound/SRS.lua b/Moose Development/Moose/Sound/SRS.lua index df01cdb39..d048bc844 100644 --- a/Moose Development/Moose/Sound/SRS.lua +++ b/Moose Development/Moose/Sound/SRS.lua @@ -284,7 +284,7 @@ MSRS = { --- MSRS class version. -- @field #string version -MSRS.version="0.3.6" +MSRS.version="0.3.7" --- Voices -- @type MSRS.Voices @@ -2270,6 +2270,71 @@ function MSRS._HoundTranslate(Message,Parameters,CallbackFunction) return end +--- Create and run a radio jammer for a number of seconds on given frequencies. Requires HOUND backend v0.2.0-beta5 or better. +-- @param #MSRS self +-- @param #table Frequencies The table of frequencies to use. +-- @param #table Modulations The table of modulations to use. +-- @param #number Coalition (Optional) The coalition to use. Defaults to previously set coalition on this instance. +-- @param #string Noisetype (Optional) One of "white" (default) | "chirp" | "harsh" | "jam". +-- @param #number Volume (Optional) Volume 0.0–1.0 (default 1.0). +-- @param #number Seconds (Optional) How long in seconds this jammer runs. Defaults to 30 seconds. +-- @param #string Label (Optional) The label to use, defaults to "MSRS". +-- @param DCS#Vec3 Vec3 (Optional) Vec3 of the sender's position. +-- @param #boolean Encrypt (Optional) If true, use the SRS encrypt option. +-- @param #number EncKey (Optional) If encrypt is true, use this encrypt key. +-- @return #number ID The Jammer ID to switch the jamming off again with `MSRS.RadioJammerOff()` +function MSRS:RadioJammerOn(Frequencies, Modulations, Coalition, Noisetype, Volume, Seconds, Label, Vec3, Encrypt, EncKey) + self:T(self.lid.."RadioJammerOn") + + Frequencies = UTILS.EnsureTable(Frequencies) + Modulations = UTILS.EnsureTable(Modulations) + + local ffs = {} + for _,_f in pairs(Frequencies or self.frequencies) do + table.insert(ffs,string.format("%.1f",_f)) + end + + local freqs = table.concat(ffs, ",") + local modus = table.concat(Modulations or self.modulations, ",") + -- Replace modulation + modus=modus:gsub("0", "AM") + modus=modus:gsub("1", "FM") + + local coal=Coalition or self.coalition or coalition.side.RED + local secs = Seconds or 30 + + local TransmissionP = {} + local ProviderP = {} + + TransmissionP.transmitter = "srs" + TransmissionP.freqs = freqs + TransmissionP.modulations = modus + TransmissionP.coalition = coal or self.coalition -- number 0=spectator, 1=red, 2=blue + TransmissionP.name = Label or self.Label -- string client name shown in SRS + TransmissionP.point = Vec3 -- DCS Vec3 (optional) — initial transmitter position + TransmissionP.encrypt = Encrypt -- bool + TransmissionP.encKey = EncKey -- number 0–255 + + ProviderP.noiseType = Noisetype or "white" + ProviderP.volume = Volume or 1 + + local ID = HoundTTS.TransmitNoise(TransmissionP, ProviderP) + + self.NoiseID = ID + + self:ScheduleOnce(secs,MSRS.RadioJammerOff,self,ID) + + return ID + +end + +--- Switch off a running Jammer using its ID. +-- @param #MSRS self +-- @param #number ID +function MSRS:RadioJammerOff(ID) + return HoundTTS.KillSession(ID or self.NoiseID) +end + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Config File -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------