Merge pull request #2240 from FlightControl-Master/master

Merge from master
This commit is contained in:
Thomas 2025-02-02 12:54:42 +01:00 committed by GitHub
commit 7cd95377f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1136 additions and 1025 deletions

View File

@ -3152,7 +3152,7 @@ function GROUP:IsSAM()
local units = self:GetUnits() local units = self:GetUnits()
for _,_unit in pairs(units or {}) do for _,_unit in pairs(units or {}) do
local unit = _unit -- Wrapper.Unit#UNIT local unit = _unit -- Wrapper.Unit#UNIT
if unit:HasSEAD() and unit:IsGround() and (not unit:HasAttribute("Mobile AAA")) then if unit:IsSAM() then
issam = true issam = true
break break
end end
@ -3162,18 +3162,16 @@ end
--- [GROUND] Determine if a GROUP has a AAA unit, i.e. has no radar or optical tracker but the AAA = true or the "Mobile AAA" = true attribute. --- [GROUND] Determine if a GROUP has a AAA unit, i.e. has no radar or optical tracker but the AAA = true or the "Mobile AAA" = true attribute.
-- @param #GROUP self -- @param #GROUP self
-- @return #boolean IsSAM True if AAA, else false -- @return #boolean IsAAA True if AAA, else false
function GROUP:IsAAA() function GROUP:IsAAA()
local issam = false local isAAA = false
local units = self:GetUnits() local units = self:GetUnits()
for _,_unit in pairs(units or {}) do for _,_unit in pairs(units or {}) do
local unit = _unit -- Wrapper.Unit#UNIT local unit = _unit -- Wrapper.Unit#UNIT
local desc = unit:GetDesc() or {} if unit:IsAAA() then
local attr = desc.attributes or {} isAAA = true
if unit:HasSEAD() then return false end break
if attr["AAA"] or attr["SAM related"] then
issam = true
end end
end end
return issam return isAAA
end end

File diff suppressed because it is too large Load Diff