#SRS - Improvements, set also a coordinate

This commit is contained in:
Applevangelist 2023-11-03 13:38:37 +01:00
parent e560c3ffdd
commit 5a583671a7
4 changed files with 104 additions and 49 deletions

View File

@ -1746,7 +1746,7 @@ AIRBOSS.MenuF10Root = nil
--- Airboss class version. --- Airboss class version.
-- @field #string version -- @field #string version
AIRBOSS.version = "1.3.2" AIRBOSS.version = "1.3.3"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list -- TODO list
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -3071,6 +3071,7 @@ function AIRBOSS:EnableSRS(PathToSRS,Port,Culture,Gender,Voice,GoogleCreds,Volum
self.SRS:SetPath(PathToSRS) self.SRS:SetPath(PathToSRS)
self.SRS:SetPort(Port or 5002) self.SRS:SetPort(Port or 5002)
self.SRS:SetLabel(self.AirbossRadio.alias or "AIRBOSS") self.SRS:SetLabel(self.AirbossRadio.alias or "AIRBOSS")
self.SRS:SetCoordinate(self.carrier:GetCoordinate())
--self.SRS:SetModulations(Modulations) --self.SRS:SetModulations(Modulations)
if GoogleCreds then if GoogleCreds then
self.SRS:SetGoogle(GoogleCreds) self.SRS:SetGoogle(GoogleCreds)
@ -10266,7 +10267,7 @@ function AIRBOSS:_GetSternCoord()
elseif case==2 or case==1 then elseif case==2 or case==1 then
-- V/Stol: Translate 8 meters port. -- V/Stol: Translate 8 meters port.
self.sterncoord:Translate(self.carrierparam.sterndist, hdg, true, true):Translate(8, FB-90, true, true) self.sterncoord:Translate(self.carrierparam.sterndist, hdg, true, true):Translate(8, FB-90, true, true)
end end
elseif self.carriertype==AIRBOSS.CarrierType.STENNIS then elseif self.carriertype==AIRBOSS.CarrierType.STENNIS then
-- Stennis: translate 7 meters starboard wrt Final bearing. -- Stennis: translate 7 meters starboard wrt Final bearing.
self.sterncoord:Translate( self.carrierparam.sterndist, hdg, true, true ):Translate( 7, FB + 90, true, true ) self.sterncoord:Translate( self.carrierparam.sterndist, hdg, true, true ):Translate( 7, FB + 90, true, true )
@ -14885,10 +14886,6 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
-- SRS transmission -- SRS transmission
if call.subtitle ~= nil and string.len(call.subtitle) > 1 then if call.subtitle ~= nil and string.len(call.subtitle) > 1 then
else
-- SRS transmission
local frequency = self.MarshalRadio.frequency local frequency = self.MarshalRadio.frequency
local modulation = self.MarshalRadio.modulation local modulation = self.MarshalRadio.modulation
local voice = nil local voice = nil
@ -14939,9 +14936,9 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
--local text = tostring(call.modexreceiver).."; "..radio.alias.."; "..call.subtitle --local text = tostring(call.modexreceiver).."; "..radio.alias.."; "..call.subtitle
local text = call.subtitle local text = call.subtitle
self:I(self.lid..text) self:T(self.lid..text)
local srstext = self:_GetNiceSRSText(text) local srstext = self:_GetNiceSRSText(text)
self.SRSQ:NewTransmission(srstext, call.duration, self.SRS, tstart, 0.1, subgroups, call.subtitle, call.subduration, frequency, modulation, gender, culture, voice, volume, radio.alias) self.SRSQ:NewTransmission(srstext, call.duration, self.SRS, nil, 0.1, nil, call.subtitle, call.subduration, frequency, modulation, gender, culture, voice, volume, radio.alias)
end end
end end
end end
@ -15254,7 +15251,7 @@ end
-- @param #boolean clear If true, clear screen from previous messages. -- @param #boolean clear If true, clear screen from previous messages.
-- @param #number delay Delay in seconds, before the message is displayed. -- @param #number delay Delay in seconds, before the message is displayed.
function AIRBOSS:MessageToPlayer( playerData, message, sender, receiver, duration, clear, delay ) function AIRBOSS:MessageToPlayer( playerData, message, sender, receiver, duration, clear, delay )
self:I({sender,receiver,message}) self:T({sender,receiver,message})
if playerData and message and message ~= "" then if playerData and message and message ~= "" then
-- Default duration. -- Default duration.
@ -15357,10 +15354,10 @@ function AIRBOSS:MessageToPlayer( playerData, message, sender, receiver, duratio
--sender = "AIRBOSS" --sender = "AIRBOSS"
end end
self:I(self.lid..text) self:T(self.lid..text)
self:I({sender,frequency,modulation,voice}) self:T({sender,frequency,modulation,voice})
local srstext = self:_GetNiceSRSText(text) local srstext = self:_GetNiceSRSText(text)
self.SRSQ:NewTransmission(srstext,duration,self.SRS,tstart,0.1,subgroups,subtitle,subduration,frequency,modulation,gender,culture,voice,volume,sender) self.SRSQ:NewTransmission(srstext,duration,self.SRS,nil,0.1,nil,nil,nil,frequency,modulation,gender,culture,voice,nil,sender)
end end
-- Text message to player client. -- Text message to player client.
if playerData.client then if playerData.client then

View File

@ -507,7 +507,7 @@ do
-- @field #AWACS -- @field #AWACS
AWACS = { AWACS = {
ClassName = "AWACS", -- #string ClassName = "AWACS", -- #string
version = "0.2.57", -- #string version = "0.2.58", -- #string
lid = "", -- #string lid = "", -- #string
coalition = coalition.side.BLUE, -- #number coalition = coalition.side.BLUE, -- #number
coalitiontxt = "blue", -- #string coalitiontxt = "blue", -- #string
@ -971,6 +971,7 @@ AWACS.TaskStatus = {
-- DONE - (WIP) Reporting -- DONE - (WIP) Reporting
-- DONE - Do not report non-airborne groups -- DONE - Do not report non-airborne groups
-- DONE - Added option for helos -- DONE - Added option for helos
-- DONE - Added setting a coordinate for SRS
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor -- Constructor
@ -6191,6 +6192,16 @@ function AWACS:onafterStatus(From, Event, To)
-- Check on AUFTRAG status for CAP AI -- Check on AUFTRAG status for CAP AI
if self:Is("Running") and (awacsalive or self.AwacsInZone) then if self:Is("Running") and (awacsalive or self.AwacsInZone) then
-- update coord for SRS
if self.AwacsSRS then
self.AwacsSRS:SetCoordinate(self.AwacsFG:GetCoordinate())
if self.TacticalSRS then
self.TacticalSRS:SetCoordinate(self.AwacsFG:GetCoordinate())
end
end
self:_CheckAICAPOnStation() self:_CheckAICAPOnStation()
self:_CleanUpContacts() self:_CleanUpContacts()

View File

@ -104,7 +104,7 @@ PLAYERRECCE = {
ClassName = "PLAYERRECCE", ClassName = "PLAYERRECCE",
verbose = true, verbose = true,
lid = nil, lid = nil,
version = "0.0.18", version = "0.0.19",
ViewZone = {}, ViewZone = {},
ViewZoneVisual = {}, ViewZoneVisual = {},
ViewZoneLaser = {}, ViewZoneLaser = {},
@ -1524,8 +1524,12 @@ function PLAYERRECCE:onafterRecceOnStation(From, Event, To, Client, Playername)
end end
if self.UseSRS then if self.UseSRS then
local grp = Client:GetGroup() local grp = Client:GetGroup()
local coord = grp:GetCoordinate()
if coord then
self.SRS:SetCoordinate(coord)
end
self.SRSQueue:NewTransmission(text1,nil,self.SRS,nil,2) self.SRSQueue:NewTransmission(text1,nil,self.SRS,nil,2)
self.SRSQueue:NewTransmission(text2tts,nil,self.SRS,nil,2) self.SRSQueue:NewTransmission(text2tts,nil,self.SRS,nil,3)
MESSAGE:New(text2,10,self.Name or "FACA"):ToCoalition(self.Coalition) MESSAGE:New(text2,10,self.Name or "FACA"):ToCoalition(self.Coalition)
else else
MESSAGE:New(text1,10,self.Name or "FACA"):ToClient(Client) MESSAGE:New(text1,10,self.Name or "FACA"):ToClient(Client)
@ -1560,8 +1564,12 @@ function PLAYERRECCE:onafterRecceOffStation(From, Event, To, Client, Playername)
local text1 = "Going home!" local text1 = "Going home!"
if self.UseSRS then if self.UseSRS then
local grp = Client:GetGroup() local grp = Client:GetGroup()
local coord = grp:GetCoordinate()
if coord then
self.SRS:SetCoordinate(coord)
end
self.SRSQueue:NewTransmission(text1,nil,self.SRS,nil,2) self.SRSQueue:NewTransmission(text1,nil,self.SRS,nil,2)
self.SRSQueue:NewTransmission(texttts,nil,self.SRS,nil,2) self.SRSQueue:NewTransmission(texttts,nil,self.SRS,nil,3)
MESSAGE:New(text,10,self.Name or "FACA"):ToCoalition(self.Coalition) MESSAGE:New(text,10,self.Name or "FACA"):ToCoalition(self.Coalition)
else else
MESSAGE:New(text,10,self.Name or "FACA"):ToCoalition(self.Coalition) MESSAGE:New(text,10,self.Name or "FACA"):ToCoalition(self.Coalition)
@ -1617,6 +1625,9 @@ function PLAYERRECCE:onafterTargetDetected(From, Event, To, Targetsbyclock, Clie
local ttstext = string.format("Target! %s! %s oh clock, %d %s!", ThreatTxt, i, targetdistance, dunits) local ttstext = string.format("Target! %s! %s oh clock, %d %s!", ThreatTxt, i, targetdistance, dunits)
if self.UseSRS then if self.UseSRS then
local grp = Client:GetGroup() local grp = Client:GetGroup()
if clientcoord then
self.SRS:SetCoordinate(clientcoord)
end
self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10) self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10)
else else
MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client) MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client)
@ -1653,6 +1664,10 @@ function PLAYERRECCE:onafterTargetDetected(From, Event, To, Targetsbyclock, Clie
local ttstext = string.format("%d targets! %s oh clock, %d %s!", targetno, i, targetdistance, dunits) local ttstext = string.format("%d targets! %s oh clock, %d %s!", targetno, i, targetdistance, dunits)
if self.UseSRS then if self.UseSRS then
local grp = Client:GetGroup() local grp = Client:GetGroup()
local coord = grp:GetCoordinate()
if coord then
self.SRS:SetCoordinate(coord)
end
self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10) self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10)
else else
MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client) MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client)
@ -1694,6 +1709,10 @@ function PLAYERRECCE:onafterIllumination(From, Event, To, Client, Playername, Ta
local ttstext = "Sunshine!" local ttstext = "Sunshine!"
if self.UseSRS then if self.UseSRS then
local grp = Client:GetGroup() local grp = Client:GetGroup()
local coord = grp:GetCoordinate()
if coord then
self.SRS:SetCoordinate(coord)
end
self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10) self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10)
else else
MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client) MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client)
@ -1733,6 +1752,10 @@ function PLAYERRECCE:onafterTargetsSmoked(From, Event, To, Client, Playername, T
local ttstext = "Smoke and Mirrors!" local ttstext = "Smoke and Mirrors!"
if self.UseSRS then if self.UseSRS then
local grp = Client:GetGroup() local grp = Client:GetGroup()
local coord = grp:GetCoordinate()
if coord then
self.SRS:SetCoordinate(coord)
end
self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10) self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10)
else else
MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client) MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client)
@ -1772,6 +1795,10 @@ function PLAYERRECCE:onafterTargetsFlared(From, Event, To, Client, Playername, T
local ttstext = "Fire works!" local ttstext = "Fire works!"
if self.UseSRS then if self.UseSRS then
local grp = Client:GetGroup() local grp = Client:GetGroup()
local coord = grp:GetCoordinate()
if coord then
self.SRS:SetCoordinate(coord)
end
self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10) self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10)
else else
MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client) MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client)
@ -1817,6 +1844,10 @@ function PLAYERRECCE:onafterTargetLasing(From, Event, To, Client, Target, Laserc
local ttstext = "Laser on!" local ttstext = "Laser on!"
if self.UseSRS then if self.UseSRS then
local grp = Client:GetGroup() local grp = Client:GetGroup()
local coord = grp:GetCoordinate()
if coord then
self.SRS:SetCoordinate(coord)
end
self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10) self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10)
else else
MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client) MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client)
@ -1861,6 +1892,10 @@ function PLAYERRECCE:onafterShack(From, Event, To, Client, Target, Targettype)
local ttstext = "Shack!" local ttstext = "Shack!"
if self.UseSRS then if self.UseSRS then
local grp = Client:GetGroup() local grp = Client:GetGroup()
local coord = grp:GetCoordinate()
if coord then
self.SRS:SetCoordinate(coord)
end
self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1) self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1)
else else
MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client) MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client)
@ -1904,6 +1939,10 @@ function PLAYERRECCE:onafterTargetLOSLost(From, Event, To, Client, Target)
local ttstext = "Lost L O S!" local ttstext = "Lost L O S!"
if self.UseSRS then if self.UseSRS then
local grp = Client:GetGroup() local grp = Client:GetGroup()
local coord = grp:GetCoordinate()
if coord then
self.SRS:SetCoordinate(coord)
end
self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10) self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10)
else else
MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client) MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client)
@ -1952,6 +1991,10 @@ function PLAYERRECCE:onafterTargetReportSent(From, Event, To, Client, TargetSet)
local text = "Upload completed!" local text = "Upload completed!"
if self.UseSRS then if self.UseSRS then
local grp = Client:GetGroup() local grp = Client:GetGroup()
local coord = grp:GetCoordinate()
if coord then
self.SRS:SetCoordinate(coord)
end
self.SRSQueue:NewTransmission(text,nil,self.SRS,nil,1,{grp},text,10) self.SRSQueue:NewTransmission(text,nil,self.SRS,nil,1,{grp},text,10)
else else
MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client) MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client)

