Merge pull request #2537 from FlightControl-Master/master-ng

Merge from master-ng
This commit is contained in:
Thomas
2026-03-04 14:12:14 +01:00
committed by GitHub
2 changed files with 59 additions and 23 deletions
+31
View File
@@ -198,6 +198,37 @@ function MESSAGE:ToClient( Client, Settings )
return self return self
end end
--- Sends a MESSAGE to a SET_GROUP, SET_UNIT, or SET_CLIENT.
-- @param #MESSAGE self
-- @param Core.Set#SET_GROUP Set The set to send to.
-- @param Core.Settings#SETTINGS Settings (Optional) Settings for message display.
-- @return self
function MESSAGE:ToSet(Set, Settings)
for _,_obj in pairs (Set:GetSetObjects() or {}) do
if _obj and _obj:IsAlive() then
if _obj:IsInstanceOf("SET_GROUP") then
self:ToGroup(_obj, Settings)
elseif _obj:IsInstanceOf("SET_CLIENT") or _obj:IsInstanceOf("SET_UNIT") then
self:ToUnit(_obj, Settings)
end
end
end
return self
end
--- Sends a MESSAGE to a SET_GROUP, SET_UNIT, or SET_CLIENT if a condition is true.
-- @param #MESSAGE self
-- @param Core.Set#SET_GROUP Set The set to send to.
-- @param #boolean Condition The condition which needs to be true.
-- @param Core.Settings#SETTINGS Settings (Optional) Settings for message display.
-- @return self
function MESSAGE:ToSetIf(Set, Condition, Settings)
if Set and Condition == true then
self:ToSet(Set, Settings)
end
return self
end
--- Sends a MESSAGE to a Group. --- Sends a MESSAGE to a Group.
-- @param #MESSAGE self -- @param #MESSAGE self
-- @param Wrapper.Group#GROUP Group to which the message is displayed. -- @param Wrapper.Group#GROUP Group to which the message is displayed.
@@ -301,12 +301,11 @@ do -- DESIGNATE
--- DESIGNATE Constructor. This class is an abstract class and should not be instantiated. --- DESIGNATE Constructor. This class is an abstract class and should not be instantiated.
-- @param #DESIGNATE self -- @param #DESIGNATE self
-- @param Tasking.CommandCenter#COMMANDCENTER CC -- @param Wrapper.Group#GROUP CC Group as Commandcenter standin. Currently unused (03/2026)
-- @param Functional.Detection#DETECTION_BASE Detection -- @param Functional.Detection#DETECTION_BASE Detection
-- @param Core.Set#SET_GROUP AttackSet The Attack collection of GROUP objects to designate and report for. -- @param Core.Set#SET_GROUP AttackSet The Attack collection of GROUP objects to designate and report for.
-- @param Tasking.Mission#MISSION Mission (Optional) The Mission where the menu needs to be attached.
-- @return #DESIGNATE -- @return #DESIGNATE
function DESIGNATE:New( CC, Detection, AttackSet, Mission ) function DESIGNATE:New( CC, Detection, AttackSet )
local self = BASE:Inherit( self, FSM:New() ) -- #DESIGNATE local self = BASE:Inherit( self, FSM:New() ) -- #DESIGNATE
self:F( { Detection } ) self:F( { Detection } )
@@ -468,7 +467,7 @@ do -- DESIGNATE
-- @param #DESIGNATE self -- @param #DESIGNATE self
-- @param #number Delay -- @param #number Delay
self.CC = CC --self.CC = CC
self.Detection = Detection self.Detection = Detection
self.AttackSet = AttackSet self.AttackSet = AttackSet
self.RecceSet = Detection:GetDetectionSet() self.RecceSet = Detection:GetDetectionSet()
@@ -480,7 +479,7 @@ do -- DESIGNATE
self:SetFlashStatusMenu( false ) self:SetFlashStatusMenu( false )
self:SetFlashDetectionMessages( true ) self:SetFlashDetectionMessages( true )
self:SetMission( Mission ) --self:SetMission( Mission )
self:SetLaserCodes( { 1688, 1130, 4785, 6547, 1465, 4578 } ) -- set self.LaserCodes self:SetLaserCodes( { 1688, 1130, 4785, 6547, 1465, 4578 } ) -- set self.LaserCodes
self:SetAutoLase( false, false ) -- set self.Autolase and don't send message. self:SetAutoLase( false, false ) -- set self.Autolase and don't send message.
@@ -754,10 +753,12 @@ do -- DESIGNATE
if Message then if Message then
local AutoLaseOnOff = ( self.AutoLase == true ) and "On" or "Off" local AutoLaseOnOff = ( self.AutoLase == true ) and "On" or "Off"
local CC = self.CC:GetPositionable()
if CC then MESSAGE:New(self.DesignateName .. ": Auto Lase " .. AutoLaseOnOff .. ".",15):ToSet(self.AttackSet)
CC:MessageToSetGroup( self.DesignateName .. ": Auto Lase " .. AutoLaseOnOff .. ".", 15, self.AttackSet ) --local CC = self.CC:GetPositionable()
end --if CC then
--CC:MessageToSetGroup( self.DesignateName .. ": Auto Lase " .. AutoLaseOnOff .. ".", 15, self.AttackSet )
--end
end end
self:CoordinateLase() self:CoordinateLase()
@@ -777,14 +778,14 @@ do -- DESIGNATE
return self return self
end end
--- Set the MISSION object for which designate will function. --- [DEPRECATED DO NOT USE] Set the MISSION object for which designate will function.
-- When a MISSION object is assigned, the menu for the designation will be located at the Mission Menu. -- When a MISSION object is assigned, the menu for the designation will be located at the Mission Menu.
-- @param #DESIGNATE self -- @param #DESIGNATE self
-- @param Tasking.Mission#MISSION Mission The MISSION object. -- @param Tasking.Mission#MISSION Mission The MISSION object.
-- @return #DESIGNATE -- @return #DESIGNATE
function DESIGNATE:SetMission( Mission ) --R2.2 function DESIGNATE:SetMission( Mission ) --R2.2
self.Mission = Mission --self.Mission = Mission
return self return self
end end
@@ -830,7 +831,8 @@ do -- DESIGNATE
function( AttackGroup ) function( AttackGroup )
if AttackGroup:IsAlive() == true then if AttackGroup:IsAlive() == true then
local DetectionText = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup ):Text( ", " ) local DetectionText = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup ):Text( ", " )
self.CC:GetPositionable():MessageToGroup( "Targets out of LOS\n" .. DetectionText, 10, AttackGroup, self.DesignateName ) --self.CC:GetPositionable():MessageToGroup( "Targets out of LOS\n" .. DetectionText, 10, AttackGroup, self.DesignateName )
MESSAGE:New("Targets out of LOS\n" .. DetectionText,10,self.DesignateName):ToGroup(AttackGroup)
end end
end end
) )
@@ -855,7 +857,8 @@ do -- DESIGNATE
function( AttackGroup ) function( AttackGroup )
if self.FlashDetectionMessage[AttackGroup] == true then if self.FlashDetectionMessage[AttackGroup] == true then
local DetectionText = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup ):Text( ", " ) local DetectionText = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup ):Text( ", " )
self.CC:GetPositionable():MessageToGroup( "Targets detected at \n" .. DetectionText, 10, AttackGroup, self.DesignateName ) --self.CC:GetPositionable():MessageToGroup( "Targets detected at \n" .. DetectionText, 10, AttackGroup, self.DesignateName )
MESSAGE:New( "Targets detected at \n" .. DetectionText,10,self.DesignateName):ToGroup(AttackGroup)
end end
end end
) )
@@ -929,9 +932,10 @@ do -- DESIGNATE
end end
end end
local CC = self.CC:GetPositionable() -- local CC = self.CC:GetPositionable()
CC:MessageTypeToGroup( DetectedReport:Text( "\n" ), MESSAGE.Type.Information, AttackGroup, self.DesignateName ) --CC:MessageTypeToGroup( DetectedReport:Text( "\n" ), MESSAGE.Type.Information, AttackGroup, self.DesignateName )
MESSAGE:New( DetectedReport:Text( "\n" ),15,self.DesignateName):ToGroup(AttackGroup)
local DesignationReport = REPORT:New( "Marking Targets:" ) local DesignationReport = REPORT:New( "Marking Targets:" )
@@ -965,10 +969,10 @@ do -- DESIGNATE
local MissionMenu = nil local MissionMenu = nil
if self.Mission then --if self.Mission then
--MissionMenu = self.Mission:GetRootMenu( AttackGroup ) --MissionMenu = self.Mission:GetRootMenu( AttackGroup )
MissionMenu = self.Mission:GetMenu( AttackGroup ) --MissionMenu = self.Mission:GetMenu( AttackGroup )
end --end
local MenuTime = timer.getTime() local MenuTime = timer.getTime()
@@ -1357,11 +1361,12 @@ do -- DESIGNATE
-- @return #DESIGNATE -- @return #DESIGNATE
function DESIGNATE:onafterLaseOff( From, Event, To, Index ) function DESIGNATE:onafterLaseOff( From, Event, To, Index )
local CC = self.CC:GetPositionable() MESSAGE:New("Stopped lasing.",5,self.DesignateName):ToSet(self.AttackSet)
--local CC = self.CC:GetPositionable()
if CC then --if CC then
CC:MessageToSetGroup( "Stopped lasing.", 5, self.AttackSet, self.DesignateName ) --CC:MessageToSetGroup( "Stopped lasing.", 5, self.AttackSet, self.DesignateName )
end --end
local DetectedItem = self.Detection:GetDetectedItemByIndex( Index ) local DetectedItem = self.Detection:GetDetectedItemByIndex( Index )
local TargetSetUnit = self.Detection:GetDetectedItemSet( DetectedItem ) local TargetSetUnit = self.Detection:GetDetectedItemSet( DetectedItem )