Merge branch 'develop' into FF/Ops

This commit is contained in:
Frank
2022-08-29 00:37:34 +02:00
12 changed files with 2786 additions and 2972 deletions
File diff suppressed because it is too large Load Diff
+50 -24
View File
@@ -74,6 +74,7 @@
-- @image Designation.JPG
--
-- Date: 24 Oct 2021
-- Last Update: Aug 2022
--
--- Class AUTOLASE
-- @type AUTOLASE
@@ -110,7 +111,7 @@ AUTOLASE = {
--- AUTOLASE class version.
-- @field #string version
AUTOLASE.version = "0.0.12"
AUTOLASE.version = "0.1.14"
-------------------------------------------------------------------
-- Begin Functional.Autolase.lua
@@ -192,6 +193,7 @@ function AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)
self.SRSPath = ""
self.SRSFreq = 251
self.SRSMod = radio.modulation.AM
self.NoMenus = false
-- Set some string id for output to DCS.log file.
self.lid=string.format("AUTOLASE %s (%s) | ", self.alias, self.coalition and UTILS.GetCoalitionName(self.coalition) or "unknown")
@@ -207,14 +209,14 @@ function AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)
self:AddTransition("*", "Cancel", "*") -- Stop Autolase
-- Menu Entry
if not PilotSet then
self.Menu = MENU_COALITION_COMMAND:New(self.coalition,"Autolase",nil,self.ShowStatus,self)
else
if PilotSet then
self.usepilotset = true
self.pilotset = PilotSet
self:HandleEvent(EVENTS.PlayerEnterAircraft)
self:SetPilotMenu()
--self:SetPilotMenu()
end
--self.SetPilotMenu()
self:SetClusterAnalysis(false, false)
@@ -308,6 +310,10 @@ function AUTOLASE:SetPilotMenu()
lasemenu:Refresh()
end
end
else
if not self.NoMenus then
self.Menu = MENU_COALITION_COMMAND:New(self.coalition,"Autolase",nil,self.ShowStatus,self)
end
end
return self
end
@@ -356,12 +362,45 @@ end
-- @param #string Path Path to SRS directory, e.g. C:\\Program Files\\DCS-SimpleRadio-Standalon
-- @param #number Frequency Frequency to send, e.g. 243
-- @param #number Modulation Modulation i.e. radio.modulation.AM or radio.modulation.FM
-- @param #string Label (Optional) Short label to be used on the SRS Client Overlay
-- @param #string Gender (Optional) Defaults to "male"
-- @param #string Culture (Optional) Defaults to "en-US"
-- @param #number Port (Optional) Defaults to 5002
-- @param #string Voice (Optional) Use a specifc voice with the @{Sound.SRS.SetVoice} function, e.g, `:SetVoice("Microsoft Hedda Desktop")`.
-- 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 #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS
-- @return #AUTOLASE self
function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation)
self.useSRS = OnOff or true
self.SRSPath = Path or "E:\\Program Files\\DCS-SimpleRadio-Standalone"
self.SRSFreq = Frequency or 271
self.SRSMod = Modulation or radio.modulation.AM
function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation,Label,Gender,Culture,Port,Voice,Volume,PathToGoogleKey)
if OnOff then
self.useSRS = true
self.SRSPath = Path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
self.SRSFreq = Frequency or 271
self.SRSMod = Modulation or radio.modulation.AM
self.Gender = Gender or "male"
self.Culture = Culture or "en-US"
self.Port = Port or 5002
self.Voice = Voice
self.PathToGoogleKey = PathToGoogleKey
self.Volume = Volume or 1.0
self.Label = Label
-- set up SRS
self.SRS = MSRS:New(self.SRSPath,self.SRSFreq,self.SRSMod,self.Volume)
self.SRS:SetCoalition(self.coalition)
self.SRS:SetLabel(self.MenuName or self.Name)
self.SRS:SetGender(self.Gender)
self.SRS:SetCulture(self.Culture)
self.SRS:SetPort(self.Port)
self.SRS:SetVoice(self.Voice)
if self.PathToGoogleKey then
self.SRS:SetGoogle(self.PathToGoogleKey)
end
self.SRSQueue = MSRSQUEUE:New(self.alias)
else
self.useSRS = false
self.SRS= nil
self.SRSQueue = nil
end
return self
end
@@ -643,20 +682,7 @@ end
-- end
function AUTOLASE:NotifyPilotsWithSRS(Message)
if self.useSRS then
-- Create a SOUNDTEXT object.
if self.debug then
BASE:TraceOn()
BASE:TraceClass("SOUNDTEXT")
BASE:TraceClass("MSRS")
end
local path = self.SRSPath or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
local freq = self.SRSFreq or 271
local mod = self.SRSMod or radio.modulation.AM
local text=SOUNDTEXT:New(Message)
-- MOOSE SRS
local msrs=MSRS:New(path, freq, mod)
-- Text-to speech with default voice after 2 seconds.
msrs:PlaySoundText(text, 2)
self.SRSQueue:NewTransmission(Message,nil,self.SRS,nil,2)
end
if self.debug then self:I(Message) end
return self
+12 -10
View File
@@ -1412,7 +1412,7 @@ function RANGE:AddBombingTargets( targetnames, goodhitrange, randommove )
elseif _isstatic == false then
local _unit = UNIT:FindByName( name )
self:T2( self.id .. string.format( "Adding unit bombing target %s with hit range %d.", name, goodhitrange, randommove ) )
self:AddBombingTargetUnit( _unit, goodhitrange )
self:AddBombingTargetUnit( _unit, goodhitrange, randommove )
else
self:E( self.id .. string.format( "ERROR! Could not find bombing target %s.", name ) )
end
@@ -2419,7 +2419,8 @@ end
--- Start smoking a coordinate with a delay.
-- @param #table _args Argements passed.
function RANGE._DelayedSmoke( _args )
trigger.action.smoke( _args.coord:GetVec3(), _args.color )
_args.coord:Smoke(_args.color)
--trigger.action.smoke( _args.coord:GetVec3(), _args.color )
end
--- Display top 10 stafing results of a specific player.
@@ -2447,7 +2448,7 @@ function RANGE:_DisplayMyStrafePitResults( _unitName )
-- Sort results table wrt number of hits.
local _sort = function( a, b )
return a.hits > b.hits
return a.roundsHit > b.roundsHit
end
table.sort( _results, _sort )
@@ -2464,7 +2465,7 @@ function RANGE:_DisplayMyStrafePitResults( _unitName )
-- Best result.
if _bestMsg == "" then
_bestMsg = string.format( "Hits %d - %s - %s", _result.hits, _result.zone.name, _result.text )
_bestMsg = string.format( "Hits %d - %s - %s", result.roundsHit, result.name, result.roundsQuality)
end
-- 10 runs
@@ -2509,15 +2510,15 @@ function RANGE:_DisplayStrafePitResults( _unitName )
-- Get the best result of the player.
local _best = nil
for _, _result in pairs( _results ) do
if _best == nil or _result.hits > _best.hits then
if _best == nil or _result.roundsHit > _best.roundsHit then
_best = _result
end
end
-- Add best result to table.
if _best ~= nil then
local text = string.format( "%s: Hits %i - %s - %s", _playerName, _best.hits, _best.zone.name, _best.text )
table.insert( _playerResults, { msg = text, hits = _best.hits } )
local text = string.format( "%s: Hits %i - %s - %s", _playerName, _best.roundsHit, _best.name, _best.roundsQuality )
table.insert( _playerResults, { msg = text, hits = _best.roundsHit } )
end
end
@@ -3543,6 +3544,7 @@ function RANGE:_DisplayMessageToGroup( _unit, _text, _time, _clear, display )
-- Group ID.
local _gid = _unit:GetGroup():GetID()
local _grp = _unit:GetGroup()
-- Get playername and player settings
local _, playername = self:_GetPlayerUnitAndName( _unit:GetName() )
@@ -3550,14 +3552,14 @@ function RANGE:_DisplayMessageToGroup( _unit, _text, _time, _clear, display )
-- Send message to player if messages enabled and not only for the examiner.
if _gid and (playermessage == true or display) and (not self.examinerexclusive) then
trigger.action.outTextForGroup( _gid, _text, _time, _clear )
local m = MESSAGE:New(_text,_time,nil,_clear):ToUnit(_unit)
end
-- Send message to examiner.
if self.examinergroupname ~= nil then
local _examinerid = GROUP:FindByName( self.examinergroupname ):GetID()
local _examinerid = GROUP:FindByName( self.examinergroupname )
if _examinerid then
trigger.action.outTextForGroup( _examinerid, _text, _time, _clear )
local m = MESSAGE:New(_text,_time,nil,_clear):ToGroup(_examinerid)
end
end
end