This commit is contained in:
Applevangelist 2024-09-06 13:40:41 +02:00
parent 4bafdf9408
commit 7d3a0568a9
4 changed files with 23 additions and 8 deletions

View File

@ -3895,10 +3895,14 @@ do -- AI_A2G_DISPATCHER
if Squadron then if Squadron then
local FirstUnit = AttackSetUnit:GetRandomSurely() local FirstUnit = AttackSetUnit:GetRandomSurely()
if FirstUnit then
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
if self.SetSendPlayerMessages then if self.SetSendPlayerMessages then
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", on route to ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup ) Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", on route to ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
end end
else
return
end
end end
self:GetParent(self).onafterEngageRoute( self, DefenderGroup, From, Event, To, AttackSetUnit ) self:GetParent(self).onafterEngageRoute( self, DefenderGroup, From, Event, To, AttackSetUnit )
end end

View File

@ -426,7 +426,12 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
local DefenderCoord = DefenderGroup:GetPointVec3() local DefenderCoord = DefenderGroup:GetPointVec3()
DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude. DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
local TargetCoord = AttackSetUnit:GetRandomSurely():GetPointVec3() local TargetUnit = AttackSetUnit:GetRandomSurely()
local TargetCoord = nil
if TargetUnit then
TargetUnit:GetPointVec3()
end
if TargetCoord == nil then if TargetCoord == nil then
self:Return() self:Return()
@ -522,7 +527,12 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
local DefenderCoord = DefenderGroup:GetPointVec3() local DefenderCoord = DefenderGroup:GetPointVec3()
DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude. DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
local TargetCoord = AttackSetUnit:GetRandomSurely():GetPointVec3() local TargetCoord = nil
local TargetUnit = AttackSetUnit:GetRandomSurely()
if TargetUnit then
TargetCoord=TargetUnit:GetPointVec3()
end
if not TargetCoord then if not TargetCoord then
self:Return() self:Return()
return return

View File

@ -596,6 +596,7 @@ do -- DETECTION_BASE
return self return self
end end
---
-- @param #DETECTION_BASE self -- @param #DETECTION_BASE self
-- @param #string From The From State string. -- @param #string From The From State string.
-- @param #string Event The Event string. -- @param #string Event The Event string.
@ -615,7 +616,7 @@ do -- DETECTION_BASE
self:T( { "DetectionGroup is Alive", Detection:GetName() } ) self:T( { "DetectionGroup is Alive", Detection:GetName() } )
local DetectionGroupName = Detection:GetName() local DetectionGroupName = Detection:GetName()
local DetectionUnit = Detection:GetUnit( 1 ) local DetectionUnit = Detection:GetFirstUnitAlive()
local DetectedUnits = {} local DetectedUnits = {}
@ -632,7 +633,7 @@ do -- DETECTION_BASE
--self:T(UTILS.PrintTableToLog(DetectedTargets)) --self:T(UTILS.PrintTableToLog(DetectedTargets))
for DetectionObjectID, Detection in pairs( DetectedTargets ) do for DetectionObjectID, Detection in pairs( DetectedTargets or {}) do
local DetectedObject = Detection.object -- DCS#Object local DetectedObject = Detection.object -- DCS#Object
if DetectedObject and DetectedObject:isExist() and DetectedObject.id_ < 50000000 then -- and ( DetectedObject:getCategory() == Object.Category.UNIT or DetectedObject:getCategory() == Object.Category.STATIC ) then if DetectedObject and DetectedObject:isExist() and DetectedObject.id_ < 50000000 then -- and ( DetectedObject:getCategory() == Object.Category.UNIT or DetectedObject:getCategory() == Object.Category.STATIC ) then
@ -645,7 +646,7 @@ do -- DETECTION_BASE
end end
end end
for DetectionObjectName, DetectedObjectData in pairs( self.DetectedObjects ) do for DetectionObjectName, DetectedObjectData in pairs( self.DetectedObjects or {}) do
local DetectedObject = DetectedObjectData.Object local DetectedObject = DetectedObjectData.Object

View File

@ -6732,7 +6732,7 @@ end
-- @param Wrapper.Group#GROUP deadgroup Group of unit that died. -- @param Wrapper.Group#GROUP deadgroup Group of unit that died.
-- @param #WAREHOUSE.Pendingitem request Request that needs to be updated. -- @param #WAREHOUSE.Pendingitem request Request that needs to be updated.
function WAREHOUSE:_UnitDead(deadunit, deadgroup, request) function WAREHOUSE:_UnitDead(deadunit, deadgroup, request)
self:F(self.lid.."FF unit dead "..deadunit:GetName()) --self:F(self.lid.."FF unit dead "..deadunit:GetName())
-- Find opsgroup. -- Find opsgroup.
local opsgroup=_DATABASE:FindOpsGroup(deadgroup) local opsgroup=_DATABASE:FindOpsGroup(deadgroup)