From 32dbb520d677caf492dca887cda13902154a1525 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 16 Jan 2024 15:09:12 +0100 Subject: [PATCH 1/3] #AUTOLASE * Allow switching Smoke targets menu to be switched off and on --- .../Moose/Functional/Autolase.lua | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/Moose Development/Moose/Functional/Autolase.lua b/Moose Development/Moose/Functional/Autolase.lua index e4672fccc..ab9579430 100644 --- a/Moose Development/Moose/Functional/Autolase.lua +++ b/Moose Development/Moose/Functional/Autolase.lua @@ -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 From 298c569f93a47e65f8cd8826a39eda3e27e8ea7e Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 16 Jan 2024 15:09:51 +0100 Subject: [PATCH 2/3] #PLAYERTASK * Add a height of 2m on laser coordinates to ensure LOS test works --- Moose Development/Moose/Ops/PlayerTask.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Ops/PlayerTask.lua b/Moose Development/Moose/Ops/PlayerTask.lua index e251b1856..8ae53f1b1 100644 --- a/Moose Development/Moose/Ops/PlayerTask.lua +++ b/Moose Development/Moose/Ops/PlayerTask.lua @@ -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 From 056b761ebce6ebe08f41b0c00f83996ab1a35fcd Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Wed, 17 Jan 2024 08:10:01 +0100 Subject: [PATCH 3/3] #PLAYERTASKCONTROLLER * Additions for lasing unit being an ARMYGROUP --- Moose Development/Moose/Ops/PlayerTask.lua | 44 ++++++++++++++-------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/Moose Development/Moose/Ops/PlayerTask.lua b/Moose Development/Moose/Ops/PlayerTask.lua index 8ae53f1b1..406563273 100644 --- a/Moose Development/Moose/Ops/PlayerTask.lua +++ b/Moose Development/Moose/Ops/PlayerTask.lua @@ -98,7 +98,7 @@ PLAYERTASK = { --- PLAYERTASK class version. -- @field #string version -PLAYERTASK.version="0.1.23" +PLAYERTASK.version="0.1.24" --- Generic task condition. -- @type PLAYERTASK.Condition @@ -1966,6 +1966,8 @@ end -- Can optionally be handed as Ops.ArmyGroup#ARMYGROUP - **Note** might not find an LOS spot or get lost on the way. Cannot island-hop. -- @param #number LaserCode The lasercode to be used. Defaults to 1688. -- @param Core.Point#COORDINATE HoldingPoint (Optional) Point where the drone should initially circle. If not set, defaults to BullsEye of the coalition. +-- @param #number Alt (Optional) Altitude in feet. Only applies if using a FLIGHTGROUP object! Defaults to 10000. +-- @param #number Speed (Optional) Speed in knots. Only applies if using a FLIGHTGROUP object! Defaults to 120. -- @return #PLAYERTASKCONTROLLER self -- @usage -- -- Set up precision bombing, FlightGroup as lasing unit @@ -1980,7 +1982,7 @@ end -- ArmyGroup:Activate() -- taskmanager:EnablePrecisionBombing(ArmyGroup,1688) -- -function PLAYERTASKCONTROLLER:EnablePrecisionBombing(FlightGroup,LaserCode,HoldingPoint) +function PLAYERTASKCONTROLLER:EnablePrecisionBombing(FlightGroup,LaserCode,HoldingPoint, Alt, Speed) self:T(self.lid.."EnablePrecisionBombing") if FlightGroup then if FlightGroup.ClassName and (FlightGroup.ClassName == "FLIGHTGROUP" or FlightGroup.ClassName == "ARMYGROUP")then @@ -1993,11 +1995,20 @@ function PLAYERTASKCONTROLLER:EnablePrecisionBombing(FlightGroup,LaserCode,Holdi self.LasingDrone:SetLaser(LaserCode) self.LaserCode = LaserCode or 1688 self.LasingDroneTemplate = self.LasingDrone:_GetTemplate(true) + self.LasingDroneAlt = Alt or 10000 + self.LasingDroneSpeed = Speed or 120 -- let it orbit the BullsEye if FG if self.LasingDrone:IsFlightgroup() then + self.LasingDroneIsFlightgroup = true local BullsCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( self.Coalition )) if HoldingPoint then BullsCoordinate = HoldingPoint end - local Orbit = AUFTRAG:NewORBIT_CIRCLE(BullsCoordinate,10000,120) + local Orbit = AUFTRAG:NewORBIT_CIRCLE(BullsCoordinate,self.LasingDroneAlt,self.LasingDroneSpeed) + self.LasingDrone:AddMission(Orbit) + elseif self.LasingDrone:IsArmygroup() then + self.LasingDroneIsArmygroup = true + local BullsCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( self.Coalition )) + if HoldingPoint then BullsCoordinate = HoldingPoint end + local Orbit = AUFTRAG:NewONGUARD(BullsCoordinate) self.LasingDrone:AddMission(Orbit) end else @@ -2536,10 +2547,16 @@ function PLAYERTASKCONTROLLER:_CheckPrecisionTasks() if self.LasingDrone then self.LasingDrone:_Respawn(1,nil,true) else - -- TODO: Handle ArmyGroup - local FG = FLIGHTGROUP:New(self.LasingDroneTemplate) - FG:Activate() - self:EnablePrecisionBombing(FG,self.LaserCode or 1688) + -- DONE: Handle ArmyGroup + if self.LasingDroneIsFlightgroup then + local FG = FLIGHTGROUP:New(self.LasingDroneTemplate) + FG:Activate() + self:EnablePrecisionBombing(FG,self.LaserCode or 1688) + else + local FG = ARMYGROUP:New(self.LasingDroneTemplate) + FG:Activate() + self:EnablePrecisionBombing(FG,self.LaserCode or 1688) + end end return self end @@ -2554,13 +2571,11 @@ function PLAYERTASKCONTROLLER:_CheckPrecisionTasks() self.LasingDrone.playertask.inreach = false self.LasingDrone.playertask.reachmessage = false -- move the drone to target - if self.LasingDrone:IsFlightgroup() then + if self.LasingDroneIsFlightgroup then self.LasingDrone:CancelAllMissions() - local auftrag = AUFTRAG:NewORBIT_CIRCLE(task.Target:GetCoordinate(),10000,120) - --local currmission = self.LasingDrone:GetMissionCurrent() - self.LasingDrone:AddMission(auftrag) - --currmission:__Cancel(-2) - elseif self.LasingDrone:IsArmygroup() then + local auftrag = AUFTRAG:NewORBIT_CIRCLE(task.Target:GetCoordinate(),self.LasingDroneAlt,self.LasingDroneSpeed) + self.LasingDrone:AddMission(auftrag) + elseif self.LasingDroneIsArmygroup then local tgtcoord = task.Target:GetCoordinate() local tgtzone = ZONE_RADIUS:New("ArmyGroup-"..math.random(1,10000),tgtcoord:GetVec2(),3000) local finalpos=nil -- Core.Point#COORDINATE @@ -2573,11 +2588,10 @@ function PLAYERTASKCONTROLLER:_CheckPrecisionTasks() end end if finalpos then + self.LasingDrone:CancelAllMissions() -- yeah we got one local auftrag = AUFTRAG:NewARMOREDGUARD(finalpos,"Off road") - local currmission = self.LasingDrone:GetMissionCurrent() self.LasingDrone:AddMission(auftrag) - if currmission then currmission:__Cancel(-2) end else -- could not find LOS position! self:E("***Could not find LOS position to post ArmyGroup for lasing!")