mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
#GROUP
* Added IsSam and IsAAA #SET * Corrected EvalFilterFunctions - all must be true
This commit is contained in:
parent
0347e42fc7
commit
f306361317
@ -171,25 +171,18 @@ do -- SET_BASE
|
||||
--- [Internal] Check if the condition functions returns true.
|
||||
-- @param #SET_BASE self
|
||||
-- @param Wrapper.Controllable#CONTROLLABLE Object The object to filter for
|
||||
-- @return #boolean If true, at least one condition is true.
|
||||
function SET_BASE:_EvalFilterFunctions(Object)
|
||||
|
||||
-- Any one condition must be true.
|
||||
-- @return #boolean If true, if **all** conditions are true
|
||||
function SET_BASE:_EvalFilterFunctions(Object)
|
||||
-- All conditions must be true.
|
||||
for _,_condition in pairs(self.Filter.Functions or {}) do
|
||||
local condition=_condition
|
||||
|
||||
-- Call function.
|
||||
local istrue=condition.func(Object,unpack(condition.arg))
|
||||
|
||||
-- Any true will return true.
|
||||
if istrue then
|
||||
return true
|
||||
if condition.func(Object,unpack(condition.arg)) == false then
|
||||
return false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
-- No condition was true.
|
||||
return false
|
||||
return true
|
||||
end
|
||||
|
||||
--- Clear the Objects in the Set.
|
||||
@ -2049,7 +2042,8 @@ do
|
||||
end
|
||||
|
||||
if self.Filter.Functions then
|
||||
local MGroupFunc = self:_EvalFilterFunctions(MGroup)
|
||||
local MGroupFunc = false
|
||||
MGroupFunc = self:_EvalFilterFunctions(MGroup)
|
||||
MGroupInclude = MGroupInclude and MGroupFunc
|
||||
end
|
||||
|
||||
|
||||
@ -2763,7 +2763,7 @@ end
|
||||
|
||||
--- Switch on/off invisible flag for the group.
|
||||
-- @param #GROUP self
|
||||
-- @param #boolean switch If true, emission is enabled. If false, emission is disabled.
|
||||
-- @param #boolean switch If true, Invisible is enabled. If false, Invisible is disabled.
|
||||
-- @return #GROUP self
|
||||
function GROUP:SetCommandInvisible(switch)
|
||||
self:F2( self.GroupName )
|
||||
@ -2777,7 +2777,7 @@ end
|
||||
|
||||
--- Switch on/off immortal flag for the group.
|
||||
-- @param #GROUP self
|
||||
-- @param #boolean switch If true, emission is enabled. If false, emission is disabled.
|
||||
-- @param #boolean switch If true, Immortal is enabled. If false, Immortal is disabled.
|
||||
-- @return #GROUP self
|
||||
function GROUP:SetCommandImmortal(switch)
|
||||
self:F2( self.GroupName )
|
||||
@ -2983,3 +2983,36 @@ function GROUP:GetGroupSTN()
|
||||
return tSTN,text
|
||||
end
|
||||
|
||||
--- [GROUND] Determine if a GROUP is a SAM unit, i.e. has radar or optical tracker and is no mobile AAA.
|
||||
-- @param #GROUP self
|
||||
-- @return #boolean IsSAM True if SAM, else false
|
||||
function GROUP:IsSAM()
|
||||
local issam = false
|
||||
local units = self:GetUnits()
|
||||
for _,_unit in pairs(units or {}) do
|
||||
local unit = _unit -- Wrapper.Unit#UNIT
|
||||
if unit:HasSEAD() and unit:IsGround() and (not unit:HasAttribute("Mobile AAA")) then
|
||||
issam = true
|
||||
break
|
||||
end
|
||||
end
|
||||
return issam
|
||||
end
|
||||
|
||||
--- [GROUND] Determine if a GROUP is a AAA unit, i.e. has no radar or optical tracker but the AAA = true or the "Mobile AAA" = true attribute.
|
||||
-- @param #GROUP self
|
||||
-- @return #boolean IsSAM True if AAA, else false
|
||||
function GROUP:IsAAA()
|
||||
local issam = true
|
||||
local units = self:GetUnits()
|
||||
for _,_unit in pairs(units or {}) do
|
||||
local unit = _unit -- Wrapper.Unit#UNIT
|
||||
if unit:HasSEAD() or (not unit:IsGround()) then
|
||||
issam = false
|
||||
if unit:HasAttribute("Mobile AAA") then
|
||||
issam = true
|
||||
end
|
||||
end
|
||||
end
|
||||
return issam
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user