First prototype of task dispatching with menu

This commit is contained in:
FlightControl
2016-07-08 16:16:48 +02:00
parent 6ba6390b5d
commit 0c13744309
16 changed files with 51775 additions and 162 deletions

View File

@@ -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.