mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
First prototype of task dispatching with menu
This commit is contained in:
@@ -296,7 +296,7 @@ function SET_BASE:Add( ObjectName, Object )
|
||||
|
||||
self.List.Count = self.List.Count + 1
|
||||
|
||||
self.Set[ObjectName] = t
|
||||
self.Set[ObjectName] = t._
|
||||
|
||||
end
|
||||
|
||||
@@ -514,7 +514,7 @@ function SET_BASE:ForEach( IteratorFunction, arg, Set, Function, FunctionArgumen
|
||||
local function CoRoutine()
|
||||
local Count = 0
|
||||
for ObjectID, ObjectData in pairs( Set ) do
|
||||
local Object = ObjectData._
|
||||
local Object = ObjectData
|
||||
self:T3( Object )
|
||||
if Function then
|
||||
if Function( unpack( FunctionArguments ), Object ) == true then
|
||||
@@ -1284,6 +1284,32 @@ function SET_UNIT:ForEachUnitNotInZone( ZoneObject, IteratorFunction, ... )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Returns if the @{Set} has targets having a radar (of a given type).
|
||||
-- @param #SET_UNIT self
|
||||
-- @param DCSUnit#Unit.RadarType RadarType
|
||||
-- @return #number The amount of radars in the Set with the given type
|
||||
function SET_UNIT:HasRadar( RadarType )
|
||||
self:F2( RadarType )
|
||||
|
||||
local RadarCount = 0
|
||||
for UnitID, UnitData in pairs( self:GetSet()) do
|
||||
local UnitSensorTest = UnitData -- Unit#UNIT
|
||||
local HasSensors
|
||||
if RadarType then
|
||||
HasSensors = UnitSensorTest:HasSensors( Unit.SensorType.RADAR, RadarType )
|
||||
else
|
||||
HasSensors = UnitSensorTest:HasSensors( Unit.SensorType.RADAR )
|
||||
end
|
||||
self:E(HasSensors)
|
||||
if HasSensors then
|
||||
RadarCount = RadarCount + 1
|
||||
end
|
||||
end
|
||||
|
||||
return RadarCount
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
----- Iterate the SET_UNIT and call an interator function for each **alive** player, providing the Unit of the player and optional parameters.
|
||||
|
||||
Reference in New Issue
Block a user