This commit is contained in:
Applevangelist 2025-01-17 09:55:12 +01:00
parent 0a08e3fdac
commit 72bb23ed0d
2 changed files with 97 additions and 10 deletions

View File

@ -74,7 +74,7 @@
-- @image Designation.JPG -- @image Designation.JPG
-- --
-- Date: 24 Oct 2021 -- Date: 24 Oct 2021
-- Last Update: May 2024 -- Last Update: Jan 2025
-- --
--- Class AUTOLASE --- Class AUTOLASE
-- @type AUTOLASE -- @type AUTOLASE
@ -89,6 +89,7 @@
-- @field #table playermenus -- @field #table playermenus
-- @field #boolean smokemenu -- @field #boolean smokemenu
-- @field #boolean threatmenu -- @field #boolean threatmenu
-- @field #number RoundingPrecision
-- @extends Ops.Intel#INTEL -- @extends Ops.Intel#INTEL
--- ---
@ -100,6 +101,7 @@ AUTOLASE = {
alias = "", alias = "",
debug = false, debug = false,
smokemenu = true, smokemenu = true,
RoundingPrecision = 0,
} }
--- Laser spot info --- Laser spot info
@ -118,7 +120,7 @@ AUTOLASE = {
--- AUTOLASE class version. --- AUTOLASE class version.
-- @field #string version -- @field #string version
AUTOLASE.version = "0.1.26" AUTOLASE.version = "0.1.27"
------------------------------------------------------------------- -------------------------------------------------------------------
-- Begin Functional.Autolase.lua -- Begin Functional.Autolase.lua
@ -207,6 +209,7 @@ function AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)
self.playermenus = {} self.playermenus = {}
self.smokemenu = true self.smokemenu = true
self.threatmenu = true self.threatmenu = true
self.RoundingPrecision = 0
-- Set some string id for output to DCS.log file. -- 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") self.lid=string.format("AUTOLASE %s (%s) | ", self.alias, self.coalition and UTILS.GetCoalitionName(self.coalition) or "unknown")
@ -600,6 +603,15 @@ function AUTOLASE:SetSmokeTargets(OnOff,Color)
return self return self
end end
--- (User) Function to set rounding precision for BR distance output.
-- @param #AUTOLASE self
-- @param #number IDP Rounding precision before/after the decimal sign. Defaults to zero. Positive values round right of the decimal sign, negative ones left of the decimal sign.
-- @return #AUTOLASE self
function AUTOLASE:SetRoundingPrecsion(IDP)
self.RoundingPrecision = IDP or 0
return self
end
--- (User) Show the "Switch smoke target..." menu entry for pilots. On by default. --- (User) Show the "Switch smoke target..." menu entry for pilots. On by default.
-- @param #AUTOLASE self -- @param #AUTOLASE self
-- @return #AUTOLASE self -- @return #AUTOLASE self
@ -786,8 +798,12 @@ function AUTOLASE:ShowStatus(Group,Unit)
locationstring = entry.coordinate:ToStringMGRS(settings) locationstring = entry.coordinate:ToStringMGRS(settings)
elseif settings:IsA2G_LL_DMS() then elseif settings:IsA2G_LL_DMS() then
locationstring = entry.coordinate:ToStringLLDMS(settings) locationstring = entry.coordinate:ToStringLLDMS(settings)
elseif settings:IsA2G_LL_DDM() then
locationstring = entry.coordinate:ToStringLLDDM(settings)
elseif settings:IsA2G_BR() then elseif settings:IsA2G_BR() then
locationstring = entry.coordinate:ToStringBR(Group:GetCoordinate() or Unit:GetCoordinate(),settings) -- attention this is the distance from the ASKING unit to target, not from RECCE to target!
local startcoordinate = Unit:GetCoordinate() or Group:GetCoordinate()
locationstring = entry.coordinate:ToStringBR(startcoordinate,settings,false,self.RoundingPrecision)
end end
end end
end end

View File