View File

@ -98,7 +98,7 @@ PLAYERTASK = {
--- PLAYERTASK class version. --- PLAYERTASK class version.
-- @field #string version -- @field #string version
PLAYERTASK.version="0.1.21" PLAYERTASK.version="0.1.22"
--- Generic task condition. --- Generic task condition.
-- @type PLAYERTASK.Condition -- @type PLAYERTASK.Condition
@ -935,7 +935,7 @@ end
do do
------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------
-- PLAYERTASKCONTROLLER -- PLAYERTASKCONTROLLER
-- TODO: PLAYERTASKCONTROLLER -- TODO: PLAYERTASKCONTROLLER
-- DONE Playername customized -- DONE Playername customized
-- DONE Coalition-level screen info to SET based -- DONE Coalition-level screen info to SET based
-- DONE Flash directions -- DONE Flash directions
@ -4003,8 +4003,9 @@ end
-- Note that this must be installed on your windows system. Can also be Google voice types, if you are using Google TTS. -- Note that this must be installed on your windows system. Can also be Google voice types, if you are using Google TTS.
-- @param #number Volume (Optional) Volume - between 0.0 (silent) and 1.0 (loudest) -- @param #number Volume (Optional) Volume - between 0.0 (silent) and 1.0 (loudest)
-- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS -- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS
-- @param Core.Point#COORDINATE Coordinate Coordinate from which the controller radio is sending
-- @return #PLAYERTASKCONTROLLER self -- @return #PLAYERTASKCONTROLLER self
function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey) function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,Coordinate)
self:T(self.lid.."SetSRS") self:T(self.lid.."SetSRS")
self.PathToSRS = PathToSRS or "C:\\Program Files\\DCS-SimpleRadio-Standalone" -- self.PathToSRS = PathToSRS or "C:\\Program Files\\DCS-SimpleRadio-Standalone" --
self.Gender = Gender or "male" -- self.Gender = Gender or "male" --
@ -4029,6 +4030,9 @@ function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Cultu
if self.PathToGoogleKey then if self.PathToGoogleKey then
self.SRS:SetGoogle(self.PathToGoogleKey) self.SRS:SetGoogle(self.PathToGoogleKey)
end end
if Coordinate then
self.SRS:SetCoordinate(Coordinate)
end
self.SRSQueue = MSRSQUEUE:New(self.MenuName or self.Name) self.SRSQueue = MSRSQUEUE:New(self.MenuName or self.Name)
self.SRSQueue:SetTransmitOnlyWithPlayers(self.TransmitOnlyWithPlayers) self.SRSQueue:SetTransmitOnlyWithPlayers(self.TransmitOnlyWithPlayers)
return self return self