This commit is contained in:
Applevangelist 2024-01-16 15:06:54 +01:00
parent b6b344a69a
commit 5c90afea76
2 changed files with 30 additions and 7 deletions

View File

@ -74,7 +74,7 @@
-- @image Designation.JPG
--
-- Date: 24 Oct 2021
-- Last Update: Oct 2023
-- Last Update: Jan 2024
--
--- Class AUTOLASE
-- @type AUTOLASE
@ -87,6 +87,7 @@
-- @field Core.Set#SET_GROUP RecceSet
-- @field #table LaserCodes
-- @field #table playermenus
-- @field #boolean smokemenu
-- @extends Ops.Intel#INTEL
---
@ -97,6 +98,7 @@ AUTOLASE = {
verbose = 0,
alias = "",
debug = false,
smokemenu = true,
}
--- Laser spot info
@ -115,7 +117,7 @@ AUTOLASE = {
--- AUTOLASE class version.
-- @field #string version
AUTOLASE.version = "0.1.22"
AUTOLASE.version = "0.1.23"
-------------------------------------------------------------------
-- Begin Functional.Autolase.lua
@ -202,6 +204,7 @@ function AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)
self.blacklistattributes = {}
self:SetLaserCodes( { 1688, 1130, 4785, 6547, 1465, 4578 } ) -- set self.LaserCodes
self.playermenus = {}
self.smokemenu = true
-- 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")
@ -329,9 +332,11 @@ function AUTOLASE:SetPilotMenu()
local lasetopm = MENU_GROUP:New(Group,"Autolase",nil)
self.playermenus[unitname] = lasetopm
local lasemenu = MENU_GROUP_COMMAND:New(Group,"Status",lasetopm,self.ShowStatus,self,Group,Unit)
local smoke = (self.smoketargets == true) and "off" or "on"
local smoketext = string.format("Switch smoke targets to %s",smoke)
local smokemenu = MENU_GROUP_COMMAND:New(Group,smoketext,lasetopm,self.SetSmokeTargets,self,(not self.smoketargets))
if self.smokemenu then
local smoke = (self.smoketargets == true) and "off" or "on"
local smoketext = string.format("Switch smoke targets to %s",smoke)
local smokemenu = MENU_GROUP_COMMAND:New(Group,smoketext,lasetopm,self.SetSmokeTargets,self,(not self.smoketargets))
end
for _,_grp in pairs(self.RecceSet.Set) do
local grp = _grp -- Wrapper.Group#GROUP
local unit = grp:GetUnit(1)
@ -581,6 +586,23 @@ function AUTOLASE:SetSmokeTargets(OnOff,Color)
return self
end
--- (User) Show the "Switch smoke target..." menu entry for pilots. On by default.
-- @param #AUTOLASE self
-- @return #AUTOLASE self
function AUTOLASE:EnableSmokeMenu()
self.smokemenu = true
return self
end
--- (User) Do not show the "Switch smoke target..." menu entry for pilots.
-- @param #AUTOLASE self
-- @return #AUTOLASE self
function AUTOLASE:DisableSmokeMenu()
self.smokemenu = false
return self
end
--- (Internal) Function to calculate line of sight.
-- @param #AUTOLASE self
-- @param Wrapper.Unit#UNIT Unit

View File

@ -98,7 +98,7 @@ PLAYERTASK = {
--- PLAYERTASK class version.
-- @field #string version
PLAYERTASK.version="0.1.22"
PLAYERTASK.version="0.1.23"
--- Generic task condition.
-- @type PLAYERTASK.Condition
@ -2609,6 +2609,7 @@ function PLAYERTASKCONTROLLER:_CheckPrecisionTasks()
-- not done yet
local dcoord = self.LasingDrone:GetCoordinate()
local tcoord = task.Target:GetCoordinate()
tcoord.y = tcoord.y + 2
local dist = dcoord:Get2DDistance(tcoord)
-- close enough?
if dist < 3000 and not self.LasingDrone:IsLasing() then
@ -3192,7 +3193,7 @@ function PLAYERTASKCONTROLLER:_ActiveTaskInfo(Task, Group, Client)
local islasing = self.LasingDrone:IsLasing() == true and yes or no
local prectext = self.gettext:GetEntry("POINTERTARGETREPORT",self.locale)
prectext = string.format(prectext,inreach,islasing)
text = text .. prectext
text = text .. prectext.."("..self.LaserCode..")"
end
end
-- Buddylasing