@ -98,7 +98,7 @@ PLAYERTASK = {
--- PLAYERTASK class version. --- PLAYERTASK class version.
-- @field #string version -- @field #string version
PLAYERTASK.version="0.1.24" PLAYERTASK.version="0.1.25"
--- Generic task condition. --- Generic task condition.
-- @type PLAYERTASK.Condition -- @type PLAYERTASK.Condition
@ -700,6 +700,15 @@ function PLAYERTASK:IsDone()
return IsDone return IsDone
end end
--- [User] Check if task is NOT done
-- @param #PLAYERTASK self
-- @return #boolean done
function PLAYERTASK:IsNotDone()
self:T(self.lid.."IsNotDone?")
local IsNotDone = not self:IsDone()
return IsNotDone
end
--- [User] Check if PLAYERTASK has clients assigned to it. --- [User] Check if PLAYERTASK has clients assigned to it.
-- @param #PLAYERTASK self -- @param #PLAYERTASK self
-- @return #boolean hasclients -- @return #boolean hasclients
@ -1156,7 +1165,7 @@ function PLAYERTASK:onafterCancel(From, Event, To)
self.TaskController:__TaskCancelled(-1,self) self.TaskController:__TaskCancelled(-1,self)
end end
self.timestamp = timer.getAbsTime() self.timestamp = timer.getAbsTime()
self.FinalState = "Cancel" self.FinalState = "Cancelled"
self:__Done(-1) self:__Done(-1)
return self return self
end end
@ -1308,6 +1317,8 @@ do
-- @field Core.ClientMenu#CLIENTMENU ActiveTopMenu -- @field Core.ClientMenu#CLIENTMENU ActiveTopMenu
-- @field Core.ClientMenu#CLIENTMENU ActiveInfoMenu -- @field Core.ClientMenu#CLIENTMENU ActiveInfoMenu
-- @field Core.ClientMenu#CLIENTMENU MenuNoTask -- @field Core.ClientMenu#CLIENTMENU MenuNoTask
-- @field #boolean InformationMenu Show Radio Info Menu
-- @field #number TaskInfoDuration How long to show the briefing info on the screen
-- @extends Core.Fsm#FSM -- @extends Core.Fsm#FSM
--- ---
@ -1663,6 +1674,8 @@ PLAYERTASKCONTROLLER = {
UseTypeNames = false, UseTypeNames = false,
Scoring = nil, Scoring = nil,
MenuNoTask = nil, MenuNoTask = nil,
InformationMenu = false,
TaskInfoDuration = 30,
} }
--- ---
@ -1799,6 +1812,7 @@ PLAYERTASKCONTROLLER.Messages = {
CRUISER = "Cruiser", CRUISER = "Cruiser",
DESTROYER = "Destroyer", DESTROYER = "Destroyer",
CARRIER = "Aircraft Carrier", CARRIER = "Aircraft Carrier",
RADIOS = "Radios",
}, },
DE = { DE = {
TASKABORT = "Auftrag abgebrochen!", TASKABORT = "Auftrag abgebrochen!",
@ -1882,12 +1896,13 @@ PLAYERTASKCONTROLLER.Messages = {
CRUISER = "Kreuzer", CRUISER = "Kreuzer",
DESTROYER = "Zerstörer", DESTROYER = "Zerstörer",
CARRIER = "Flugzeugträger", CARRIER = "Flugzeugträger",
RADIOS = "Frequenzen",
}, },
} }
--- PLAYERTASK class version. --- PLAYERTASK class version.
-- @field #string version -- @field #string version
PLAYERTASKCONTROLLER.version="0.1.67" PLAYERTASKCONTROLLER.version="0.1.69"
--- Create and run a new TASKCONTROLLER instance. --- Create and run a new TASKCONTROLLER instance.
-- @param #PLAYERTASKCONTROLLER self -- @param #PLAYERTASKCONTROLLER self
@ -1949,6 +1964,10 @@ function PLAYERTASKCONTROLLER:New(Name, Coalition, Type, ClientFilter)
self.UseTypeNames = false self.UseTypeNames = false
self.InformationMenu = false
self.TaskInfoDuration = 30
self.IsClientSet = false self.IsClientSet = false
if ClientFilter and type(ClientFilter) == "table" and ClientFilter.ClassName and ClientFilter.ClassName == "SET_CLIENT" then if ClientFilter and type(ClientFilter) == "table" and ClientFilter.ClassName and ClientFilter.ClassName == "SET_CLIENT" then
@ -2166,6 +2185,16 @@ function PLAYERTASKCONTROLLER:SetAllowFlashDirection(OnOff)
return self return self
end end
--- [User] Set to show a menu entry to retrieve the radio frequencies used.
-- @param #PLAYERTASKCONTROLLER self
-- @param #boolean OnOff Set to `true` to switch on and `false` to switch off. Default is OFF.
-- @return #PLAYERTASKCONTROLLER self
function PLAYERTASKCONTROLLER:SetShowRadioInfoMenu(OnOff)
self:T(self.lid.."SetAllowRadioInfoMenu")
self.InformationMenu = OnOff
return self
end
--- [User] Do not show menu entries to smoke or flare targets --- [User] Do not show menu entries to smoke or flare targets
-- @param #PLAYERTASKCONTROLLER self -- @param #PLAYERTASKCONTROLLER self
-- @return #PLAYERTASKCONTROLLER self -- @return #PLAYERTASKCONTROLLER self
@ -2261,7 +2290,7 @@ function PLAYERTASKCONTROLLER:_GetTextForSpeech(text)
return text return text
end end
--- [User] Set repetition options for tasks --- [User] Set repetition options for tasks.
-- @param #PLAYERTASKCONTROLLER self -- @param #PLAYERTASKCONTROLLER self
-- @param #boolean OnOff Set to `true` to switch on and `false` to switch off (defaults to true) -- @param #boolean OnOff Set to `true` to switch on and `false` to switch off (defaults to true)
-- @param #number Repeats Number of repeats (defaults to 5) -- @param #number Repeats Number of repeats (defaults to 5)
@ -2279,6 +2308,16 @@ function PLAYERTASKCONTROLLER:SetTaskRepetition(OnOff, Repeats)
return self return self
end end
--- [User] Set how long the briefing is shown on screen.
-- @param #PLAYERTASKCONTROLLER self
-- @param #number Seconds Duration in seconds. Defaults to 30 seconds.
-- @return #PLAYERTASKCONTROLLER self
function PLAYERTASKCONTROLLER:SetBriefingDuration(Seconds)
self:T(self.lid.."SetBriefingDuration")
self.TaskInfoDuration = Seconds or 30
return self
end
--- [Internal] Send message to SET_CLIENT of players --- [Internal] Send message to SET_CLIENT of players
-- @param #PLAYERTASKCONTROLLER self -- @param #PLAYERTASKCONTROLLER self
-- @param #string Text the text to be send -- @param #string Text the text to be send
@ -3464,6 +3503,32 @@ function PLAYERTASKCONTROLLER:_SwitchFlashing(Group, Client)
return self return self
end end
function PLAYERTASKCONTROLLER:_ShowRadioInfo(Group, Client)
self:T(self.lid.."_ShowRadioInfo")
local playername, ttsplayername = self:_GetPlayerName(Client)
if self.UseSRS then
local frequency = self.Frequency
local freqtext = ""
if type(frequency) == "table" then
freqtext = self.gettext:GetEntry("FREQUENCIES",self.locale)
freqtext = freqtext..table.concat(frequency,", ")
else
local freqt = self.gettext:GetEntry("FREQUENCY",self.locale)
freqtext = string.format(freqt,frequency)
end
local switchtext = self.gettext:GetEntry("BROADCAST",self.locale)
playername = ttsplayername or self:_GetTextForSpeech(playername)
--local text = string.format("%s, %s, switch to %s for task assignment!",EventData.IniPlayerName,self.MenuName or self.Name,freqtext)
local text = string.format(switchtext,playername,self.MenuName or self.Name,freqtext)
self.SRSQueue:NewTransmission(text,nil,self.SRS,nil,2,{Group},text,30,self.BCFrequency,self.BCModulation)
end
return self
end
--- [Internal] Flashing directional info for a client --- [Internal] Flashing directional info for a client
-- @param #PLAYERTASKCONTROLLER self -- @param #PLAYERTASKCONTROLLER self
-- @return #PLAYERTASKCONTROLLER self -- @return #PLAYERTASKCONTROLLER self
@ -3683,7 +3748,7 @@ function PLAYERTASKCONTROLLER:_ActiveTaskInfo(Task, Group, Client)
text = self.gettext:GetEntry("NOACTIVETASK",self.locale) text = self.gettext:GetEntry("NOACTIVETASK",self.locale)
end end
if not self.NoScreenOutput then if not self.NoScreenOutput then
local m=MESSAGE:New(text,15,"Tasking"):ToClient(Client) local m=MESSAGE:New(text,self.TaskInfoDuration or 30,"Tasking"):ToClient(Client)
end end
return self return self
end end
@ -4037,6 +4102,11 @@ function PLAYERTASKCONTROLLER:_CreateJoinMenuTemplate()
self.MenuNoTask = nil self.MenuNoTask = nil
end end
if self.InformationMenu then
local radioinfo = self.gettext:GetEntry("RADIOS",self.locale)
JoinTaskMenuTemplate:NewEntry(radioinfo,self.JoinTopMenu,self._ShowRadioInfo,self)
end
self.JoinTaskMenuTemplate = JoinTaskMenuTemplate self.JoinTaskMenuTemplate = JoinTaskMenuTemplate
return self return self
@ -4376,8 +4446,9 @@ end
-- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS; if you use a config file for MSRS, hand in nil here. -- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS; if you use a config file for MSRS, hand in nil here.
-- @param #string AccessKey (Optional) Your Google API access key. This is necessary if DCS-gRPC is used as backend; if you use a config file for MSRS, hand in nil here. -- @param #string AccessKey (Optional) Your Google API access key. This is necessary if DCS-gRPC is used as backend; if you use a config file for MSRS, hand in nil here.
-- @param Core.Point#COORDINATE Coordinate Coordinate from which the controller radio is sending -- @param Core.Point#COORDINATE Coordinate Coordinate from which the controller radio is sending
-- @param #string Backend (Optional) MSRS Backend to be used, can be MSRS.Backend.SRSEXE or MSRS.Backend.GRPC; if you use a config file for MSRS, hand in nil here.
-- @return #PLAYERTASKCONTROLLER self -- @return #PLAYERTASKCONTROLLER self
function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Coordinate) function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Coordinate,Backend)
self:T(self.lid.."SetSRS") self:T(self.lid.."SetSRS")
self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone" -- self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone" --
self.Gender = Gender or MSRS.gender or "male" -- self.Gender = Gender or MSRS.gender or "male" --
@ -4393,7 +4464,7 @@ function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Cultu
self.Modulation = Modulation or {radio.modulation.FM,radio.modulation.AM} -- self.Modulation = Modulation or {radio.modulation.FM,radio.modulation.AM} --
self.BCModulation = self.Modulation self.BCModulation = self.Modulation
-- set up SRS -- set up SRS
self.SRS=MSRS:New(self.PathToSRS,self.Frequency,self.Modulation) self.SRS=MSRS:New(self.PathToSRS,self.Frequency,self.Modulation,Backend)
self.SRS:SetCoalition(self.Coalition) self.SRS:SetCoalition(self.Coalition)
self.SRS:SetLabel(self.MenuName or self.Name) self.SRS:SetLabel(self.MenuName or self.Name)
self.SRS:SetGender(self.Gender) self.SRS:SetGender(self.Gender)