diff --git a/Moose Development/Moose/GroupSet.lua b/Moose Development/Moose/GroupSet.lua deleted file mode 100644 index 6ef3e8488..000000000 --- a/Moose Development/Moose/GroupSet.lua +++ /dev/null @@ -1,321 +0,0 @@ ---- Create and manage a set of groups. --- --- @{#GROUPSET} class --- ================== --- Mission designers can use the GROUPSET class to build sets of groups belonging to certain: --- --- * Coalitions --- * Categories --- * Countries --- * Starting with certain prefix strings. --- --- GROUPSET construction methods: --- ================================= --- Create a new GROUPSET object with the @{#GROUPSET.New} method: --- --- * @{#GROUPSET.New}: Creates a new GROUPSET object. --- --- --- GROUPSET filter criteria: --- ========================= --- You can set filter criteria to define the set of groups within the GROUPSET. --- Filter criteria are defined by: --- --- * @{#GROUPSET.FilterCoalitions}: Builds the GROUPSET with the groups belonging to the coalition(s). --- * @{#GROUPSET.FilterCategories}: Builds the GROUPSET with the groups belonging to the category(ies). --- * @{#GROUPSET.FilterCountries}: Builds the GROUPSET with the gruops belonging to the country(ies). --- * @{#GROUPSET.FilterPrefixes}: Builds the GROUPSET with the groups starting with the same prefix string(s). --- --- Once the filter criteria have been set for the GROUPSET, you can start filtering using: --- --- * @{#GROUPSET.FilterStart}: Starts the filtering of the groups within the GROUPSET. --- --- Planned filter criteria within development are (so these are not yet available): --- --- * @{#GROUPSET.FilterZones}: Builds the GROUPSET with the groups within a @{Zone#ZONE}. --- --- --- GROUPSET iterators: --- =================== --- Once the filters have been defined and the GROUPSET has been built, you can iterate the GROUPSET with the available iterator methods. --- The iterator methods will walk the GROUPSET set, and call for each element within the set a function that you provide. --- The following iterator methods are currently available within the GROUPSET: --- --- * @{#GROUPSET.ForEachGroup}: Calls a function for each alive group it finds within the GROUPSET. --- --- @module GroupSet --- @author FlightControl - -Include.File( "Routines" ) -Include.File( "Base" ) -Include.File( "Group" ) -Include.File( "Set" ) - - ---- GROUPSET class --- @type GROUPSET --- @extends Set#SET -GROUPSET = { - ClassName = "GROUPSET", - Filter = { - Coalitions = nil, - Categories = nil, - Countries = nil, - GroupPrefixes = nil, - }, - FilterMeta = { - Coalitions = { - red = coalition.side.RED, - blue = coalition.side.BLUE, - neutral = coalition.side.NEUTRAL, - }, - Categories = { - plane = Group.Category.AIRPLANE, - helicopter = Group.Category.HELICOPTER, - ground = Group.Category.GROUND_UNIT, - ship = Group.Category.SHIP, - structure = Group.Category.STRUCTURE, - }, - }, -} - - ---- Creates a new GROUPSET object, building a set of groups belonging to a coalitions, categories, countries, types or with defined prefix names. --- @param #GROUPSET self --- @return #GROUPSET --- @usage --- -- Define a new GROUPSET Object. This DBObject will contain a reference to all alive GROUPS. --- DBObject = GROUPSET:New() -function GROUPSET:New() - - -- Inherits from BASE - local self = BASE:Inherit( self, SET:New( _DATABASE.GROUPS ) ) - - return self -end - - ---- Finds a Group based on the Group Name. --- @param #GROUPSET self --- @param #string GroupName --- @return Group#GROUP The found Group. -function GROUPSET:FindGroup( GroupName ) - - local GroupFound = self.Set[GroupName] - return GroupFound -end - - - ---- Builds a set of groups of coalitions. --- Possible current coalitions are red, blue and neutral. --- @param #GROUPSET self --- @param #string Coalitions Can take the following values: "red", "blue", "neutral". --- @return #GROUPSET self -function GROUPSET:FilterCoalitions( Coalitions ) - if not self.Filter.Coalitions then - self.Filter.Coalitions = {} - end - if type( Coalitions ) ~= "table" then - Coalitions = { Coalitions } - end - for CoalitionID, Coalition in pairs( Coalitions ) do - self.Filter.Coalitions[Coalition] = Coalition - end - return self -end - - ---- Builds a set of groups out of categories. --- Possible current categories are plane, helicopter, ground, ship. --- @param #GROUPSET self --- @param #string Categories Can take the following values: "plane", "helicopter", "ground", "ship". --- @return #GROUPSET self -function GROUPSET:FilterCategories( Categories ) - if not self.Filter.Categories then - self.Filter.Categories = {} - end - if type( Categories ) ~= "table" then - Categories = { Categories } - end - for CategoryID, Category in pairs( Categories ) do - self.Filter.Categories[Category] = Category - end - return self -end - ---- Builds a set of groups of defined countries. --- Possible current countries are those known within DCS world. --- @param #GROUPSET self --- @param #string Countries Can take those country strings known within DCS world. --- @return #GROUPSET self -function GROUPSET:FilterCountries( Countries ) - if not self.Filter.Countries then - self.Filter.Countries = {} - end - if type( Countries ) ~= "table" then - Countries = { Countries } - end - for CountryID, Country in pairs( Countries ) do - self.Filter.Countries[Country] = Country - end - return self -end - - ---- Builds a set of groups of defined GROUP prefixes. --- All the groups starting with the given prefixes will be included within the set. --- @param #GROUPSET self --- @param #string Prefixes The prefix of which the group name starts with. --- @return #GROUPSET self -function GROUPSET:FilterPrefixes( Prefixes ) - if not self.Filter.GroupPrefixes then - self.Filter.GroupPrefixes = {} - end - if type( Prefixes ) ~= "table" then - Prefixes = { Prefixes } - end - for PrefixID, Prefix in pairs( Prefixes ) do - self.Filter.GroupPrefixes[Prefix] = Prefix - end - return self -end - - ---- Starts the filtering. --- @param #GROUPSET self --- @return #GROUPSET self -function GROUPSET:FilterStart() - - if _DATABASE then - self:_FilterStart() - end - - return self -end - ---- Handles the Database to check on an event (birth) that the Object was added in the Database. --- This is required, because sometimes the _DATABASE birth event gets called later than the SET birth event! --- @param #GROUPSET self --- @param Event#EVENTDATA Event --- @return #string The name of the GROUP --- @return #table The GROUP -function GROUPSET:AddInDatabase( Event ) - self:F3( { Event } ) - - if not self.Database[Event.IniDCSGroupName] then - self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName ) - self:T3( self.Database[Event.IniDCSGroupName] ) - end - - return Event.IniDCSGroupName, self.Database[Event.IniDCSGroupName] -end - ---- Handles the Database to check on any event that Object exists in the Database. --- This is required, because sometimes the _DATABASE event gets called later than the SET event or vise versa! --- @param #GROUPSET self --- @param Event#EVENTDATA Event --- @return #string The name of the GROUP --- @return #table The GROUP -function GROUPSET:FindInDatabase( Event ) - self:F3( { Event } ) - - return Event.IniDCSGroupName, self.Database[Event.IniDCSGroupName] -end - ---- Interate the GROUPSET and call an interator function for each **alive** GROUP, providing the GROUP and optional parameters. --- @param #GROUPSET self --- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the GROUPSET. The function needs to accept a GROUP parameter. --- @return #GROUPSET self -function GROUPSET:ForEachGroup( IteratorFunction, ... ) - self:F2( arg ) - - self:ForEach( IteratorFunction, arg, self.Set ) - - return self -end - - ------ Interate the GROUPSET and call an interator function for each **alive** player, providing the Group of the player and optional parameters. ----- @param #GROUPSET self ----- @param #function IteratorFunction The function that will be called when there is an alive player in the GROUPSET. The function needs to accept a GROUP parameter. ----- @return #GROUPSET self ---function GROUPSET:ForEachPlayer( IteratorFunction, ... ) --- self:F2( arg ) --- --- self:ForEach( IteratorFunction, arg, self.PlayersAlive ) --- --- return self ---end --- --- ------ Interate the GROUPSET and call an interator function for each client, providing the Client to the function and optional parameters. ----- @param #GROUPSET self ----- @param #function IteratorFunction The function that will be called when there is an alive player in the GROUPSET. The function needs to accept a CLIENT parameter. ----- @return #GROUPSET self ---function GROUPSET:ForEachClient( IteratorFunction, ... ) --- self:F2( arg ) --- --- self:ForEach( IteratorFunction, arg, self.Clients ) --- --- return self ---end - - ---- --- @param #GROUPSET self --- @param Group#GROUP MooseGroup --- @return #GROUPSET self -function GROUPSET:IsIncludeObject( MooseGroup ) - self:F2( MooseGroup ) - local MooseGroupInclude = true - - if self.Filter.Coalitions then - local MooseGroupCoalition = false - for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do - self:T3( { "Coalition:", MooseGroup:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } ) - if self.FilterMeta.Coalitions[CoalitionName] and self.FilterMeta.Coalitions[CoalitionName] == MooseGroup:GetCoalition() then - MooseGroupCoalition = true - end - end - MooseGroupInclude = MooseGroupInclude and MooseGroupCoalition - end - - if self.Filter.Categories then - local MooseGroupCategory = false - for CategoryID, CategoryName in pairs( self.Filter.Categories ) do - self:T3( { "Category:", MooseGroup:GetCategory(), self.FilterMeta.Categories[CategoryName], CategoryName } ) - if self.FilterMeta.Categories[CategoryName] and self.FilterMeta.Categories[CategoryName] == MooseGroup:GetCategory() then - MooseGroupCategory = true - end - end - MooseGroupInclude = MooseGroupInclude and MooseGroupCategory - end - - if self.Filter.Countries then - local MooseGroupCountry = false - for CountryID, CountryName in pairs( self.Filter.Countries ) do - self:T3( { "Country:", MooseGroup:GetCountry(), CountryName } ) - if country.id[CountryName] == MooseGroup:GetCountry() then - MooseGroupCountry = true - end - end - MooseGroupInclude = MooseGroupInclude and MooseGroupCountry - end - - if self.Filter.GroupPrefixes then - local MooseGroupPrefix = false - for GroupPrefixId, GroupPrefix in pairs( self.Filter.GroupPrefixes ) do - self:T3( { "Prefix:", string.find( MooseGroup:GetName(), GroupPrefix, 1 ), GroupPrefix } ) - if string.find( MooseGroup:GetName(), GroupPrefix, 1 ) then - MooseGroupPrefix = true - end - end - MooseGroupInclude = MooseGroupInclude and MooseGroupPrefix - end - - self:T2( MooseGroupInclude ) - return MooseGroupInclude -end - - diff --git a/Moose Development/Moose/Scheduler.lua b/Moose Development/Moose/Scheduler.lua index a9bfddb62..259933c68 100644 --- a/Moose Development/Moose/Scheduler.lua +++ b/Moose Development/Moose/Scheduler.lua @@ -121,7 +121,7 @@ function SCHEDULER:_Scheduler() self:T( { Status, Result } ) - if Status and ( ( not Result ) or ( Result and Result ~= false ) ) then + if Status and ( ( not Result == nil ) or ( Result and Result ~= false ) ) then if self.Repeat and ( not self.StopSeconds or ( self.StopSeconds and timer.getTime() <= self.StartTime + self.StopSeconds ) ) then timer.scheduleFunction( self._Scheduler, diff --git a/Moose Development/Moose/Set.lua b/Moose Development/Moose/Set.lua index feff204a4..cdbaccf58 100644 --- a/Moose Development/Moose/Set.lua +++ b/Moose Development/Moose/Set.lua @@ -1,8 +1,60 @@ ---- Manage sets of units and groups. +--- This module contains the SET classes. -- --- @{#Set} class --- ================== --- Mission designers can use the SET class to build sets of units belonging to certain: +-- === +-- +-- 1) @{Set#SET_BASE} class, extending @{Base#BASE} +-- ================================================ +-- The @{Set#SET_BASE} class defines the core functions that define a collection of objects. +-- +-- === +-- +-- 2) @{Set#SET_GROUP} class, extending @{Set#SET_BASE} +-- ==================================================== +-- Mission designers can use the @{Set#SET_GROUP} class to build sets of groups belonging to certain: +-- +-- * Coalitions +-- * Categories +-- * Countries +-- * Starting with certain prefix strings. +-- +-- 2.1) SET_GROUP construction methods: +-- ------------------------------------ +-- Create a new SET_GROUP object with the @{#SET_GROUP.New} method: +-- +-- * @{#SET_GROUP.New}: Creates a new SET_GROUP object. +-- +-- 2.2) SET_GROUP filter criteria: +-- ------------------------------- +-- You can set filter criteria to define the set of groups within the SET_GROUP. +-- Filter criteria are defined by: +-- +-- * @{#SET_GROUP.FilterCoalitions}: Builds the SET_GROUP with the groups belonging to the coalition(s). +-- * @{#SET_GROUP.FilterCategories}: Builds the SET_GROUP with the groups belonging to the category(ies). +-- * @{#SET_GROUP.FilterCountries}: Builds the SET_GROUP with the gruops belonging to the country(ies). +-- * @{#SET_GROUP.FilterPrefixes}: Builds the SET_GROUP with the groups starting with the same prefix string(s). +-- +-- Once the filter criteria have been set for the SET_GROUP, you can start filtering using: +-- +-- * @{#SET_GROUP.FilterStart}: Starts the filtering of the groups within the SET_GROUP. +-- +-- Planned filter criteria within development are (so these are not yet available): +-- +-- * @{#SET_GROUP.FilterZones}: Builds the SET_GROUP with the groups within a @{Zone#ZONE}. +-- +-- +-- 2.3) SET_GROUP iterators: +-- ------------------------- +-- Once the filters have been defined and the SET_GROUP has been built, you can iterate the SET_GROUP with the available iterator methods. +-- The iterator methods will walk the SET_GROUP set, and call for each element within the set a function that you provide. +-- The following iterator methods are currently available within the SET_GROUP: +-- +-- * @{#SET_GROUP.ForEachGroup}: Calls a function for each alive group it finds within the SET_GROUP. +-- +-- ==== +-- +-- 3) @{Set#SET_UNIT} class, extending @{Set#SET_BASE} +-- =================================================== +-- Mission designers can use the @{Set#SET_UNIT} class to build sets of units belonging to certain: -- -- * Coalitions -- * Categories @@ -10,55 +62,48 @@ -- * Unit types -- * Starting with certain prefix strings. -- --- This list will grow over time. Planned developments are to include filters and iterators. --- Additional filters will be added around @{Zone#ZONEs}, Radiuses, Active players, ... --- More iterators will be implemented in the near future ... --- --- Administers the Initial Sets of the Mission Templates as defined within the Mission Editor. +-- 3.1) SET_UNIT construction methods: +-- ----------------------------------- +-- Create a new SET_UNIT object with the @{#SET_UNIT.New} method: -- --- SET construction methods: --- ================================= --- Create a new SET object with the @{#SET.New} method: --- --- * @{#SET.New}: Creates a new SET object. +-- * @{#SET_UNIT.New}: Creates a new SET_UNIT object. -- -- --- SET filter criteria: --- ========================= --- You can set filter criteria to define the set of units within the SET. +-- 3.2) SET_UNIT filter criteria: +-- ------------------------------ +-- You can set filter criteria to define the set of units within the SET_UNIT. -- Filter criteria are defined by: -- --- * @{#SET.FilterCoalitions}: Builds the SET with the units belonging to the coalition(s). --- * @{#SET.FilterCategories}: Builds the SET with the units belonging to the category(ies). --- * @{#SET.FilterTypes}: Builds the SET with the units belonging to the unit type(s). --- * @{#SET.FilterCountries}: Builds the SET with the units belonging to the country(ies). --- * @{#SET.FilterUnitPrefixes}: Builds the SET with the units starting with the same prefix string(s). +-- * @{#SET_UNIT.FilterCoalitions}: Builds the SET_UNIT with the units belonging to the coalition(s). +-- * @{#SET_UNIT.FilterCategories}: Builds the SET_UNIT with the units belonging to the category(ies). +-- * @{#SET_UNIT.FilterTypes}: Builds the SET_UNIT with the units belonging to the unit type(s). +-- * @{#SET_UNIT.FilterCountries}: Builds the SET_UNIT with the units belonging to the country(ies). +-- * @{#SET_UNIT.FilterPrefixes}: Builds the SET_UNIT with the units starting with the same prefix string(s). -- --- Once the filter criteria have been set for the SET, you can start filtering using: +-- Once the filter criteria have been set for the SET_UNIT, you can start filtering using: -- --- * @{#SET.FilterStart}: Starts the filtering of the units within the SET. +-- * @{#SET_UNIT.FilterStart}: Starts the filtering of the units within the SET_UNIT. -- -- Planned filter criteria within development are (so these are not yet available): -- --- * @{#SET.FilterGroupPrefixes}: Builds the SET with the groups of the units starting with the same prefix string(s). --- * @{#SET.FilterZones}: Builds the SET with the units within a @{Zone#ZONE}. +-- * @{#SET_UNIT.FilterZones}: Builds the SET_UNIT with the units within a @{Zone#ZONE}. -- +-- 3.3) SET_UNIT iterators: +-- ------------------------ +-- Once the filters have been defined and the SET_UNIT has been built, you can iterate the SET_UNIT with the available iterator methods. +-- The iterator methods will walk the SET_UNIT set, and call for each element within the set a function that you provide. +-- The following iterator methods are currently available within the SET_UNIT: -- --- SET iterators: --- =================== --- Once the filters have been defined and the SET has been built, you can iterate the SET with the available iterator methods. --- The iterator methods will walk the SET set, and call for each element within the set a function that you provide. --- The following iterator methods are currently available within the SET: --- --- * @{#SET.ForEachAliveUnit}: Calls a function for each alive unit it finds within the SET. +-- * @{#SET_UNIT.ForEachUnit}: Calls a function for each alive unit it finds within the SET_UNIT. -- -- Planned iterators methods in development are (so these are not yet available): -- --- * @{#SET.ForEachUnit}: Calls a function for each unit contained within the SET. --- * @{#SET.ForEachGroup}: Calls a function for each group contained within the SET. --- * @{#SET.ForEachUnitInZone}: Calls a function for each unit within a certain zone contained within the SET. +-- * @{#SET_UNIT.ForEachUnitInGroup}: Calls a function for each group contained within the SET_UNIT. +-- * @{#SET_UNIT.ForEachUnitInZone}: Calls a function for each unit within a certain zone contained within the SET_UNIT. +-- -- -- ==== +-- -- @module Set -- @author FlightControl @@ -70,22 +115,22 @@ Include.File( "Unit" ) Include.File( "Event" ) Include.File( "Client" ) ---- SET class --- @type SET +--- SET_BASE class +-- @type SET_BASE -- @extends Base#BASE -SET = { - ClassName = "SET", +SET_BASE = { + ClassName = "SET_BASE", Set = {}, Database = {}, } ---- Creates a new SET object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names. --- @param #SET self --- @return #SET +--- Creates a new SET_BASE object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names. +-- @param #SET_BASE self +-- @return #SET_BASE -- @usage --- -- Define a new SET Object. This DBObject will contain a reference to all Group and Unit Templates defined within the ME and the DCSRTE. --- DBObject = SET:New() -function SET:New( Database ) +-- -- Define a new SET_BASE Object. This DBObject will contain a reference to all Group and Unit Templates defined within the ME and the DCSRTE. +-- DBObject = SET_BASE:New() +function SET_BASE:New( Database ) -- Inherits from BASE local self = BASE:Inherit( self, BASE:New() ) @@ -96,29 +141,29 @@ function SET:New( Database ) end --- Finds an Object based on the Object Name. --- @param #SET self +-- @param #SET_BASE self -- @param #string ObjectName -- @return #table The Object found. -function SET:_Find( ObjectName ) +function SET_BASE:_Find( ObjectName ) local ObjectFound = self.Set[ObjectName] return ObjectFound end --- Adds a Object based on the Object Name. --- @param #SET self +-- @param #SET_BASE self -- @param #string ObjectName -- @param #table Object -- @return #table The added Object. -function SET:_Add( ObjectName, Object ) +function SET_BASE:_Add( ObjectName, Object ) self.Set[ObjectName] = Object end --- Starts the filtering for the defined collection. --- @param #SET self --- @return #SET self -function SET:_FilterStart() +-- @param #SET_BASE self +-- @return #SET_BASE self +function SET_BASE:_FilterStart() for ObjectName, Object in pairs( self.Database ) do @@ -143,9 +188,9 @@ end ----- Private method that registers all alive players in the mission. ----- @param #SET self ----- @return #SET self ---function SET:_RegisterPlayers() +---- @param #SET_BASE self +---- @return #SET_BASE self +--function SET_BASE:_RegisterPlayers() -- -- local CoalitionsData = { AlivePlayersRed = coalition.getPlayers( coalition.side.RED ), AlivePlayersBlue = coalition.getPlayers( coalition.side.BLUE ) } -- for CoalitionId, CoalitionData in pairs( CoalitionsData ) do @@ -167,9 +212,9 @@ end --- Events --- Handles the OnBirth event for the Set. --- @param #SET self +-- @param #SET_BASE self -- @param Event#EVENTDATA Event -function SET:_EventOnBirth( Event ) +function SET_BASE:_EventOnBirth( Event ) self:F3( { Event } ) if Event.IniDCSUnit then @@ -183,9 +228,9 @@ function SET:_EventOnBirth( Event ) end --- Handles the OnDead or OnCrash event for alive units set. --- @param #SET self +-- @param #SET_BASE self -- @param Event#EVENTDATA Event -function SET:_EventOnDeadOrCrash( Event ) +function SET_BASE:_EventOnDeadOrCrash( Event ) self:F3( { Event } ) if Event.IniDCSUnit then @@ -197,9 +242,9 @@ function SET:_EventOnDeadOrCrash( Event ) end ----- Handles the OnPlayerEnterUnit event to fill the active players table (with the unit filter applied). ----- @param #SET self +---- @param #SET_BASE self ---- @param Event#EVENTDATA Event ---function SET:_EventOnPlayerEnterUnit( Event ) +--function SET_BASE:_EventOnPlayerEnterUnit( Event ) -- self:F3( { Event } ) -- -- if Event.IniDCSUnit then @@ -214,9 +259,9 @@ end --end -- ----- Handles the OnPlayerLeaveUnit event to clean the active players table. ----- @param #SET self +---- @param #SET_BASE self ---- @param Event#EVENTDATA Event ---function SET:_EventOnPlayerLeaveUnit( Event ) +--function SET_BASE:_EventOnPlayerLeaveUnit( Event ) -- self:F3( { Event } ) -- -- if Event.IniDCSUnit then @@ -230,20 +275,22 @@ end -- end --end ---- Iterators +-- Iterators ---- Interate the SET and call an interator function for the given set, providing the Object for each element within the set and optional parameters. --- @param #SET self --- @param #function IteratorFunction The function that will be called when there is an alive player in the SET. --- @return #SET self -function SET:ForEach( IteratorFunction, arg, Set ) +--- Interate the SET_BASE and call an interator function for the given set, providing the Object for each element within the set and optional parameters. +-- @param #SET_BASE self +-- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_BASE. +-- @return #SET_BASE self +function SET_BASE:ForEach( IteratorFunction, arg, Set, Function, FunctionArguments ) self:F3( arg ) local function CoRoutine() local Count = 0 for ObjectID, Object in pairs( Set ) do self:T2( Object ) - IteratorFunction( Object, unpack( arg ) ) + if Function( unpack( FunctionArguments ), Object ) == true then + IteratorFunction( Object, unpack( arg ) ) + end Count = Count + 1 if Count % 10 == 0 then coroutine.yield( false ) @@ -275,11 +322,11 @@ function SET:ForEach( IteratorFunction, arg, Set ) end ------ Interate the SET and call an interator function for each **alive** unit, providing the Unit and optional parameters. ----- @param #SET self ----- @param #function IteratorFunction The function that will be called when there is an alive unit in the SET. The function needs to accept a UNIT parameter. ----- @return #SET self ---function SET:ForEachDCSUnitAlive( IteratorFunction, ... ) +----- Interate the SET_BASE and call an interator function for each **alive** unit, providing the Unit and optional parameters. +---- @param #SET_BASE self +---- @param #function IteratorFunction The function that will be called when there is an alive unit in the SET_BASE. The function needs to accept a UNIT parameter. +---- @return #SET_BASE self +--function SET_BASE:ForEachDCSUnitAlive( IteratorFunction, ... ) -- self:F3( arg ) -- -- self:ForEach( IteratorFunction, arg, self.DCSUnitsAlive ) @@ -287,11 +334,11 @@ end -- return self --end -- ------ Interate the SET and call an interator function for each **alive** player, providing the Unit of the player and optional parameters. ----- @param #SET self ----- @param #function IteratorFunction The function that will be called when there is an alive player in the SET. The function needs to accept a UNIT parameter. ----- @return #SET self ---function SET:ForEachPlayer( IteratorFunction, ... ) +----- Interate the SET_BASE and call an interator function for each **alive** player, providing the Unit of the player and optional parameters. +---- @param #SET_BASE self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_BASE. The function needs to accept a UNIT parameter. +---- @return #SET_BASE self +--function SET_BASE:ForEachPlayer( IteratorFunction, ... ) -- self:F3( arg ) -- -- self:ForEach( IteratorFunction, arg, self.PlayersAlive ) @@ -300,11 +347,11 @@ end --end -- -- ------ Interate the SET and call an interator function for each client, providing the Client to the function and optional parameters. ----- @param #SET self ----- @param #function IteratorFunction The function that will be called when there is an alive player in the SET. The function needs to accept a CLIENT parameter. ----- @return #SET self ---function SET:ForEachClient( IteratorFunction, ... ) +----- Interate the SET_BASE and call an interator function for each client, providing the Client to the function and optional parameters. +---- @param #SET_BASE self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_BASE. The function needs to accept a CLIENT parameter. +---- @return #SET_BASE self +--function SET_BASE:ForEachClient( IteratorFunction, ... ) -- self:F3( arg ) -- -- self:ForEach( IteratorFunction, arg, self.Clients ) @@ -314,19 +361,19 @@ end --- Decides whether to include the Object --- @param #SET self +-- @param #SET_BASE self -- @param #table Object --- @return #SET self -function SET:IsIncludeObject( Object ) +-- @return #SET_BASE self +function SET_BASE:IsIncludeObject( Object ) self:F3( Object ) return true end ---- Flushes the current SET contents in the log ... (for debug reasons). --- @param #SET self +--- Flushes the current SET_BASE contents in the log ... (for debug reasons). +-- @param #SET_BASE self -- @return #string A string with the names of the objects. -function SET:Flush() +function SET_BASE:Flush() self:F3() local ObjectNames = "" @@ -338,4 +385,638 @@ function SET:Flush() return ObjectNames end +-- SET_GROUP + +--- SET_GROUP class +-- @type SET_GROUP +-- @extends Set#SET_BASE +SET_GROUP = { + ClassName = "SET_GROUP", + Filter = { + Coalitions = nil, + Categories = nil, + Countries = nil, + GroupPrefixes = nil, + }, + FilterMeta = { + Coalitions = { + red = coalition.side.RED, + blue = coalition.side.BLUE, + neutral = coalition.side.NEUTRAL, + }, + Categories = { + plane = Group.Category.AIRPLANE, + helicopter = Group.Category.HELICOPTER, + ground = Group.Category.GROUND_UNIT, + ship = Group.Category.SHIP, + structure = Group.Category.STRUCTURE, + }, + }, +} + + +--- Creates a new SET_GROUP object, building a set of groups belonging to a coalitions, categories, countries, types or with defined prefix names. +-- @param #SET_GROUP self +-- @return #SET_GROUP +-- @usage +-- -- Define a new SET_GROUP Object. This DBObject will contain a reference to all alive GROUPS. +-- DBObject = SET_GROUP:New() +function SET_GROUP:New() + + -- Inherits from BASE + local self = BASE:Inherit( self, SET_BASE:New( _DATABASE.GROUPS ) ) + + return self +end + + +--- Finds a Group based on the Group Name. +-- @param #SET_GROUP self +-- @param #string GroupName +-- @return Group#GROUP The found Group. +function SET_GROUP:FindGroup( GroupName ) + + local GroupFound = self.Set[GroupName] + return GroupFound +end + + + +--- Builds a set of groups of coalitions. +-- Possible current coalitions are red, blue and neutral. +-- @param #SET_GROUP self +-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". +-- @return #SET_GROUP self +function SET_GROUP:FilterCoalitions( Coalitions ) + if not self.Filter.Coalitions then + self.Filter.Coalitions = {} + end + if type( Coalitions ) ~= "table" then + Coalitions = { Coalitions } + end + for CoalitionID, Coalition in pairs( Coalitions ) do + self.Filter.Coalitions[Coalition] = Coalition + end + return self +end + + +--- Builds a set of groups out of categories. +-- Possible current categories are plane, helicopter, ground, ship. +-- @param #SET_GROUP self +-- @param #string Categories Can take the following values: "plane", "helicopter", "ground", "ship". +-- @return #SET_GROUP self +function SET_GROUP:FilterCategories( Categories ) + if not self.Filter.Categories then + self.Filter.Categories = {} + end + if type( Categories ) ~= "table" then + Categories = { Categories } + end + for CategoryID, Category in pairs( Categories ) do + self.Filter.Categories[Category] = Category + end + return self +end + +--- Builds a set of groups of defined countries. +-- Possible current countries are those known within DCS world. +-- @param #SET_GROUP self +-- @param #string Countries Can take those country strings known within DCS world. +-- @return #SET_GROUP self +function SET_GROUP:FilterCountries( Countries ) + if not self.Filter.Countries then + self.Filter.Countries = {} + end + if type( Countries ) ~= "table" then + Countries = { Countries } + end + for CountryID, Country in pairs( Countries ) do + self.Filter.Countries[Country] = Country + end + return self +end + + +--- Builds a set of groups of defined GROUP prefixes. +-- All the groups starting with the given prefixes will be included within the set. +-- @param #SET_GROUP self +-- @param #string Prefixes The prefix of which the group name starts with. +-- @return #SET_GROUP self +function SET_GROUP:FilterPrefixes( Prefixes ) + if not self.Filter.GroupPrefixes then + self.Filter.GroupPrefixes = {} + end + if type( Prefixes ) ~= "table" then + Prefixes = { Prefixes } + end + for PrefixID, Prefix in pairs( Prefixes ) do + self.Filter.GroupPrefixes[Prefix] = Prefix + end + return self +end + + +--- Starts the filtering. +-- @param #SET_GROUP self +-- @return #SET_GROUP self +function SET_GROUP:FilterStart() + + if _DATABASE then + self:_FilterStart() + end + + return self +end + +--- Handles the Database to check on an event (birth) that the Object was added in the Database. +-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event! +-- @param #SET_GROUP self +-- @param Event#EVENTDATA Event +-- @return #string The name of the GROUP +-- @return #table The GROUP +function SET_GROUP:AddInDatabase( Event ) + self:F3( { Event } ) + + if not self.Database[Event.IniDCSGroupName] then + self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName ) + self:T3( self.Database[Event.IniDCSGroupName] ) + end + + return Event.IniDCSGroupName, self.Database[Event.IniDCSGroupName] +end + +--- Handles the Database to check on any event that Object exists in the Database. +-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa! +-- @param #SET_GROUP self +-- @param Event#EVENTDATA Event +-- @return #string The name of the GROUP +-- @return #table The GROUP +function SET_GROUP:FindInDatabase( Event ) + self:F3( { Event } ) + + return Event.IniDCSGroupName, self.Database[Event.IniDCSGroupName] +end + +--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP, providing the GROUP and optional parameters. +-- @param #SET_GROUP self +-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter. +-- @return #SET_GROUP self +function SET_GROUP:ForEachGroup( IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set ) + + return self +end + +--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence completely in a @{Zone}, providing the GROUP and optional parameters to the called function. +-- @param #SET_GROUP self +-- @param Zone#ZONE ZoneObject The Zone to be tested for. +-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter. +-- @return #SET_GROUP self +function SET_GROUP:ForEachGroupCompletelyInZone( ZoneObject, IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set, + --- @param Zone#ZONE_BASE ZoneObject + -- @param Group#GROUP GroupObject + function( ZoneObject, GroupObject ) + if GroupObject:IsCompletelyInZone( ZoneObject ) then + return true + else + return false + end + end, { ZoneObject } ) + + return self +end + +--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence partly in a @{Zone}, providing the GROUP and optional parameters to the called function. +-- @param #SET_GROUP self +-- @param Zone#ZONE ZoneObject The Zone to be tested for. +-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter. +-- @return #SET_GROUP self +function SET_GROUP:ForEachGroupPartlyInZone( ZoneObject, IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set, + --- @param Zone#ZONE_BASE ZoneObject + -- @param Group#GROUP GroupObject + function( ZoneObject, GroupObject ) + if GroupObject:IsPartlyInZone( ZoneObject ) then + return true + else + return false + end + end, { ZoneObject } ) + + return self +end + +--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence not in a @{Zone}, providing the GROUP and optional parameters to the called function. +-- @param #SET_GROUP self +-- @param Zone#ZONE ZoneObject The Zone to be tested for. +-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter. +-- @return #SET_GROUP self +function SET_GROUP:ForEachGroupNotInZone( ZoneObject, IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set, + --- @param Zone#ZONE_BASE ZoneObject + -- @param Group#GROUP GroupObject + function( ZoneObject, GroupObject ) + if GroupObject:IsNotInZone( ZoneObject ) then + return true + else + return false + end + end, { ZoneObject } ) + + return self +end + + +----- Interate the SET_GROUP and call an interator function for each **alive** player, providing the Group of the player and optional parameters. +---- @param #SET_GROUP self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_GROUP. The function needs to accept a GROUP parameter. +---- @return #SET_GROUP self +--function SET_GROUP:ForEachPlayer( IteratorFunction, ... ) +-- self:F2( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.PlayersAlive ) +-- +-- return self +--end +-- +-- +----- Interate the SET_GROUP and call an interator function for each client, providing the Client to the function and optional parameters. +---- @param #SET_GROUP self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_GROUP. The function needs to accept a CLIENT parameter. +---- @return #SET_GROUP self +--function SET_GROUP:ForEachClient( IteratorFunction, ... ) +-- self:F2( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.Clients ) +-- +-- return self +--end + + +--- +-- @param #SET_GROUP self +-- @param Group#GROUP MooseGroup +-- @return #SET_GROUP self +function SET_GROUP:IsIncludeObject( MooseGroup ) + self:F2( MooseGroup ) + local MooseGroupInclude = true + + if self.Filter.Coalitions then + local MooseGroupCoalition = false + for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do + self:T3( { "Coalition:", MooseGroup:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } ) + if self.FilterMeta.Coalitions[CoalitionName] and self.FilterMeta.Coalitions[CoalitionName] == MooseGroup:GetCoalition() then + MooseGroupCoalition = true + end + end + MooseGroupInclude = MooseGroupInclude and MooseGroupCoalition + end + + if self.Filter.Categories then + local MooseGroupCategory = false + for CategoryID, CategoryName in pairs( self.Filter.Categories ) do + self:T3( { "Category:", MooseGroup:GetCategory(), self.FilterMeta.Categories[CategoryName], CategoryName } ) + if self.FilterMeta.Categories[CategoryName] and self.FilterMeta.Categories[CategoryName] == MooseGroup:GetCategory() then + MooseGroupCategory = true + end + end + MooseGroupInclude = MooseGroupInclude and MooseGroupCategory + end + + if self.Filter.Countries then + local MooseGroupCountry = false + for CountryID, CountryName in pairs( self.Filter.Countries ) do + self:T3( { "Country:", MooseGroup:GetCountry(), CountryName } ) + if country.id[CountryName] == MooseGroup:GetCountry() then + MooseGroupCountry = true + end + end + MooseGroupInclude = MooseGroupInclude and MooseGroupCountry + end + + if self.Filter.GroupPrefixes then + local MooseGroupPrefix = false + for GroupPrefixId, GroupPrefix in pairs( self.Filter.GroupPrefixes ) do + self:T3( { "Prefix:", string.find( MooseGroup:GetName(), GroupPrefix, 1 ), GroupPrefix } ) + if string.find( MooseGroup:GetName(), GroupPrefix, 1 ) then + MooseGroupPrefix = true + end + end + MooseGroupInclude = MooseGroupInclude and MooseGroupPrefix + end + + self:T2( MooseGroupInclude ) + return MooseGroupInclude +end + +--- SET_UNIT class +-- @type SET_UNIT +-- @extends Set#SET_BASE +SET_UNIT = { + ClassName = "SET_UNIT", + Units = {}, + Filter = { + Coalitions = nil, + Categories = nil, + Types = nil, + Countries = nil, + UnitPrefixes = nil, + }, + FilterMeta = { + Coalitions = { + red = coalition.side.RED, + blue = coalition.side.BLUE, + neutral = coalition.side.NEUTRAL, + }, + Categories = { + plane = Unit.Category.AIRPLANE, + helicopter = Unit.Category.HELICOPTER, + ground = Unit.Category.GROUND_UNIT, + ship = Unit.Category.SHIP, + structure = Unit.Category.STRUCTURE, + }, + }, +} + + +--- Creates a new SET_UNIT object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names. +-- @param #SET_UNIT self +-- @return #SET_UNIT +-- @usage +-- -- Define a new SET_UNIT Object. This DBObject will contain a reference to all alive Units. +-- DBObject = SET_UNIT:New() +function SET_UNIT:New() + + -- Inherits from BASE + local self = BASE:Inherit( self, SET_BASE:New( _DATABASE.UNITS ) ) + + return self +end + + +--- Finds a Unit based on the Unit Name. +-- @param #SET_UNIT self +-- @param #string UnitName +-- @return Unit#UNIT The found Unit. +function SET_UNIT:FindUnit( UnitName ) + + local UnitFound = self.Set[UnitName] + return UnitFound +end + + + +--- Builds a set of units of coalitions. +-- Possible current coalitions are red, blue and neutral. +-- @param #SET_UNIT self +-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". +-- @return #SET_UNIT self +function SET_UNIT:FilterCoalitions( Coalitions ) + if not self.Filter.Coalitions then + self.Filter.Coalitions = {} + end + if type( Coalitions ) ~= "table" then + Coalitions = { Coalitions } + end + for CoalitionID, Coalition in pairs( Coalitions ) do + self.Filter.Coalitions[Coalition] = Coalition + end + return self +end + + +--- Builds a set of units out of categories. +-- Possible current categories are plane, helicopter, ground, ship. +-- @param #SET_UNIT self +-- @param #string Categories Can take the following values: "plane", "helicopter", "ground", "ship". +-- @return #SET_UNIT self +function SET_UNIT:FilterCategories( Categories ) + if not self.Filter.Categories then + self.Filter.Categories = {} + end + if type( Categories ) ~= "table" then + Categories = { Categories } + end + for CategoryID, Category in pairs( Categories ) do + self.Filter.Categories[Category] = Category + end + return self +end + + +--- Builds a set of units of defined unit types. +-- Possible current types are those types known within DCS world. +-- @param #SET_UNIT self +-- @param #string Types Can take those type strings known within DCS world. +-- @return #SET_UNIT self +function SET_UNIT:FilterTypes( Types ) + if not self.Filter.Types then + self.Filter.Types = {} + end + if type( Types ) ~= "table" then + Types = { Types } + end + for TypeID, Type in pairs( Types ) do + self.Filter.Types[Type] = Type + end + return self +end + + +--- Builds a set of units of defined countries. +-- Possible current countries are those known within DCS world. +-- @param #SET_UNIT self +-- @param #string Countries Can take those country strings known within DCS world. +-- @return #SET_UNIT self +function SET_UNIT:FilterCountries( Countries ) + if not self.Filter.Countries then + self.Filter.Countries = {} + end + if type( Countries ) ~= "table" then + Countries = { Countries } + end + for CountryID, Country in pairs( Countries ) do + self.Filter.Countries[Country] = Country + end + return self +end + + +--- Builds a set of units of defined unit prefixes. +-- All the units starting with the given prefixes will be included within the set. +-- @param #SET_UNIT self +-- @param #string Prefixes The prefix of which the unit name starts with. +-- @return #SET_UNIT self +function SET_UNIT:FilterPrefixes( Prefixes ) + if not self.Filter.UnitPrefixes then + self.Filter.UnitPrefixes = {} + end + if type( Prefixes ) ~= "table" then + Prefixes = { Prefixes } + end + for PrefixID, Prefix in pairs( Prefixes ) do + self.Filter.UnitPrefixes[Prefix] = Prefix + end + return self +end + + + + +--- Starts the filtering. +-- @param #SET_UNIT self +-- @return #SET_UNIT self +function SET_UNIT:FilterStart() + + if _DATABASE then + self:_FilterStart() + end + + return self +end + +--- Handles the Database to check on an event (birth) that the Object was added in the Database. +-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event! +-- @param #SET_UNIT self +-- @param Event#EVENTDATA Event +-- @return #string The name of the UNIT +-- @return #table The UNIT +function SET_UNIT:AddInDatabase( Event ) + self:F3( { Event } ) + + if not self.Database[Event.IniDCSUnitName] then + self.Database[Event.IniDCSUnitName] = UNIT:Register( Event.IniDCSUnitName ) + self:T3( self.Database[Event.IniDCSUnitName] ) + end + + return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] +end + +--- Handles the Database to check on any event that Object exists in the Database. +-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa! +-- @param #SET_UNIT self +-- @param Event#EVENTDATA Event +-- @return #string The name of the UNIT +-- @return #table The UNIT +function SET_UNIT:FindInDatabase( Event ) + self:F3( { Event } ) + + return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] +end + +--- Interate the SET_UNIT and call an interator function for each **alive** UNIT, providing the UNIT and optional parameters. +-- @param #SET_UNIT self +-- @param #function IteratorFunction The function that will be called when there is an alive UNIT in the SET_UNIT. The function needs to accept a UNIT parameter. +-- @return #SET_UNIT self +function SET_UNIT:ForEachUnit( IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set ) + + return self +end + + +----- Interate the SET_UNIT and call an interator function for each **alive** player, providing the Unit of the player and optional parameters. +---- @param #SET_UNIT self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_UNIT. The function needs to accept a UNIT parameter. +---- @return #SET_UNIT self +--function SET_UNIT:ForEachPlayer( IteratorFunction, ... ) +-- self:F2( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.PlayersAlive ) +-- +-- return self +--end +-- +-- +----- Interate the SET_UNIT and call an interator function for each client, providing the Client to the function and optional parameters. +---- @param #SET_UNIT self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_UNIT. The function needs to accept a CLIENT parameter. +---- @return #SET_UNIT self +--function SET_UNIT:ForEachClient( IteratorFunction, ... ) +-- self:F2( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.Clients ) +-- +-- return self +--end + + +--- +-- @param #SET_UNIT self +-- @param Unit#UNIT MUnit +-- @return #SET_UNIT self +function SET_UNIT:IsIncludeObject( MUnit ) + self:F2( MUnit ) + local MUnitInclude = true + + if self.Filter.Coalitions then + local MUnitCoalition = false + for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do + self:T3( { "Coalition:", MUnit:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } ) + if self.FilterMeta.Coalitions[CoalitionName] and self.FilterMeta.Coalitions[CoalitionName] == MUnit:GetCoalition() then + MUnitCoalition = true + end + end + MUnitInclude = MUnitInclude and MUnitCoalition + end + + if self.Filter.Categories then + local MUnitCategory = false + for CategoryID, CategoryName in pairs( self.Filter.Categories ) do + self:T3( { "Category:", MUnit:GetDesc().category, self.FilterMeta.Categories[CategoryName], CategoryName } ) + if self.FilterMeta.Categories[CategoryName] and self.FilterMeta.Categories[CategoryName] == MUnit:GetDesc().category then + MUnitCategory = true + end + end + MUnitInclude = MUnitInclude and MUnitCategory + end + + if self.Filter.Types then + local MUnitType = false + for TypeID, TypeName in pairs( self.Filter.Types ) do + self:T3( { "Type:", MUnit:GetTypeName(), TypeName } ) + if TypeName == MUnit:GetTypeName() then + MUnitType = true + end + end + MUnitInclude = MUnitInclude and MUnitType + end + + if self.Filter.Countries then + local MUnitCountry = false + for CountryID, CountryName in pairs( self.Filter.Countries ) do + self:T3( { "Country:", MUnit:GetCountry(), CountryName } ) + if country.id[CountryName] == MUnit:GetCountry() then + MUnitCountry = true + end + end + MUnitInclude = MUnitInclude and MUnitCountry + end + + if self.Filter.UnitPrefixes then + local MUnitPrefix = false + for UnitPrefixId, UnitPrefix in pairs( self.Filter.UnitPrefixes ) do + self:T3( { "Prefix:", string.find( MUnit:GetName(), UnitPrefix, 1 ), UnitPrefix } ) + if string.find( MUnit:GetName(), UnitPrefix, 1 ) then + MUnitPrefix = true + end + end + MUnitInclude = MUnitInclude and MUnitPrefix + end + + self:T2( MUnitInclude ) + return MUnitInclude +end diff --git a/Moose Development/Moose/Spawn.lua b/Moose Development/Moose/Spawn.lua index e8dc4fca7..93715afe6 100644 --- a/Moose Development/Moose/Spawn.lua +++ b/Moose Development/Moose/Spawn.lua @@ -473,7 +473,6 @@ function SPAWN:SpawnWithIndex( SpawnIndex ) end self.SpawnGroups[self.SpawnIndex].Spawned = true - return self.SpawnGroups[self.SpawnIndex].Group else --self:E( { self.SpawnTemplatePrefix, "No more Groups to Spawn:", SpawnIndex, self.SpawnMaxGroups } ) diff --git a/Moose Development/Moose/UnitSet.lua b/Moose Development/Moose/UnitSet.lua deleted file mode 100644 index 5bd542727..000000000 --- a/Moose Development/Moose/UnitSet.lua +++ /dev/null @@ -1,363 +0,0 @@ ---- Create and manage a set of units. --- --- @{#UNITSET} class --- ================== --- Mission designers can use the UNITSET class to build sets of units belonging to certain: --- --- * Coalitions --- * Categories --- * Countries --- * Unit types --- * Starting with certain prefix strings. --- --- UNITSET construction methods: --- ================================= --- Create a new UNITSET object with the @{#UNITSET.New} method: --- --- * @{#UNITSET.New}: Creates a new UNITSET object. --- --- --- UNITSET filter criteria: --- ========================= --- You can set filter criteria to define the set of units within the UNITSET. --- Filter criteria are defined by: --- --- * @{#UNITSET.FilterCoalitions}: Builds the UNITSET with the units belonging to the coalition(s). --- * @{#UNITSET.FilterCategories}: Builds the UNITSET with the units belonging to the category(ies). --- * @{#UNITSET.FilterTypes}: Builds the UNITSET with the units belonging to the unit type(s). --- * @{#UNITSET.FilterCountries}: Builds the UNITSET with the units belonging to the country(ies). --- * @{#UNITSET.FilterPrefixes}: Builds the UNITSET with the units starting with the same prefix string(s). --- --- Once the filter criteria have been set for the UNITSET, you can start filtering using: --- --- * @{#UNITSET.FilterStart}: Starts the filtering of the units within the UNITSET. --- --- Planned filter criteria within development are (so these are not yet available): --- --- * @{#UNITSET.FilterZones}: Builds the UNITSET with the units within a @{Zone#ZONE}. --- --- --- UNITSET iterators: --- =================== --- Once the filters have been defined and the UNITSET has been built, you can iterate the UNITSET with the available iterator methods. --- The iterator methods will walk the UNITSET set, and call for each element within the set a function that you provide. --- The following iterator methods are currently available within the UNITSET: --- --- * @{#UNITSET.ForEachUnit}: Calls a function for each alive unit it finds within the UNITSET. --- --- Planned iterators methods in development are (so these are not yet available): --- --- * @{#UNITSET.ForEachUnitInGroup}: Calls a function for each group contained within the UNITSET. --- * @{#UNITSET.ForEachUnitInZone}: Calls a function for each unit within a certain zone contained within the UNITSET. --- --- @module UnitSet --- @author FlightControl - -Include.File( "Routines" ) -Include.File( "Base" ) -Include.File( "Unit" ) -Include.File( "Set" ) - - ---- UNITSET class --- @type UNITSET --- @extends Set#SET -UNITSET = { - ClassName = "UNITSET", - Units = {}, - Filter = { - Coalitions = nil, - Categories = nil, - Types = nil, - Countries = nil, - UnitPrefixes = nil, - }, - FilterMeta = { - Coalitions = { - red = coalition.side.RED, - blue = coalition.side.BLUE, - neutral = coalition.side.NEUTRAL, - }, - Categories = { - plane = Unit.Category.AIRPLANE, - helicopter = Unit.Category.HELICOPTER, - ground = Unit.Category.GROUND_UNIT, - ship = Unit.Category.SHIP, - structure = Unit.Category.STRUCTURE, - }, - }, -} - - ---- Creates a new UNITSET object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names. --- @param #UNITSET self --- @return #UNITSET --- @usage --- -- Define a new UNITSET Object. This DBObject will contain a reference to all alive Units. --- DBObject = UNITSET:New() -function UNITSET:New() - - -- Inherits from BASE - local self = BASE:Inherit( self, SET:New( _DATABASE.UNITS ) ) - - return self -end - - ---- Finds a Unit based on the Unit Name. --- @param #UNITSET self --- @param #string UnitName --- @return Unit#UNIT The found Unit. -function UNITSET:FindUnit( UnitName ) - - local UnitFound = self.Set[UnitName] - return UnitFound -end - - - ---- Builds a set of units of coalitions. --- Possible current coalitions are red, blue and neutral. --- @param #UNITSET self --- @param #string Coalitions Can take the following values: "red", "blue", "neutral". --- @return #UNITSET self -function UNITSET:FilterCoalitions( Coalitions ) - if not self.Filter.Coalitions then - self.Filter.Coalitions = {} - end - if type( Coalitions ) ~= "table" then - Coalitions = { Coalitions } - end - for CoalitionID, Coalition in pairs( Coalitions ) do - self.Filter.Coalitions[Coalition] = Coalition - end - return self -end - - ---- Builds a set of units out of categories. --- Possible current categories are plane, helicopter, ground, ship. --- @param #UNITSET self --- @param #string Categories Can take the following values: "plane", "helicopter", "ground", "ship". --- @return #UNITSET self -function UNITSET:FilterCategories( Categories ) - if not self.Filter.Categories then - self.Filter.Categories = {} - end - if type( Categories ) ~= "table" then - Categories = { Categories } - end - for CategoryID, Category in pairs( Categories ) do - self.Filter.Categories[Category] = Category - end - return self -end - - ---- Builds a set of units of defined unit types. --- Possible current types are those types known within DCS world. --- @param #UNITSET self --- @param #string Types Can take those type strings known within DCS world. --- @return #UNITSET self -function UNITSET:FilterTypes( Types ) - if not self.Filter.Types then - self.Filter.Types = {} - end - if type( Types ) ~= "table" then - Types = { Types } - end - for TypeID, Type in pairs( Types ) do - self.Filter.Types[Type] = Type - end - return self -end - - ---- Builds a set of units of defined countries. --- Possible current countries are those known within DCS world. --- @param #UNITSET self --- @param #string Countries Can take those country strings known within DCS world. --- @return #UNITSET self -function UNITSET:FilterCountries( Countries ) - if not self.Filter.Countries then - self.Filter.Countries = {} - end - if type( Countries ) ~= "table" then - Countries = { Countries } - end - for CountryID, Country in pairs( Countries ) do - self.Filter.Countries[Country] = Country - end - return self -end - - ---- Builds a set of units of defined unit prefixes. --- All the units starting with the given prefixes will be included within the set. --- @param #UNITSET self --- @param #string Prefixes The prefix of which the unit name starts with. --- @return #UNITSET self -function UNITSET:FilterPrefixes( Prefixes ) - if not self.Filter.UnitPrefixes then - self.Filter.UnitPrefixes = {} - end - if type( Prefixes ) ~= "table" then - Prefixes = { Prefixes } - end - for PrefixID, Prefix in pairs( Prefixes ) do - self.Filter.UnitPrefixes[Prefix] = Prefix - end - return self -end - - - - ---- Starts the filtering. --- @param #UNITSET self --- @return #UNITSET self -function UNITSET:FilterStart() - - if _DATABASE then - self:_FilterStart() - end - - return self -end - ---- Handles the Database to check on an event (birth) that the Object was added in the Database. --- This is required, because sometimes the _DATABASE birth event gets called later than the SET birth event! --- @param #UNITSET self --- @param Event#EVENTDATA Event --- @return #string The name of the UNIT --- @return #table The UNIT -function UNITSET:AddInDatabase( Event ) - self:F3( { Event } ) - - if not self.Database[Event.IniDCSUnitName] then - self.Database[Event.IniDCSUnitName] = UNIT:Register( Event.IniDCSUnitName ) - self:T3( self.Database[Event.IniDCSUnitName] ) - end - - return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] -end - ---- Handles the Database to check on any event that Object exists in the Database. --- This is required, because sometimes the _DATABASE event gets called later than the SET event or vise versa! --- @param #UNITSET self --- @param Event#EVENTDATA Event --- @return #string The name of the UNIT --- @return #table The UNIT -function UNITSET:FindInDatabase( Event ) - self:F3( { Event } ) - - return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] -end - ---- Interate the UNITSET and call an interator function for each **alive** UNIT, providing the UNIT and optional parameters. --- @param #UNITSET self --- @param #function IteratorFunction The function that will be called when there is an alive UNIT in the UNITSET. The function needs to accept a UNIT parameter. --- @return #UNITSET self -function UNITSET:ForEachUnit( IteratorFunction, ... ) - self:F2( arg ) - - self:ForEach( IteratorFunction, arg, self.Set ) - - return self -end - - ------ Interate the UNITSET and call an interator function for each **alive** player, providing the Unit of the player and optional parameters. ----- @param #UNITSET self ----- @param #function IteratorFunction The function that will be called when there is an alive player in the UNITSET. The function needs to accept a UNIT parameter. ----- @return #UNITSET self ---function UNITSET:ForEachPlayer( IteratorFunction, ... ) --- self:F2( arg ) --- --- self:ForEach( IteratorFunction, arg, self.PlayersAlive ) --- --- return self ---end --- --- ------ Interate the UNITSET and call an interator function for each client, providing the Client to the function and optional parameters. ----- @param #UNITSET self ----- @param #function IteratorFunction The function that will be called when there is an alive player in the UNITSET. The function needs to accept a CLIENT parameter. ----- @return #UNITSET self ---function UNITSET:ForEachClient( IteratorFunction, ... ) --- self:F2( arg ) --- --- self:ForEach( IteratorFunction, arg, self.Clients ) --- --- return self ---end - - ---- --- @param #UNITSET self --- @param Unit#UNIT MUnit --- @return #UNITSET self -function UNITSET:IsIncludeObject( MUnit ) - self:F2( MUnit ) - local MUnitInclude = true - - if self.Filter.Coalitions then - local MUnitCoalition = false - for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do - self:T3( { "Coalition:", MUnit:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } ) - if self.FilterMeta.Coalitions[CoalitionName] and self.FilterMeta.Coalitions[CoalitionName] == MUnit:GetCoalition() then - MUnitCoalition = true - end - end - MUnitInclude = MUnitInclude and MUnitCoalition - end - - if self.Filter.Categories then - local MUnitCategory = false - for CategoryID, CategoryName in pairs( self.Filter.Categories ) do - self:T3( { "Category:", MUnit:GetDesc().category, self.FilterMeta.Categories[CategoryName], CategoryName } ) - if self.FilterMeta.Categories[CategoryName] and self.FilterMeta.Categories[CategoryName] == MUnit:GetDesc().category then - MUnitCategory = true - end - end - MUnitInclude = MUnitInclude and MUnitCategory - end - - if self.Filter.Types then - local MUnitType = false - for TypeID, TypeName in pairs( self.Filter.Types ) do - self:T3( { "Type:", MUnit:GetTypeName(), TypeName } ) - if TypeName == MUnit:GetTypeName() then - MUnitType = true - end - end - MUnitInclude = MUnitInclude and MUnitType - end - - if self.Filter.Countries then - local MUnitCountry = false - for CountryID, CountryName in pairs( self.Filter.Countries ) do - self:T3( { "Country:", MUnit:GetCountry(), CountryName } ) - if country.id[CountryName] == MUnit:GetCountry() then - MUnitCountry = true - end - end - MUnitInclude = MUnitInclude and MUnitCountry - end - - if self.Filter.UnitPrefixes then - local MUnitPrefix = false - for UnitPrefixId, UnitPrefix in pairs( self.Filter.UnitPrefixes ) do - self:T3( { "Prefix:", string.find( MUnit:GetName(), UnitPrefix, 1 ), UnitPrefix } ) - if string.find( MUnit:GetName(), UnitPrefix, 1 ) then - MUnitPrefix = true - end - end - MUnitInclude = MUnitInclude and MUnitPrefix - end - - self:T2( MUnitInclude ) - return MUnitInclude -end - - diff --git a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua index 905d30591..dad834c90 100644 --- a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua +++ b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE STATIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20160607_0846' ) +env.info( 'Moose Generation Timestamp: 20160607_1223' ) local base = _G env.info("Loading MOOSE " .. base.timer.getAbsTime() ) @@ -3182,7 +3182,7 @@ function SCHEDULER:_Scheduler() self:T( { Status, Result } ) - if Status and ( ( not Result ) or ( Result and Result ~= false ) ) then + if Status and ( ( not Result == nil ) or ( Result and Result ~= false ) ) then if self.Repeat and ( not self.StopSeconds or ( self.StopSeconds and timer.getTime() <= self.StartTime + self.StopSeconds ) ) then timer.scheduleFunction( self._Scheduler, @@ -9338,6 +9338,1028 @@ end +--- This module contains the SET classes. +-- +-- === +-- +-- 1) @{Set#SET_BASE} class, extending @{Base#BASE} +-- ================================================ +-- The @{Set#SET_BASE} class defines the core functions that define a collection of objects. +-- +-- === +-- +-- 2) @{Set#SET_GROUP} class, extending @{Set#SET_BASE} +-- ==================================================== +-- Mission designers can use the @{Set#SET_GROUP} class to build sets of groups belonging to certain: +-- +-- * Coalitions +-- * Categories +-- * Countries +-- * Starting with certain prefix strings. +-- +-- 2.1) SET_GROUP construction methods: +-- ------------------------------------ +-- Create a new SET_GROUP object with the @{#SET_GROUP.New} method: +-- +-- * @{#SET_GROUP.New}: Creates a new SET_GROUP object. +-- +-- 2.2) SET_GROUP filter criteria: +-- ------------------------------- +-- You can set filter criteria to define the set of groups within the SET_GROUP. +-- Filter criteria are defined by: +-- +-- * @{#SET_GROUP.FilterCoalitions}: Builds the SET_GROUP with the groups belonging to the coalition(s). +-- * @{#SET_GROUP.FilterCategories}: Builds the SET_GROUP with the groups belonging to the category(ies). +-- * @{#SET_GROUP.FilterCountries}: Builds the SET_GROUP with the gruops belonging to the country(ies). +-- * @{#SET_GROUP.FilterPrefixes}: Builds the SET_GROUP with the groups starting with the same prefix string(s). +-- +-- Once the filter criteria have been set for the SET_GROUP, you can start filtering using: +-- +-- * @{#SET_GROUP.FilterStart}: Starts the filtering of the groups within the SET_GROUP. +-- +-- Planned filter criteria within development are (so these are not yet available): +-- +-- * @{#SET_GROUP.FilterZones}: Builds the SET_GROUP with the groups within a @{Zone#ZONE}. +-- +-- +-- 2.3) SET_GROUP iterators: +-- ------------------------- +-- Once the filters have been defined and the SET_GROUP has been built, you can iterate the SET_GROUP with the available iterator methods. +-- The iterator methods will walk the SET_GROUP set, and call for each element within the set a function that you provide. +-- The following iterator methods are currently available within the SET_GROUP: +-- +-- * @{#SET_GROUP.ForEachGroup}: Calls a function for each alive group it finds within the SET_GROUP. +-- +-- ==== +-- +-- 3) @{Set#SET_UNIT} class, extending @{Set#SET_BASE} +-- =================================================== +-- Mission designers can use the @{Set#SET_UNIT} class to build sets of units belonging to certain: +-- +-- * Coalitions +-- * Categories +-- * Countries +-- * Unit types +-- * Starting with certain prefix strings. +-- +-- 3.1) SET_UNIT construction methods: +-- ----------------------------------- +-- Create a new SET_UNIT object with the @{#SET_UNIT.New} method: +-- +-- * @{#SET_UNIT.New}: Creates a new SET_UNIT object. +-- +-- +-- 3.2) SET_UNIT filter criteria: +-- ------------------------------ +-- You can set filter criteria to define the set of units within the SET_UNIT. +-- Filter criteria are defined by: +-- +-- * @{#SET_UNIT.FilterCoalitions}: Builds the SET_UNIT with the units belonging to the coalition(s). +-- * @{#SET_UNIT.FilterCategories}: Builds the SET_UNIT with the units belonging to the category(ies). +-- * @{#SET_UNIT.FilterTypes}: Builds the SET_UNIT with the units belonging to the unit type(s). +-- * @{#SET_UNIT.FilterCountries}: Builds the SET_UNIT with the units belonging to the country(ies). +-- * @{#SET_UNIT.FilterPrefixes}: Builds the SET_UNIT with the units starting with the same prefix string(s). +-- +-- Once the filter criteria have been set for the SET_UNIT, you can start filtering using: +-- +-- * @{#SET_UNIT.FilterStart}: Starts the filtering of the units within the SET_UNIT. +-- +-- Planned filter criteria within development are (so these are not yet available): +-- +-- * @{#SET_UNIT.FilterZones}: Builds the SET_UNIT with the units within a @{Zone#ZONE}. +-- +-- 3.3) SET_UNIT iterators: +-- ------------------------ +-- Once the filters have been defined and the SET_UNIT has been built, you can iterate the SET_UNIT with the available iterator methods. +-- The iterator methods will walk the SET_UNIT set, and call for each element within the set a function that you provide. +-- The following iterator methods are currently available within the SET_UNIT: +-- +-- * @{#SET_UNIT.ForEachUnit}: Calls a function for each alive unit it finds within the SET_UNIT. +-- +-- Planned iterators methods in development are (so these are not yet available): +-- +-- * @{#SET_UNIT.ForEachUnitInGroup}: Calls a function for each group contained within the SET_UNIT. +-- * @{#SET_UNIT.ForEachUnitInZone}: Calls a function for each unit within a certain zone contained within the SET_UNIT. +-- +-- +-- ==== +-- +-- @module Set +-- @author FlightControl + +Include.File( "Routines" ) +Include.File( "Base" ) +Include.File( "Menu" ) +Include.File( "Group" ) +Include.File( "Unit" ) +Include.File( "Event" ) +Include.File( "Client" ) + +--- SET_BASE class +-- @type SET_BASE +-- @extends Base#BASE +SET_BASE = { + ClassName = "SET_BASE", + Set = {}, + Database = {}, +} + +--- Creates a new SET_BASE object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names. +-- @param #SET_BASE self +-- @return #SET_BASE +-- @usage +-- -- Define a new SET_BASE Object. This DBObject will contain a reference to all Group and Unit Templates defined within the ME and the DCSRTE. +-- DBObject = SET_BASE:New() +function SET_BASE:New( Database ) + + -- Inherits from BASE + local self = BASE:Inherit( self, BASE:New() ) + + self.Database = Database + + return self +end + +--- Finds an Object based on the Object Name. +-- @param #SET_BASE self +-- @param #string ObjectName +-- @return #table The Object found. +function SET_BASE:_Find( ObjectName ) + + local ObjectFound = self.Set[ObjectName] + return ObjectFound +end + +--- Adds a Object based on the Object Name. +-- @param #SET_BASE self +-- @param #string ObjectName +-- @param #table Object +-- @return #table The added Object. +function SET_BASE:_Add( ObjectName, Object ) + + self.Set[ObjectName] = Object +end + +--- Starts the filtering for the defined collection. +-- @param #SET_BASE self +-- @return #SET_BASE self +function SET_BASE:_FilterStart() + + for ObjectName, Object in pairs( self.Database ) do + + if self:IsIncludeObject( Object ) then + self:E( { "Adding Object:", ObjectName } ) + self:_Add( ObjectName, Object ) + end + end + + _EVENTDISPATCHER:OnBirth( self._EventOnBirth, self ) + _EVENTDISPATCHER:OnDead( self._EventOnDeadOrCrash, self ) + _EVENTDISPATCHER:OnCrash( self._EventOnDeadOrCrash, self ) + + -- Follow alive players and clients +-- _EVENTDISPATCHER:OnPlayerEnterUnit( self._EventOnPlayerEnterUnit, self ) +-- _EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventOnPlayerLeaveUnit, self ) + + + return self +end + + + +----- Private method that registers all alive players in the mission. +---- @param #SET_BASE self +---- @return #SET_BASE self +--function SET_BASE:_RegisterPlayers() +-- +-- local CoalitionsData = { AlivePlayersRed = coalition.getPlayers( coalition.side.RED ), AlivePlayersBlue = coalition.getPlayers( coalition.side.BLUE ) } +-- for CoalitionId, CoalitionData in pairs( CoalitionsData ) do +-- for UnitId, UnitData in pairs( CoalitionData ) do +-- self:T3( { "UnitData:", UnitData } ) +-- if UnitData and UnitData:isExist() then +-- local UnitName = UnitData:getName() +-- if not self.PlayersAlive[UnitName] then +-- self:E( { "Add player for unit:", UnitName, UnitData:getPlayerName() } ) +-- self.PlayersAlive[UnitName] = UnitData:getPlayerName() +-- end +-- end +-- end +-- end +-- +-- return self +--end + +--- Events + +--- Handles the OnBirth event for the Set. +-- @param #SET_BASE self +-- @param Event#EVENTDATA Event +function SET_BASE:_EventOnBirth( Event ) + self:F3( { Event } ) + + if Event.IniDCSUnit then + local ObjectName, Object = self:AddInDatabase( Event ) + self:T3( ObjectName, Object ) + if self:IsIncludeObject( Object ) then + self:_Add( ObjectName, Object ) + --self:_EventOnPlayerEnterUnit( Event ) + end + end +end + +--- Handles the OnDead or OnCrash event for alive units set. +-- @param #SET_BASE self +-- @param Event#EVENTDATA Event +function SET_BASE:_EventOnDeadOrCrash( Event ) + self:F3( { Event } ) + + if Event.IniDCSUnit then + local ObjectName, Object = self:FindInDatabase( Event ) + if ObjectName and Object then + self:_Delete( ObjectName ) + end + end +end + +----- Handles the OnPlayerEnterUnit event to fill the active players table (with the unit filter applied). +---- @param #SET_BASE self +---- @param Event#EVENTDATA Event +--function SET_BASE:_EventOnPlayerEnterUnit( Event ) +-- self:F3( { Event } ) +-- +-- if Event.IniDCSUnit then +-- if self:IsIncludeObject( Event.IniDCSUnit ) then +-- if not self.PlayersAlive[Event.IniDCSUnitName] then +-- self:E( { "Add player for unit:", Event.IniDCSUnitName, Event.IniDCSUnit:getPlayerName() } ) +-- self.PlayersAlive[Event.IniDCSUnitName] = Event.IniDCSUnit:getPlayerName() +-- self.ClientsAlive[Event.IniDCSUnitName] = _DATABASE.Clients[ Event.IniDCSUnitName ] +-- end +-- end +-- end +--end +-- +----- Handles the OnPlayerLeaveUnit event to clean the active players table. +---- @param #SET_BASE self +---- @param Event#EVENTDATA Event +--function SET_BASE:_EventOnPlayerLeaveUnit( Event ) +-- self:F3( { Event } ) +-- +-- if Event.IniDCSUnit then +-- if self:IsIncludeObject( Event.IniDCSUnit ) then +-- if self.PlayersAlive[Event.IniDCSUnitName] then +-- self:E( { "Cleaning player for unit:", Event.IniDCSUnitName, Event.IniDCSUnit:getPlayerName() } ) +-- self.PlayersAlive[Event.IniDCSUnitName] = nil +-- self.ClientsAlive[Event.IniDCSUnitName] = nil +-- end +-- end +-- end +--end + +-- Iterators + +--- Interate the SET_BASE and call an interator function for the given set, providing the Object for each element within the set and optional parameters. +-- @param #SET_BASE self +-- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_BASE. +-- @return #SET_BASE self +function SET_BASE:ForEach( IteratorFunction, arg, Set, Function, FunctionArguments ) + self:F3( arg ) + + local function CoRoutine() + local Count = 0 + for ObjectID, Object in pairs( Set ) do + self:T2( Object ) + if Function( unpack( FunctionArguments ), Object ) == true then + IteratorFunction( Object, unpack( arg ) ) + end + Count = Count + 1 + if Count % 10 == 0 then + coroutine.yield( false ) + end + end + return true + end + + local co = coroutine.create( CoRoutine ) + + local function Schedule() + + local status, res = coroutine.resume( co ) + self:T3( { status, res } ) + + if status == false then + error( res ) + end + if res == false then + return true -- resume next time the loop + end + + return false + end + + local Scheduler = SCHEDULER:New( self, Schedule, {}, 0.001, 0.001, 0 ) + + return self +end + + +----- Interate the SET_BASE and call an interator function for each **alive** unit, providing the Unit and optional parameters. +---- @param #SET_BASE self +---- @param #function IteratorFunction The function that will be called when there is an alive unit in the SET_BASE. The function needs to accept a UNIT parameter. +---- @return #SET_BASE self +--function SET_BASE:ForEachDCSUnitAlive( IteratorFunction, ... ) +-- self:F3( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.DCSUnitsAlive ) +-- +-- return self +--end +-- +----- Interate the SET_BASE and call an interator function for each **alive** player, providing the Unit of the player and optional parameters. +---- @param #SET_BASE self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_BASE. The function needs to accept a UNIT parameter. +---- @return #SET_BASE self +--function SET_BASE:ForEachPlayer( IteratorFunction, ... ) +-- self:F3( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.PlayersAlive ) +-- +-- return self +--end +-- +-- +----- Interate the SET_BASE and call an interator function for each client, providing the Client to the function and optional parameters. +---- @param #SET_BASE self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_BASE. The function needs to accept a CLIENT parameter. +---- @return #SET_BASE self +--function SET_BASE:ForEachClient( IteratorFunction, ... ) +-- self:F3( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.Clients ) +-- +-- return self +--end + + +--- Decides whether to include the Object +-- @param #SET_BASE self +-- @param #table Object +-- @return #SET_BASE self +function SET_BASE:IsIncludeObject( Object ) + self:F3( Object ) + + return true +end + +--- Flushes the current SET_BASE contents in the log ... (for debug reasons). +-- @param #SET_BASE self +-- @return #string A string with the names of the objects. +function SET_BASE:Flush() + self:F3() + + local ObjectNames = "" + for ObjectName, Object in pairs( self.Set ) do + ObjectNames = ObjectNames .. ObjectName .. ", " + end + self:T( { "Objects in Set:", ObjectNames } ) + + return ObjectNames +end + +-- SET_GROUP + +--- SET_GROUP class +-- @type SET_GROUP +-- @extends Set#SET_BASE +SET_GROUP = { + ClassName = "SET_GROUP", + Filter = { + Coalitions = nil, + Categories = nil, + Countries = nil, + GroupPrefixes = nil, + }, + FilterMeta = { + Coalitions = { + red = coalition.side.RED, + blue = coalition.side.BLUE, + neutral = coalition.side.NEUTRAL, + }, + Categories = { + plane = Group.Category.AIRPLANE, + helicopter = Group.Category.HELICOPTER, + ground = Group.Category.GROUND_UNIT, + ship = Group.Category.SHIP, + structure = Group.Category.STRUCTURE, + }, + }, +} + + +--- Creates a new SET_GROUP object, building a set of groups belonging to a coalitions, categories, countries, types or with defined prefix names. +-- @param #SET_GROUP self +-- @return #SET_GROUP +-- @usage +-- -- Define a new SET_GROUP Object. This DBObject will contain a reference to all alive GROUPS. +-- DBObject = SET_GROUP:New() +function SET_GROUP:New() + + -- Inherits from BASE + local self = BASE:Inherit( self, SET_BASE:New( _DATABASE.GROUPS ) ) + + return self +end + + +--- Finds a Group based on the Group Name. +-- @param #SET_GROUP self +-- @param #string GroupName +-- @return Group#GROUP The found Group. +function SET_GROUP:FindGroup( GroupName ) + + local GroupFound = self.Set[GroupName] + return GroupFound +end + + + +--- Builds a set of groups of coalitions. +-- Possible current coalitions are red, blue and neutral. +-- @param #SET_GROUP self +-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". +-- @return #SET_GROUP self +function SET_GROUP:FilterCoalitions( Coalitions ) + if not self.Filter.Coalitions then + self.Filter.Coalitions = {} + end + if type( Coalitions ) ~= "table" then + Coalitions = { Coalitions } + end + for CoalitionID, Coalition in pairs( Coalitions ) do + self.Filter.Coalitions[Coalition] = Coalition + end + return self +end + + +--- Builds a set of groups out of categories. +-- Possible current categories are plane, helicopter, ground, ship. +-- @param #SET_GROUP self +-- @param #string Categories Can take the following values: "plane", "helicopter", "ground", "ship". +-- @return #SET_GROUP self +function SET_GROUP:FilterCategories( Categories ) + if not self.Filter.Categories then + self.Filter.Categories = {} + end + if type( Categories ) ~= "table" then + Categories = { Categories } + end + for CategoryID, Category in pairs( Categories ) do + self.Filter.Categories[Category] = Category + end + return self +end + +--- Builds a set of groups of defined countries. +-- Possible current countries are those known within DCS world. +-- @param #SET_GROUP self +-- @param #string Countries Can take those country strings known within DCS world. +-- @return #SET_GROUP self +function SET_GROUP:FilterCountries( Countries ) + if not self.Filter.Countries then + self.Filter.Countries = {} + end + if type( Countries ) ~= "table" then + Countries = { Countries } + end + for CountryID, Country in pairs( Countries ) do + self.Filter.Countries[Country] = Country + end + return self +end + + +--- Builds a set of groups of defined GROUP prefixes. +-- All the groups starting with the given prefixes will be included within the set. +-- @param #SET_GROUP self +-- @param #string Prefixes The prefix of which the group name starts with. +-- @return #SET_GROUP self +function SET_GROUP:FilterPrefixes( Prefixes ) + if not self.Filter.GroupPrefixes then + self.Filter.GroupPrefixes = {} + end + if type( Prefixes ) ~= "table" then + Prefixes = { Prefixes } + end + for PrefixID, Prefix in pairs( Prefixes ) do + self.Filter.GroupPrefixes[Prefix] = Prefix + end + return self +end + + +--- Starts the filtering. +-- @param #SET_GROUP self +-- @return #SET_GROUP self +function SET_GROUP:FilterStart() + + if _DATABASE then + self:_FilterStart() + end + + return self +end + +--- Handles the Database to check on an event (birth) that the Object was added in the Database. +-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event! +-- @param #SET_GROUP self +-- @param Event#EVENTDATA Event +-- @return #string The name of the GROUP +-- @return #table The GROUP +function SET_GROUP:AddInDatabase( Event ) + self:F3( { Event } ) + + if not self.Database[Event.IniDCSGroupName] then + self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName ) + self:T3( self.Database[Event.IniDCSGroupName] ) + end + + return Event.IniDCSGroupName, self.Database[Event.IniDCSGroupName] +end + +--- Handles the Database to check on any event that Object exists in the Database. +-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa! +-- @param #SET_GROUP self +-- @param Event#EVENTDATA Event +-- @return #string The name of the GROUP +-- @return #table The GROUP +function SET_GROUP:FindInDatabase( Event ) + self:F3( { Event } ) + + return Event.IniDCSGroupName, self.Database[Event.IniDCSGroupName] +end + +--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP, providing the GROUP and optional parameters. +-- @param #SET_GROUP self +-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter. +-- @return #SET_GROUP self +function SET_GROUP:ForEachGroup( IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set ) + + return self +end + +--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence completely in a @{Zone}, providing the GROUP and optional parameters to the called function. +-- @param #SET_GROUP self +-- @param Zone#ZONE ZoneObject The Zone to be tested for. +-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter. +-- @return #SET_GROUP self +function SET_GROUP:ForEachGroupCompletelyInZone( ZoneObject, IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set, + --- @param Zone#ZONE_BASE ZoneObject + -- @param Group#GROUP GroupObject + function( ZoneObject, GroupObject ) + if GroupObject:IsCompletelyInZone( ZoneObject ) then + return true + else + return false + end + end, { ZoneObject } ) + + return self +end + +--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence partly in a @{Zone}, providing the GROUP and optional parameters to the called function. +-- @param #SET_GROUP self +-- @param Zone#ZONE ZoneObject The Zone to be tested for. +-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter. +-- @return #SET_GROUP self +function SET_GROUP:ForEachGroupPartlyInZone( ZoneObject, IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set, + --- @param Zone#ZONE_BASE ZoneObject + -- @param Group#GROUP GroupObject + function( ZoneObject, GroupObject ) + if GroupObject:IsPartlyInZone( ZoneObject ) then + return true + else + return false + end + end, { ZoneObject } ) + + return self +end + +--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence not in a @{Zone}, providing the GROUP and optional parameters to the called function. +-- @param #SET_GROUP self +-- @param Zone#ZONE ZoneObject The Zone to be tested for. +-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter. +-- @return #SET_GROUP self +function SET_GROUP:ForEachGroupNotInZone( ZoneObject, IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set, + --- @param Zone#ZONE_BASE ZoneObject + -- @param Group#GROUP GroupObject + function( ZoneObject, GroupObject ) + if GroupObject:IsNotInZone( ZoneObject ) then + return true + else + return false + end + end, { ZoneObject } ) + + return self +end + + +----- Interate the SET_GROUP and call an interator function for each **alive** player, providing the Group of the player and optional parameters. +---- @param #SET_GROUP self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_GROUP. The function needs to accept a GROUP parameter. +---- @return #SET_GROUP self +--function SET_GROUP:ForEachPlayer( IteratorFunction, ... ) +-- self:F2( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.PlayersAlive ) +-- +-- return self +--end +-- +-- +----- Interate the SET_GROUP and call an interator function for each client, providing the Client to the function and optional parameters. +---- @param #SET_GROUP self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_GROUP. The function needs to accept a CLIENT parameter. +---- @return #SET_GROUP self +--function SET_GROUP:ForEachClient( IteratorFunction, ... ) +-- self:F2( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.Clients ) +-- +-- return self +--end + + +--- +-- @param #SET_GROUP self +-- @param Group#GROUP MooseGroup +-- @return #SET_GROUP self +function SET_GROUP:IsIncludeObject( MooseGroup ) + self:F2( MooseGroup ) + local MooseGroupInclude = true + + if self.Filter.Coalitions then + local MooseGroupCoalition = false + for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do + self:T3( { "Coalition:", MooseGroup:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } ) + if self.FilterMeta.Coalitions[CoalitionName] and self.FilterMeta.Coalitions[CoalitionName] == MooseGroup:GetCoalition() then + MooseGroupCoalition = true + end + end + MooseGroupInclude = MooseGroupInclude and MooseGroupCoalition + end + + if self.Filter.Categories then + local MooseGroupCategory = false + for CategoryID, CategoryName in pairs( self.Filter.Categories ) do + self:T3( { "Category:", MooseGroup:GetCategory(), self.FilterMeta.Categories[CategoryName], CategoryName } ) + if self.FilterMeta.Categories[CategoryName] and self.FilterMeta.Categories[CategoryName] == MooseGroup:GetCategory() then + MooseGroupCategory = true + end + end + MooseGroupInclude = MooseGroupInclude and MooseGroupCategory + end + + if self.Filter.Countries then + local MooseGroupCountry = false + for CountryID, CountryName in pairs( self.Filter.Countries ) do + self:T3( { "Country:", MooseGroup:GetCountry(), CountryName } ) + if country.id[CountryName] == MooseGroup:GetCountry() then + MooseGroupCountry = true + end + end + MooseGroupInclude = MooseGroupInclude and MooseGroupCountry + end + + if self.Filter.GroupPrefixes then + local MooseGroupPrefix = false + for GroupPrefixId, GroupPrefix in pairs( self.Filter.GroupPrefixes ) do + self:T3( { "Prefix:", string.find( MooseGroup:GetName(), GroupPrefix, 1 ), GroupPrefix } ) + if string.find( MooseGroup:GetName(), GroupPrefix, 1 ) then + MooseGroupPrefix = true + end + end + MooseGroupInclude = MooseGroupInclude and MooseGroupPrefix + end + + self:T2( MooseGroupInclude ) + return MooseGroupInclude +end + +--- SET_UNIT class +-- @type SET_UNIT +-- @extends Set#SET_BASE +SET_UNIT = { + ClassName = "SET_UNIT", + Units = {}, + Filter = { + Coalitions = nil, + Categories = nil, + Types = nil, + Countries = nil, + UnitPrefixes = nil, + }, + FilterMeta = { + Coalitions = { + red = coalition.side.RED, + blue = coalition.side.BLUE, + neutral = coalition.side.NEUTRAL, + }, + Categories = { + plane = Unit.Category.AIRPLANE, + helicopter = Unit.Category.HELICOPTER, + ground = Unit.Category.GROUND_UNIT, + ship = Unit.Category.SHIP, + structure = Unit.Category.STRUCTURE, + }, + }, +} + + +--- Creates a new SET_UNIT object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names. +-- @param #SET_UNIT self +-- @return #SET_UNIT +-- @usage +-- -- Define a new SET_UNIT Object. This DBObject will contain a reference to all alive Units. +-- DBObject = SET_UNIT:New() +function SET_UNIT:New() + + -- Inherits from BASE + local self = BASE:Inherit( self, SET_BASE:New( _DATABASE.UNITS ) ) + + return self +end + + +--- Finds a Unit based on the Unit Name. +-- @param #SET_UNIT self +-- @param #string UnitName +-- @return Unit#UNIT The found Unit. +function SET_UNIT:FindUnit( UnitName ) + + local UnitFound = self.Set[UnitName] + return UnitFound +end + + + +--- Builds a set of units of coalitions. +-- Possible current coalitions are red, blue and neutral. +-- @param #SET_UNIT self +-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". +-- @return #SET_UNIT self +function SET_UNIT:FilterCoalitions( Coalitions ) + if not self.Filter.Coalitions then + self.Filter.Coalitions = {} + end + if type( Coalitions ) ~= "table" then + Coalitions = { Coalitions } + end + for CoalitionID, Coalition in pairs( Coalitions ) do + self.Filter.Coalitions[Coalition] = Coalition + end + return self +end + + +--- Builds a set of units out of categories. +-- Possible current categories are plane, helicopter, ground, ship. +-- @param #SET_UNIT self +-- @param #string Categories Can take the following values: "plane", "helicopter", "ground", "ship". +-- @return #SET_UNIT self +function SET_UNIT:FilterCategories( Categories ) + if not self.Filter.Categories then + self.Filter.Categories = {} + end + if type( Categories ) ~= "table" then + Categories = { Categories } + end + for CategoryID, Category in pairs( Categories ) do + self.Filter.Categories[Category] = Category + end + return self +end + + +--- Builds a set of units of defined unit types. +-- Possible current types are those types known within DCS world. +-- @param #SET_UNIT self +-- @param #string Types Can take those type strings known within DCS world. +-- @return #SET_UNIT self +function SET_UNIT:FilterTypes( Types ) + if not self.Filter.Types then + self.Filter.Types = {} + end + if type( Types ) ~= "table" then + Types = { Types } + end + for TypeID, Type in pairs( Types ) do + self.Filter.Types[Type] = Type + end + return self +end + + +--- Builds a set of units of defined countries. +-- Possible current countries are those known within DCS world. +-- @param #SET_UNIT self +-- @param #string Countries Can take those country strings known within DCS world. +-- @return #SET_UNIT self +function SET_UNIT:FilterCountries( Countries ) + if not self.Filter.Countries then + self.Filter.Countries = {} + end + if type( Countries ) ~= "table" then + Countries = { Countries } + end + for CountryID, Country in pairs( Countries ) do + self.Filter.Countries[Country] = Country + end + return self +end + + +--- Builds a set of units of defined unit prefixes. +-- All the units starting with the given prefixes will be included within the set. +-- @param #SET_UNIT self +-- @param #string Prefixes The prefix of which the unit name starts with. +-- @return #SET_UNIT self +function SET_UNIT:FilterPrefixes( Prefixes ) + if not self.Filter.UnitPrefixes then + self.Filter.UnitPrefixes = {} + end + if type( Prefixes ) ~= "table" then + Prefixes = { Prefixes } + end + for PrefixID, Prefix in pairs( Prefixes ) do + self.Filter.UnitPrefixes[Prefix] = Prefix + end + return self +end + + + + +--- Starts the filtering. +-- @param #SET_UNIT self +-- @return #SET_UNIT self +function SET_UNIT:FilterStart() + + if _DATABASE then + self:_FilterStart() + end + + return self +end + +--- Handles the Database to check on an event (birth) that the Object was added in the Database. +-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event! +-- @param #SET_UNIT self +-- @param Event#EVENTDATA Event +-- @return #string The name of the UNIT +-- @return #table The UNIT +function SET_UNIT:AddInDatabase( Event ) + self:F3( { Event } ) + + if not self.Database[Event.IniDCSUnitName] then + self.Database[Event.IniDCSUnitName] = UNIT:Register( Event.IniDCSUnitName ) + self:T3( self.Database[Event.IniDCSUnitName] ) + end + + return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] +end + +--- Handles the Database to check on any event that Object exists in the Database. +-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa! +-- @param #SET_UNIT self +-- @param Event#EVENTDATA Event +-- @return #string The name of the UNIT +-- @return #table The UNIT +function SET_UNIT:FindInDatabase( Event ) + self:F3( { Event } ) + + return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] +end + +--- Interate the SET_UNIT and call an interator function for each **alive** UNIT, providing the UNIT and optional parameters. +-- @param #SET_UNIT self +-- @param #function IteratorFunction The function that will be called when there is an alive UNIT in the SET_UNIT. The function needs to accept a UNIT parameter. +-- @return #SET_UNIT self +function SET_UNIT:ForEachUnit( IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set ) + + return self +end + + +----- Interate the SET_UNIT and call an interator function for each **alive** player, providing the Unit of the player and optional parameters. +---- @param #SET_UNIT self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_UNIT. The function needs to accept a UNIT parameter. +---- @return #SET_UNIT self +--function SET_UNIT:ForEachPlayer( IteratorFunction, ... ) +-- self:F2( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.PlayersAlive ) +-- +-- return self +--end +-- +-- +----- Interate the SET_UNIT and call an interator function for each client, providing the Client to the function and optional parameters. +---- @param #SET_UNIT self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_UNIT. The function needs to accept a CLIENT parameter. +---- @return #SET_UNIT self +--function SET_UNIT:ForEachClient( IteratorFunction, ... ) +-- self:F2( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.Clients ) +-- +-- return self +--end + + +--- +-- @param #SET_UNIT self +-- @param Unit#UNIT MUnit +-- @return #SET_UNIT self +function SET_UNIT:IsIncludeObject( MUnit ) + self:F2( MUnit ) + local MUnitInclude = true + + if self.Filter.Coalitions then + local MUnitCoalition = false + for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do + self:T3( { "Coalition:", MUnit:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } ) + if self.FilterMeta.Coalitions[CoalitionName] and self.FilterMeta.Coalitions[CoalitionName] == MUnit:GetCoalition() then + MUnitCoalition = true + end + end + MUnitInclude = MUnitInclude and MUnitCoalition + end + + if self.Filter.Categories then + local MUnitCategory = false + for CategoryID, CategoryName in pairs( self.Filter.Categories ) do + self:T3( { "Category:", MUnit:GetDesc().category, self.FilterMeta.Categories[CategoryName], CategoryName } ) + if self.FilterMeta.Categories[CategoryName] and self.FilterMeta.Categories[CategoryName] == MUnit:GetDesc().category then + MUnitCategory = true + end + end + MUnitInclude = MUnitInclude and MUnitCategory + end + + if self.Filter.Types then + local MUnitType = false + for TypeID, TypeName in pairs( self.Filter.Types ) do + self:T3( { "Type:", MUnit:GetTypeName(), TypeName } ) + if TypeName == MUnit:GetTypeName() then + MUnitType = true + end + end + MUnitInclude = MUnitInclude and MUnitType + end + + if self.Filter.Countries then + local MUnitCountry = false + for CountryID, CountryName in pairs( self.Filter.Countries ) do + self:T3( { "Country:", MUnit:GetCountry(), CountryName } ) + if country.id[CountryName] == MUnit:GetCountry() then + MUnitCountry = true + end + end + MUnitInclude = MUnitInclude and MUnitCountry + end + + if self.Filter.UnitPrefixes then + local MUnitPrefix = false + for UnitPrefixId, UnitPrefix in pairs( self.Filter.UnitPrefixes ) do + self:T3( { "Prefix:", string.find( MUnit:GetName(), UnitPrefix, 1 ), UnitPrefix } ) + if string.find( MUnit:GetName(), UnitPrefix, 1 ) then + MUnitPrefix = true + end + end + MUnitInclude = MUnitInclude and MUnitPrefix + end + + self:T2( MUnitInclude ) + return MUnitInclude +end + --- This module contains the POINT classes. -- -- 1) @{Point#POINT_VEC3} class, extends @{Base#BASE} @@ -15251,7 +16273,6 @@ function SPAWN:SpawnWithIndex( SpawnIndex ) end self.SpawnGroups[self.SpawnIndex].Spawned = true - return self.SpawnGroups[self.SpawnIndex].Group else --self:E( { self.SpawnTemplatePrefix, "No more Groups to Spawn:", SpawnIndex, self.SpawnMaxGroups } ) diff --git a/Moose Mission Setup/Moose.lua b/Moose Mission Setup/Moose.lua index 905d30591..dad834c90 100644 --- a/Moose Mission Setup/Moose.lua +++ b/Moose Mission Setup/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE STATIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20160607_0846' ) +env.info( 'Moose Generation Timestamp: 20160607_1223' ) local base = _G env.info("Loading MOOSE " .. base.timer.getAbsTime() ) @@ -3182,7 +3182,7 @@ function SCHEDULER:_Scheduler() self:T( { Status, Result } ) - if Status and ( ( not Result ) or ( Result and Result ~= false ) ) then + if Status and ( ( not Result == nil ) or ( Result and Result ~= false ) ) then if self.Repeat and ( not self.StopSeconds or ( self.StopSeconds and timer.getTime() <= self.StartTime + self.StopSeconds ) ) then timer.scheduleFunction( self._Scheduler, @@ -9338,6 +9338,1028 @@ end +--- This module contains the SET classes. +-- +-- === +-- +-- 1) @{Set#SET_BASE} class, extending @{Base#BASE} +-- ================================================ +-- The @{Set#SET_BASE} class defines the core functions that define a collection of objects. +-- +-- === +-- +-- 2) @{Set#SET_GROUP} class, extending @{Set#SET_BASE} +-- ==================================================== +-- Mission designers can use the @{Set#SET_GROUP} class to build sets of groups belonging to certain: +-- +-- * Coalitions +-- * Categories +-- * Countries +-- * Starting with certain prefix strings. +-- +-- 2.1) SET_GROUP construction methods: +-- ------------------------------------ +-- Create a new SET_GROUP object with the @{#SET_GROUP.New} method: +-- +-- * @{#SET_GROUP.New}: Creates a new SET_GROUP object. +-- +-- 2.2) SET_GROUP filter criteria: +-- ------------------------------- +-- You can set filter criteria to define the set of groups within the SET_GROUP. +-- Filter criteria are defined by: +-- +-- * @{#SET_GROUP.FilterCoalitions}: Builds the SET_GROUP with the groups belonging to the coalition(s). +-- * @{#SET_GROUP.FilterCategories}: Builds the SET_GROUP with the groups belonging to the category(ies). +-- * @{#SET_GROUP.FilterCountries}: Builds the SET_GROUP with the gruops belonging to the country(ies). +-- * @{#SET_GROUP.FilterPrefixes}: Builds the SET_GROUP with the groups starting with the same prefix string(s). +-- +-- Once the filter criteria have been set for the SET_GROUP, you can start filtering using: +-- +-- * @{#SET_GROUP.FilterStart}: Starts the filtering of the groups within the SET_GROUP. +-- +-- Planned filter criteria within development are (so these are not yet available): +-- +-- * @{#SET_GROUP.FilterZones}: Builds the SET_GROUP with the groups within a @{Zone#ZONE}. +-- +-- +-- 2.3) SET_GROUP iterators: +-- ------------------------- +-- Once the filters have been defined and the SET_GROUP has been built, you can iterate the SET_GROUP with the available iterator methods. +-- The iterator methods will walk the SET_GROUP set, and call for each element within the set a function that you provide. +-- The following iterator methods are currently available within the SET_GROUP: +-- +-- * @{#SET_GROUP.ForEachGroup}: Calls a function for each alive group it finds within the SET_GROUP. +-- +-- ==== +-- +-- 3) @{Set#SET_UNIT} class, extending @{Set#SET_BASE} +-- =================================================== +-- Mission designers can use the @{Set#SET_UNIT} class to build sets of units belonging to certain: +-- +-- * Coalitions +-- * Categories +-- * Countries +-- * Unit types +-- * Starting with certain prefix strings. +-- +-- 3.1) SET_UNIT construction methods: +-- ----------------------------------- +-- Create a new SET_UNIT object with the @{#SET_UNIT.New} method: +-- +-- * @{#SET_UNIT.New}: Creates a new SET_UNIT object. +-- +-- +-- 3.2) SET_UNIT filter criteria: +-- ------------------------------ +-- You can set filter criteria to define the set of units within the SET_UNIT. +-- Filter criteria are defined by: +-- +-- * @{#SET_UNIT.FilterCoalitions}: Builds the SET_UNIT with the units belonging to the coalition(s). +-- * @{#SET_UNIT.FilterCategories}: Builds the SET_UNIT with the units belonging to the category(ies). +-- * @{#SET_UNIT.FilterTypes}: Builds the SET_UNIT with the units belonging to the unit type(s). +-- * @{#SET_UNIT.FilterCountries}: Builds the SET_UNIT with the units belonging to the country(ies). +-- * @{#SET_UNIT.FilterPrefixes}: Builds the SET_UNIT with the units starting with the same prefix string(s). +-- +-- Once the filter criteria have been set for the SET_UNIT, you can start filtering using: +-- +-- * @{#SET_UNIT.FilterStart}: Starts the filtering of the units within the SET_UNIT. +-- +-- Planned filter criteria within development are (so these are not yet available): +-- +-- * @{#SET_UNIT.FilterZones}: Builds the SET_UNIT with the units within a @{Zone#ZONE}. +-- +-- 3.3) SET_UNIT iterators: +-- ------------------------ +-- Once the filters have been defined and the SET_UNIT has been built, you can iterate the SET_UNIT with the available iterator methods. +-- The iterator methods will walk the SET_UNIT set, and call for each element within the set a function that you provide. +-- The following iterator methods are currently available within the SET_UNIT: +-- +-- * @{#SET_UNIT.ForEachUnit}: Calls a function for each alive unit it finds within the SET_UNIT. +-- +-- Planned iterators methods in development are (so these are not yet available): +-- +-- * @{#SET_UNIT.ForEachUnitInGroup}: Calls a function for each group contained within the SET_UNIT. +-- * @{#SET_UNIT.ForEachUnitInZone}: Calls a function for each unit within a certain zone contained within the SET_UNIT. +-- +-- +-- ==== +-- +-- @module Set +-- @author FlightControl + +Include.File( "Routines" ) +Include.File( "Base" ) +Include.File( "Menu" ) +Include.File( "Group" ) +Include.File( "Unit" ) +Include.File( "Event" ) +Include.File( "Client" ) + +--- SET_BASE class +-- @type SET_BASE +-- @extends Base#BASE +SET_BASE = { + ClassName = "SET_BASE", + Set = {}, + Database = {}, +} + +--- Creates a new SET_BASE object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names. +-- @param #SET_BASE self +-- @return #SET_BASE +-- @usage +-- -- Define a new SET_BASE Object. This DBObject will contain a reference to all Group and Unit Templates defined within the ME and the DCSRTE. +-- DBObject = SET_BASE:New() +function SET_BASE:New( Database ) + + -- Inherits from BASE + local self = BASE:Inherit( self, BASE:New() ) + + self.Database = Database + + return self +end + +--- Finds an Object based on the Object Name. +-- @param #SET_BASE self +-- @param #string ObjectName +-- @return #table The Object found. +function SET_BASE:_Find( ObjectName ) + + local ObjectFound = self.Set[ObjectName] + return ObjectFound +end + +--- Adds a Object based on the Object Name. +-- @param #SET_BASE self +-- @param #string ObjectName +-- @param #table Object +-- @return #table The added Object. +function SET_BASE:_Add( ObjectName, Object ) + + self.Set[ObjectName] = Object +end + +--- Starts the filtering for the defined collection. +-- @param #SET_BASE self +-- @return #SET_BASE self +function SET_BASE:_FilterStart() + + for ObjectName, Object in pairs( self.Database ) do + + if self:IsIncludeObject( Object ) then + self:E( { "Adding Object:", ObjectName } ) + self:_Add( ObjectName, Object ) + end + end + + _EVENTDISPATCHER:OnBirth( self._EventOnBirth, self ) + _EVENTDISPATCHER:OnDead( self._EventOnDeadOrCrash, self ) + _EVENTDISPATCHER:OnCrash( self._EventOnDeadOrCrash, self ) + + -- Follow alive players and clients +-- _EVENTDISPATCHER:OnPlayerEnterUnit( self._EventOnPlayerEnterUnit, self ) +-- _EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventOnPlayerLeaveUnit, self ) + + + return self +end + + + +----- Private method that registers all alive players in the mission. +---- @param #SET_BASE self +---- @return #SET_BASE self +--function SET_BASE:_RegisterPlayers() +-- +-- local CoalitionsData = { AlivePlayersRed = coalition.getPlayers( coalition.side.RED ), AlivePlayersBlue = coalition.getPlayers( coalition.side.BLUE ) } +-- for CoalitionId, CoalitionData in pairs( CoalitionsData ) do +-- for UnitId, UnitData in pairs( CoalitionData ) do +-- self:T3( { "UnitData:", UnitData } ) +-- if UnitData and UnitData:isExist() then +-- local UnitName = UnitData:getName() +-- if not self.PlayersAlive[UnitName] then +-- self:E( { "Add player for unit:", UnitName, UnitData:getPlayerName() } ) +-- self.PlayersAlive[UnitName] = UnitData:getPlayerName() +-- end +-- end +-- end +-- end +-- +-- return self +--end + +--- Events + +--- Handles the OnBirth event for the Set. +-- @param #SET_BASE self +-- @param Event#EVENTDATA Event +function SET_BASE:_EventOnBirth( Event ) + self:F3( { Event } ) + + if Event.IniDCSUnit then + local ObjectName, Object = self:AddInDatabase( Event ) + self:T3( ObjectName, Object ) + if self:IsIncludeObject( Object ) then + self:_Add( ObjectName, Object ) + --self:_EventOnPlayerEnterUnit( Event ) + end + end +end + +--- Handles the OnDead or OnCrash event for alive units set. +-- @param #SET_BASE self +-- @param Event#EVENTDATA Event +function SET_BASE:_EventOnDeadOrCrash( Event ) + self:F3( { Event } ) + + if Event.IniDCSUnit then + local ObjectName, Object = self:FindInDatabase( Event ) + if ObjectName and Object then + self:_Delete( ObjectName ) + end + end +end + +----- Handles the OnPlayerEnterUnit event to fill the active players table (with the unit filter applied). +---- @param #SET_BASE self +---- @param Event#EVENTDATA Event +--function SET_BASE:_EventOnPlayerEnterUnit( Event ) +-- self:F3( { Event } ) +-- +-- if Event.IniDCSUnit then +-- if self:IsIncludeObject( Event.IniDCSUnit ) then +-- if not self.PlayersAlive[Event.IniDCSUnitName] then +-- self:E( { "Add player for unit:", Event.IniDCSUnitName, Event.IniDCSUnit:getPlayerName() } ) +-- self.PlayersAlive[Event.IniDCSUnitName] = Event.IniDCSUnit:getPlayerName() +-- self.ClientsAlive[Event.IniDCSUnitName] = _DATABASE.Clients[ Event.IniDCSUnitName ] +-- end +-- end +-- end +--end +-- +----- Handles the OnPlayerLeaveUnit event to clean the active players table. +---- @param #SET_BASE self +---- @param Event#EVENTDATA Event +--function SET_BASE:_EventOnPlayerLeaveUnit( Event ) +-- self:F3( { Event } ) +-- +-- if Event.IniDCSUnit then +-- if self:IsIncludeObject( Event.IniDCSUnit ) then +-- if self.PlayersAlive[Event.IniDCSUnitName] then +-- self:E( { "Cleaning player for unit:", Event.IniDCSUnitName, Event.IniDCSUnit:getPlayerName() } ) +-- self.PlayersAlive[Event.IniDCSUnitName] = nil +-- self.ClientsAlive[Event.IniDCSUnitName] = nil +-- end +-- end +-- end +--end + +-- Iterators + +--- Interate the SET_BASE and call an interator function for the given set, providing the Object for each element within the set and optional parameters. +-- @param #SET_BASE self +-- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_BASE. +-- @return #SET_BASE self +function SET_BASE:ForEach( IteratorFunction, arg, Set, Function, FunctionArguments ) + self:F3( arg ) + + local function CoRoutine() + local Count = 0 + for ObjectID, Object in pairs( Set ) do + self:T2( Object ) + if Function( unpack( FunctionArguments ), Object ) == true then + IteratorFunction( Object, unpack( arg ) ) + end + Count = Count + 1 + if Count % 10 == 0 then + coroutine.yield( false ) + end + end + return true + end + + local co = coroutine.create( CoRoutine ) + + local function Schedule() + + local status, res = coroutine.resume( co ) + self:T3( { status, res } ) + + if status == false then + error( res ) + end + if res == false then + return true -- resume next time the loop + end + + return false + end + + local Scheduler = SCHEDULER:New( self, Schedule, {}, 0.001, 0.001, 0 ) + + return self +end + + +----- Interate the SET_BASE and call an interator function for each **alive** unit, providing the Unit and optional parameters. +---- @param #SET_BASE self +---- @param #function IteratorFunction The function that will be called when there is an alive unit in the SET_BASE. The function needs to accept a UNIT parameter. +---- @return #SET_BASE self +--function SET_BASE:ForEachDCSUnitAlive( IteratorFunction, ... ) +-- self:F3( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.DCSUnitsAlive ) +-- +-- return self +--end +-- +----- Interate the SET_BASE and call an interator function for each **alive** player, providing the Unit of the player and optional parameters. +---- @param #SET_BASE self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_BASE. The function needs to accept a UNIT parameter. +---- @return #SET_BASE self +--function SET_BASE:ForEachPlayer( IteratorFunction, ... ) +-- self:F3( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.PlayersAlive ) +-- +-- return self +--end +-- +-- +----- Interate the SET_BASE and call an interator function for each client, providing the Client to the function and optional parameters. +---- @param #SET_BASE self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_BASE. The function needs to accept a CLIENT parameter. +---- @return #SET_BASE self +--function SET_BASE:ForEachClient( IteratorFunction, ... ) +-- self:F3( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.Clients ) +-- +-- return self +--end + + +--- Decides whether to include the Object +-- @param #SET_BASE self +-- @param #table Object +-- @return #SET_BASE self +function SET_BASE:IsIncludeObject( Object ) + self:F3( Object ) + + return true +end + +--- Flushes the current SET_BASE contents in the log ... (for debug reasons). +-- @param #SET_BASE self +-- @return #string A string with the names of the objects. +function SET_BASE:Flush() + self:F3() + + local ObjectNames = "" + for ObjectName, Object in pairs( self.Set ) do + ObjectNames = ObjectNames .. ObjectName .. ", " + end + self:T( { "Objects in Set:", ObjectNames } ) + + return ObjectNames +end + +-- SET_GROUP + +--- SET_GROUP class +-- @type SET_GROUP +-- @extends Set#SET_BASE +SET_GROUP = { + ClassName = "SET_GROUP", + Filter = { + Coalitions = nil, + Categories = nil, + Countries = nil, + GroupPrefixes = nil, + }, + FilterMeta = { + Coalitions = { + red = coalition.side.RED, + blue = coalition.side.BLUE, + neutral = coalition.side.NEUTRAL, + }, + Categories = { + plane = Group.Category.AIRPLANE, + helicopter = Group.Category.HELICOPTER, + ground = Group.Category.GROUND_UNIT, + ship = Group.Category.SHIP, + structure = Group.Category.STRUCTURE, + }, + }, +} + + +--- Creates a new SET_GROUP object, building a set of groups belonging to a coalitions, categories, countries, types or with defined prefix names. +-- @param #SET_GROUP self +-- @return #SET_GROUP +-- @usage +-- -- Define a new SET_GROUP Object. This DBObject will contain a reference to all alive GROUPS. +-- DBObject = SET_GROUP:New() +function SET_GROUP:New() + + -- Inherits from BASE + local self = BASE:Inherit( self, SET_BASE:New( _DATABASE.GROUPS ) ) + + return self +end + + +--- Finds a Group based on the Group Name. +-- @param #SET_GROUP self +-- @param #string GroupName +-- @return Group#GROUP The found Group. +function SET_GROUP:FindGroup( GroupName ) + + local GroupFound = self.Set[GroupName] + return GroupFound +end + + + +--- Builds a set of groups of coalitions. +-- Possible current coalitions are red, blue and neutral. +-- @param #SET_GROUP self +-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". +-- @return #SET_GROUP self +function SET_GROUP:FilterCoalitions( Coalitions ) + if not self.Filter.Coalitions then + self.Filter.Coalitions = {} + end + if type( Coalitions ) ~= "table" then + Coalitions = { Coalitions } + end + for CoalitionID, Coalition in pairs( Coalitions ) do + self.Filter.Coalitions[Coalition] = Coalition + end + return self +end + + +--- Builds a set of groups out of categories. +-- Possible current categories are plane, helicopter, ground, ship. +-- @param #SET_GROUP self +-- @param #string Categories Can take the following values: "plane", "helicopter", "ground", "ship". +-- @return #SET_GROUP self +function SET_GROUP:FilterCategories( Categories ) + if not self.Filter.Categories then + self.Filter.Categories = {} + end + if type( Categories ) ~= "table" then + Categories = { Categories } + end + for CategoryID, Category in pairs( Categories ) do + self.Filter.Categories[Category] = Category + end + return self +end + +--- Builds a set of groups of defined countries. +-- Possible current countries are those known within DCS world. +-- @param #SET_GROUP self +-- @param #string Countries Can take those country strings known within DCS world. +-- @return #SET_GROUP self +function SET_GROUP:FilterCountries( Countries ) + if not self.Filter.Countries then + self.Filter.Countries = {} + end + if type( Countries ) ~= "table" then + Countries = { Countries } + end + for CountryID, Country in pairs( Countries ) do + self.Filter.Countries[Country] = Country + end + return self +end + + +--- Builds a set of groups of defined GROUP prefixes. +-- All the groups starting with the given prefixes will be included within the set. +-- @param #SET_GROUP self +-- @param #string Prefixes The prefix of which the group name starts with. +-- @return #SET_GROUP self +function SET_GROUP:FilterPrefixes( Prefixes ) + if not self.Filter.GroupPrefixes then + self.Filter.GroupPrefixes = {} + end + if type( Prefixes ) ~= "table" then + Prefixes = { Prefixes } + end + for PrefixID, Prefix in pairs( Prefixes ) do + self.Filter.GroupPrefixes[Prefix] = Prefix + end + return self +end + + +--- Starts the filtering. +-- @param #SET_GROUP self +-- @return #SET_GROUP self +function SET_GROUP:FilterStart() + + if _DATABASE then + self:_FilterStart() + end + + return self +end + +--- Handles the Database to check on an event (birth) that the Object was added in the Database. +-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event! +-- @param #SET_GROUP self +-- @param Event#EVENTDATA Event +-- @return #string The name of the GROUP +-- @return #table The GROUP +function SET_GROUP:AddInDatabase( Event ) + self:F3( { Event } ) + + if not self.Database[Event.IniDCSGroupName] then + self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName ) + self:T3( self.Database[Event.IniDCSGroupName] ) + end + + return Event.IniDCSGroupName, self.Database[Event.IniDCSGroupName] +end + +--- Handles the Database to check on any event that Object exists in the Database. +-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa! +-- @param #SET_GROUP self +-- @param Event#EVENTDATA Event +-- @return #string The name of the GROUP +-- @return #table The GROUP +function SET_GROUP:FindInDatabase( Event ) + self:F3( { Event } ) + + return Event.IniDCSGroupName, self.Database[Event.IniDCSGroupName] +end + +--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP, providing the GROUP and optional parameters. +-- @param #SET_GROUP self +-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter. +-- @return #SET_GROUP self +function SET_GROUP:ForEachGroup( IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set ) + + return self +end + +--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence completely in a @{Zone}, providing the GROUP and optional parameters to the called function. +-- @param #SET_GROUP self +-- @param Zone#ZONE ZoneObject The Zone to be tested for. +-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter. +-- @return #SET_GROUP self +function SET_GROUP:ForEachGroupCompletelyInZone( ZoneObject, IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set, + --- @param Zone#ZONE_BASE ZoneObject + -- @param Group#GROUP GroupObject + function( ZoneObject, GroupObject ) + if GroupObject:IsCompletelyInZone( ZoneObject ) then + return true + else + return false + end + end, { ZoneObject } ) + + return self +end + +--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence partly in a @{Zone}, providing the GROUP and optional parameters to the called function. +-- @param #SET_GROUP self +-- @param Zone#ZONE ZoneObject The Zone to be tested for. +-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter. +-- @return #SET_GROUP self +function SET_GROUP:ForEachGroupPartlyInZone( ZoneObject, IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set, + --- @param Zone#ZONE_BASE ZoneObject + -- @param Group#GROUP GroupObject + function( ZoneObject, GroupObject ) + if GroupObject:IsPartlyInZone( ZoneObject ) then + return true + else + return false + end + end, { ZoneObject } ) + + return self +end + +--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence not in a @{Zone}, providing the GROUP and optional parameters to the called function. +-- @param #SET_GROUP self +-- @param Zone#ZONE ZoneObject The Zone to be tested for. +-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter. +-- @return #SET_GROUP self +function SET_GROUP:ForEachGroupNotInZone( ZoneObject, IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set, + --- @param Zone#ZONE_BASE ZoneObject + -- @param Group#GROUP GroupObject + function( ZoneObject, GroupObject ) + if GroupObject:IsNotInZone( ZoneObject ) then + return true + else + return false + end + end, { ZoneObject } ) + + return self +end + + +----- Interate the SET_GROUP and call an interator function for each **alive** player, providing the Group of the player and optional parameters. +---- @param #SET_GROUP self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_GROUP. The function needs to accept a GROUP parameter. +---- @return #SET_GROUP self +--function SET_GROUP:ForEachPlayer( IteratorFunction, ... ) +-- self:F2( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.PlayersAlive ) +-- +-- return self +--end +-- +-- +----- Interate the SET_GROUP and call an interator function for each client, providing the Client to the function and optional parameters. +---- @param #SET_GROUP self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_GROUP. The function needs to accept a CLIENT parameter. +---- @return #SET_GROUP self +--function SET_GROUP:ForEachClient( IteratorFunction, ... ) +-- self:F2( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.Clients ) +-- +-- return self +--end + + +--- +-- @param #SET_GROUP self +-- @param Group#GROUP MooseGroup +-- @return #SET_GROUP self +function SET_GROUP:IsIncludeObject( MooseGroup ) + self:F2( MooseGroup ) + local MooseGroupInclude = true + + if self.Filter.Coalitions then + local MooseGroupCoalition = false + for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do + self:T3( { "Coalition:", MooseGroup:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } ) + if self.FilterMeta.Coalitions[CoalitionName] and self.FilterMeta.Coalitions[CoalitionName] == MooseGroup:GetCoalition() then + MooseGroupCoalition = true + end + end + MooseGroupInclude = MooseGroupInclude and MooseGroupCoalition + end + + if self.Filter.Categories then + local MooseGroupCategory = false + for CategoryID, CategoryName in pairs( self.Filter.Categories ) do + self:T3( { "Category:", MooseGroup:GetCategory(), self.FilterMeta.Categories[CategoryName], CategoryName } ) + if self.FilterMeta.Categories[CategoryName] and self.FilterMeta.Categories[CategoryName] == MooseGroup:GetCategory() then + MooseGroupCategory = true + end + end + MooseGroupInclude = MooseGroupInclude and MooseGroupCategory + end + + if self.Filter.Countries then + local MooseGroupCountry = false + for CountryID, CountryName in pairs( self.Filter.Countries ) do + self:T3( { "Country:", MooseGroup:GetCountry(), CountryName } ) + if country.id[CountryName] == MooseGroup:GetCountry() then + MooseGroupCountry = true + end + end + MooseGroupInclude = MooseGroupInclude and MooseGroupCountry + end + + if self.Filter.GroupPrefixes then + local MooseGroupPrefix = false + for GroupPrefixId, GroupPrefix in pairs( self.Filter.GroupPrefixes ) do + self:T3( { "Prefix:", string.find( MooseGroup:GetName(), GroupPrefix, 1 ), GroupPrefix } ) + if string.find( MooseGroup:GetName(), GroupPrefix, 1 ) then + MooseGroupPrefix = true + end + end + MooseGroupInclude = MooseGroupInclude and MooseGroupPrefix + end + + self:T2( MooseGroupInclude ) + return MooseGroupInclude +end + +--- SET_UNIT class +-- @type SET_UNIT +-- @extends Set#SET_BASE +SET_UNIT = { + ClassName = "SET_UNIT", + Units = {}, + Filter = { + Coalitions = nil, + Categories = nil, + Types = nil, + Countries = nil, + UnitPrefixes = nil, + }, + FilterMeta = { + Coalitions = { + red = coalition.side.RED, + blue = coalition.side.BLUE, + neutral = coalition.side.NEUTRAL, + }, + Categories = { + plane = Unit.Category.AIRPLANE, + helicopter = Unit.Category.HELICOPTER, + ground = Unit.Category.GROUND_UNIT, + ship = Unit.Category.SHIP, + structure = Unit.Category.STRUCTURE, + }, + }, +} + + +--- Creates a new SET_UNIT object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names. +-- @param #SET_UNIT self +-- @return #SET_UNIT +-- @usage +-- -- Define a new SET_UNIT Object. This DBObject will contain a reference to all alive Units. +-- DBObject = SET_UNIT:New() +function SET_UNIT:New() + + -- Inherits from BASE + local self = BASE:Inherit( self, SET_BASE:New( _DATABASE.UNITS ) ) + + return self +end + + +--- Finds a Unit based on the Unit Name. +-- @param #SET_UNIT self +-- @param #string UnitName +-- @return Unit#UNIT The found Unit. +function SET_UNIT:FindUnit( UnitName ) + + local UnitFound = self.Set[UnitName] + return UnitFound +end + + + +--- Builds a set of units of coalitions. +-- Possible current coalitions are red, blue and neutral. +-- @param #SET_UNIT self +-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". +-- @return #SET_UNIT self +function SET_UNIT:FilterCoalitions( Coalitions ) + if not self.Filter.Coalitions then + self.Filter.Coalitions = {} + end + if type( Coalitions ) ~= "table" then + Coalitions = { Coalitions } + end + for CoalitionID, Coalition in pairs( Coalitions ) do + self.Filter.Coalitions[Coalition] = Coalition + end + return self +end + + +--- Builds a set of units out of categories. +-- Possible current categories are plane, helicopter, ground, ship. +-- @param #SET_UNIT self +-- @param #string Categories Can take the following values: "plane", "helicopter", "ground", "ship". +-- @return #SET_UNIT self +function SET_UNIT:FilterCategories( Categories ) + if not self.Filter.Categories then + self.Filter.Categories = {} + end + if type( Categories ) ~= "table" then + Categories = { Categories } + end + for CategoryID, Category in pairs( Categories ) do + self.Filter.Categories[Category] = Category + end + return self +end + + +--- Builds a set of units of defined unit types. +-- Possible current types are those types known within DCS world. +-- @param #SET_UNIT self +-- @param #string Types Can take those type strings known within DCS world. +-- @return #SET_UNIT self +function SET_UNIT:FilterTypes( Types ) + if not self.Filter.Types then + self.Filter.Types = {} + end + if type( Types ) ~= "table" then + Types = { Types } + end + for TypeID, Type in pairs( Types ) do + self.Filter.Types[Type] = Type + end + return self +end + + +--- Builds a set of units of defined countries. +-- Possible current countries are those known within DCS world. +-- @param #SET_UNIT self +-- @param #string Countries Can take those country strings known within DCS world. +-- @return #SET_UNIT self +function SET_UNIT:FilterCountries( Countries ) + if not self.Filter.Countries then + self.Filter.Countries = {} + end + if type( Countries ) ~= "table" then + Countries = { Countries } + end + for CountryID, Country in pairs( Countries ) do + self.Filter.Countries[Country] = Country + end + return self +end + + +--- Builds a set of units of defined unit prefixes. +-- All the units starting with the given prefixes will be included within the set. +-- @param #SET_UNIT self +-- @param #string Prefixes The prefix of which the unit name starts with. +-- @return #SET_UNIT self +function SET_UNIT:FilterPrefixes( Prefixes ) + if not self.Filter.UnitPrefixes then + self.Filter.UnitPrefixes = {} + end + if type( Prefixes ) ~= "table" then + Prefixes = { Prefixes } + end + for PrefixID, Prefix in pairs( Prefixes ) do + self.Filter.UnitPrefixes[Prefix] = Prefix + end + return self +end + + + + +--- Starts the filtering. +-- @param #SET_UNIT self +-- @return #SET_UNIT self +function SET_UNIT:FilterStart() + + if _DATABASE then + self:_FilterStart() + end + + return self +end + +--- Handles the Database to check on an event (birth) that the Object was added in the Database. +-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event! +-- @param #SET_UNIT self +-- @param Event#EVENTDATA Event +-- @return #string The name of the UNIT +-- @return #table The UNIT +function SET_UNIT:AddInDatabase( Event ) + self:F3( { Event } ) + + if not self.Database[Event.IniDCSUnitName] then + self.Database[Event.IniDCSUnitName] = UNIT:Register( Event.IniDCSUnitName ) + self:T3( self.Database[Event.IniDCSUnitName] ) + end + + return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] +end + +--- Handles the Database to check on any event that Object exists in the Database. +-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa! +-- @param #SET_UNIT self +-- @param Event#EVENTDATA Event +-- @return #string The name of the UNIT +-- @return #table The UNIT +function SET_UNIT:FindInDatabase( Event ) + self:F3( { Event } ) + + return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] +end + +--- Interate the SET_UNIT and call an interator function for each **alive** UNIT, providing the UNIT and optional parameters. +-- @param #SET_UNIT self +-- @param #function IteratorFunction The function that will be called when there is an alive UNIT in the SET_UNIT. The function needs to accept a UNIT parameter. +-- @return #SET_UNIT self +function SET_UNIT:ForEachUnit( IteratorFunction, ... ) + self:F2( arg ) + + self:ForEach( IteratorFunction, arg, self.Set ) + + return self +end + + +----- Interate the SET_UNIT and call an interator function for each **alive** player, providing the Unit of the player and optional parameters. +---- @param #SET_UNIT self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_UNIT. The function needs to accept a UNIT parameter. +---- @return #SET_UNIT self +--function SET_UNIT:ForEachPlayer( IteratorFunction, ... ) +-- self:F2( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.PlayersAlive ) +-- +-- return self +--end +-- +-- +----- Interate the SET_UNIT and call an interator function for each client, providing the Client to the function and optional parameters. +---- @param #SET_UNIT self +---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_UNIT. The function needs to accept a CLIENT parameter. +---- @return #SET_UNIT self +--function SET_UNIT:ForEachClient( IteratorFunction, ... ) +-- self:F2( arg ) +-- +-- self:ForEach( IteratorFunction, arg, self.Clients ) +-- +-- return self +--end + + +--- +-- @param #SET_UNIT self +-- @param Unit#UNIT MUnit +-- @return #SET_UNIT self +function SET_UNIT:IsIncludeObject( MUnit ) + self:F2( MUnit ) + local MUnitInclude = true + + if self.Filter.Coalitions then + local MUnitCoalition = false + for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do + self:T3( { "Coalition:", MUnit:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } ) + if self.FilterMeta.Coalitions[CoalitionName] and self.FilterMeta.Coalitions[CoalitionName] == MUnit:GetCoalition() then + MUnitCoalition = true + end + end + MUnitInclude = MUnitInclude and MUnitCoalition + end + + if self.Filter.Categories then + local MUnitCategory = false + for CategoryID, CategoryName in pairs( self.Filter.Categories ) do + self:T3( { "Category:", MUnit:GetDesc().category, self.FilterMeta.Categories[CategoryName], CategoryName } ) + if self.FilterMeta.Categories[CategoryName] and self.FilterMeta.Categories[CategoryName] == MUnit:GetDesc().category then + MUnitCategory = true + end + end + MUnitInclude = MUnitInclude and MUnitCategory + end + + if self.Filter.Types then + local MUnitType = false + for TypeID, TypeName in pairs( self.Filter.Types ) do + self:T3( { "Type:", MUnit:GetTypeName(), TypeName } ) + if TypeName == MUnit:GetTypeName() then + MUnitType = true + end + end + MUnitInclude = MUnitInclude and MUnitType + end + + if self.Filter.Countries then + local MUnitCountry = false + for CountryID, CountryName in pairs( self.Filter.Countries ) do + self:T3( { "Country:", MUnit:GetCountry(), CountryName } ) + if country.id[CountryName] == MUnit:GetCountry() then + MUnitCountry = true + end + end + MUnitInclude = MUnitInclude and MUnitCountry + end + + if self.Filter.UnitPrefixes then + local MUnitPrefix = false + for UnitPrefixId, UnitPrefix in pairs( self.Filter.UnitPrefixes ) do + self:T3( { "Prefix:", string.find( MUnit:GetName(), UnitPrefix, 1 ), UnitPrefix } ) + if string.find( MUnit:GetName(), UnitPrefix, 1 ) then + MUnitPrefix = true + end + end + MUnitInclude = MUnitInclude and MUnitPrefix + end + + self:T2( MUnitInclude ) + return MUnitInclude +end + --- This module contains the POINT classes. -- -- 1) @{Point#POINT_VEC3} class, extends @{Base#BASE} @@ -15251,7 +16273,6 @@ function SPAWN:SpawnWithIndex( SpawnIndex ) end self.SpawnGroups[self.SpawnIndex].Spawned = true - return self.SpawnGroups[self.SpawnIndex].Group else --self:E( { self.SpawnTemplatePrefix, "No more Groups to Spawn:", SpawnIndex, self.SpawnMaxGroups } ) diff --git a/Moose Mission Setup/Moose_Create.bat b/Moose Mission Setup/Moose_Create.bat index 6e6de19f7..c83d141d0 100644 --- a/Moose Mission Setup/Moose_Create.bat +++ b/Moose Mission Setup/Moose_Create.bat @@ -48,6 +48,7 @@ COPY /b Moose.lua + %1\Zone.lua Moose.lua COPY /b Moose.lua + %1\Client.lua Moose.lua COPY /b Moose.lua + %1\Static.lua Moose.lua COPY /b Moose.lua + %1\Database.lua Moose.lua +COPY /b Moose.lua + %1\Set.lua Moose.lua COPY /b Moose.lua + %1\Point.lua Moose.lua COPY /b Moose.lua + %1\Moose.lua Moose.lua COPY /b Moose.lua + %1\Scoring.lua Moose.lua diff --git a/Moose Test Missions/Moose_Test_CLEANUP/Moose_Test_CLEANUP.miz b/Moose Test Missions/Moose_Test_CLEANUP/Moose_Test_CLEANUP.miz index 4efc70f12..928339e2b 100644 Binary files a/Moose Test Missions/Moose_Test_CLEANUP/Moose_Test_CLEANUP.miz and b/Moose Test Missions/Moose_Test_CLEANUP/Moose_Test_CLEANUP.miz differ diff --git a/Moose Test Missions/Moose_Test_DATABASE/Moose_Test_DATABASE.miz b/Moose Test Missions/Moose_Test_DATABASE/Moose_Test_DATABASE.miz index 34d99fde5..bb92da0de 100644 Binary files a/Moose Test Missions/Moose_Test_DATABASE/Moose_Test_DATABASE.miz and b/Moose Test Missions/Moose_Test_DATABASE/Moose_Test_DATABASE.miz differ diff --git a/Moose Test Missions/Moose_Test_DESTROY/MOOSE_Test_DESTROY.miz b/Moose Test Missions/Moose_Test_DESTROY/MOOSE_Test_DESTROY.miz index b18ebc538..8f3197da1 100644 Binary files a/Moose Test Missions/Moose_Test_DESTROY/MOOSE_Test_DESTROY.miz and b/Moose Test Missions/Moose_Test_DESTROY/MOOSE_Test_DESTROY.miz differ diff --git a/Moose Test Missions/Moose_Test_ESCORT/MOOSE_Test_ESCORT.miz b/Moose Test Missions/Moose_Test_ESCORT/MOOSE_Test_ESCORT.miz index c3697b525..f74c665d0 100644 Binary files a/Moose Test Missions/Moose_Test_ESCORT/MOOSE_Test_ESCORT.miz and b/Moose Test Missions/Moose_Test_ESCORT/MOOSE_Test_ESCORT.miz differ diff --git a/Moose Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz b/Moose Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz index 31b7a68b2..841ae4173 100644 Binary files a/Moose Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz and b/Moose Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz differ diff --git a/Moose Test Missions/Moose_Test_SEAD/MOOSE_Test_SEAD.miz b/Moose Test Missions/Moose_Test_SEAD/MOOSE_Test_SEAD.miz index e2ecfc1ec..e156021a3 100644 Binary files a/Moose Test Missions/Moose_Test_SEAD/MOOSE_Test_SEAD.miz and b/Moose Test Missions/Moose_Test_SEAD/MOOSE_Test_SEAD.miz differ diff --git a/Moose Test Missions/Moose_Test_SET_GROUP/Moose_Test_SET_GROUP.lua b/Moose Test Missions/Moose_Test_SET_GROUP/Moose_Test_SET_GROUP.lua new file mode 100644 index 000000000..46f65e112 --- /dev/null +++ b/Moose Test Missions/Moose_Test_SET_GROUP/Moose_Test_SET_GROUP.lua @@ -0,0 +1,140 @@ + +Include.File( 'Set' ) +Include.File( 'Spawn' ) + +SetBluePlanesGroup = SET_GROUP:New() + :FilterCoalitions( "blue" ) + :FilterCategories( "plane" ) + :FilterStart() + +SetNorthKoreaGroup = SET_GROUP:New() + :FilterCountries( "RUSSIA" ) + :FilterStart() + +SetSAMGroup = SET_GROUP:New() + :FilterPrefixes( "SAM" ) + :FilterStart() + +SpawnUS_Plane = SPAWN:New( 'Spawn Test USA Plane') +GroupUS_Plane = SpawnUS_Plane:Spawn() + +SpawnUS_Vehicle = SPAWN:New( 'Spawn Test USA Vehicle') +GroupUS_Vehicle = SpawnUS_Vehicle:Spawn() + +SpawnUS_Ship = SPAWN:New( 'Spawn Test USA Ship') +GroupUS_Ship = SpawnUS_Ship:Spawn() + +SpawnRU_Vehicle = SPAWN:New( 'Spawn Test RUSSIA Vehicle') +GroupRU_Vehicle = SpawnRU_Vehicle:Spawn() + +SpawnRU_Ship = SPAWN:New( 'Spawn Test RUSSIA Ship') +GroupRU_Ship = SpawnRU_Ship:Spawn() + +SpawnM2A2_AttackVehicle = SPAWN:New( 'Spawn Test M2A2 Attack Vehicle' ) +SpawnSAM_AttackVehicle = SPAWN:New( 'Spawn Test SAM Attack Vehicle' ) + +for i = 1, 30 do + GroupM2A2_AttackVehicle = SpawnM2A2_AttackVehicle:SpawnInZone( ZONE:New("Spawn Zone"), true) + GroupSAM_AttackVehicle = SpawnSAM_AttackVehicle:SpawnInZone( ZONE:New("Spawn Zone"), true) +end + +SetVehicleCompletely = SET_GROUP:New() + :FilterPrefixes( "Spawn Vehicle Zone Completely" ) + :FilterStart() + +SetVehiclePartly = SET_GROUP:New() + :FilterPrefixes( "Spawn Vehicle Zone Partly" ) + :FilterStart() + +SetVehicleNot = SET_GROUP:New() + :FilterPrefixes( "Spawn Vehicle Zone Not" ) + :FilterStart() + +Spawn_Vehicle_Zone_Completely = SPAWN:New( 'Spawn Vehicle Zone Completely' ) +Spawn_Vehicle_Zone_Partly = SPAWN:New( 'Spawn Vehicle Zone Partly' ) +Spawn_Vehicle_Zone_Not = SPAWN:New( 'Spawn Vehicle Zone Not' ) +for i = 1, 30 do + Spawn_Vehicle_Zone_Completely:SpawnInZone( ZONE:New("Spawn Zone Completely"), true) + Spawn_Vehicle_Zone_Partly:SpawnInZone( ZONE:New("Spawn Zone Partly"), true) + Spawn_Vehicle_Zone_Not:SpawnInZone( ZONE:New("Spawn Zone Not"), true) +end + +--DBBlue:TraceDatabase() +--SCHEDULER:New( DBBluePlanes, DBBluePlanes.Flush, { }, 1 ) +--SCHEDULER:New( DBRedVehicles, DBRedVehicles.Flush, { }, 1 ) +--SCHEDULER:New( DBShips, DBShips.Flush, { }, 1 ) +--SCHEDULER:New( DBBelgium, DBBelgium.Flush, { }, 1 ) +--SCHEDULER:New( DBNorthKorea, DBNorthKorea.Flush, { }, 1 ) +--SCHEDULER:New( DBKA50Vinson, DBKA50Vinson.Flush, { }, 1 ) +-- +--SCHEDULER:New( DBBluePlanesGroup, DBBluePlanesGroup.Flush, { }, 1 ) +--SCHEDULER:New( DBNorthKoreaGroup, DBNorthKoreaGroup.Flush, { }, 1 ) + +SetBluePlanesGroup:ForEachGroup( + --- @param Group#GROUP MooseGroup + function( MooseGroup ) + for UnitId, UnitData in pairs( MooseGroup:GetUnits() ) do + local UnitAction = UnitData -- Unit#UNIT + UnitAction:SmokeBlue() + end + end +) + +SetNorthKoreaGroup:ForEachGroup( + --- @param Group#GROUP MooseGroup + function( MooseGroup ) + for UnitId, UnitData in pairs( MooseGroup:GetUnits() ) do + local UnitAction = UnitData -- Unit#UNIT + UnitAction:SmokeRed() + end + end +) + +SetSAMGroup:ForEachGroup( + --- @param Group#GROUP MooseGroup + function( MooseGroup ) + for UnitId, UnitData in pairs( MooseGroup:GetUnits() ) do + local UnitAction = UnitData -- Unit#UNIT + UnitAction:SmokeOrange() + end + end +) + +GroupZoneCompletely = GROUP:FindByName( "Zone Completely" ) +GroupZonePartly = GROUP:FindByName( "Zone Partly" ) +GroupZoneNot = GROUP:FindByName( "Zone Not" ) + +ZoneCompletely = ZONE_POLYGON:New( "Zone Completely", GroupZoneCompletely ):SmokeZone( POINT_VEC3.SmokeColor.White ) +ZonePartly = ZONE_POLYGON:New( "Zone Partly", GroupZonePartly ):SmokeZone( POINT_VEC3.SmokeColor.White ) +ZoneNot = ZONE_POLYGON:New( "Zone Not", GroupZoneNot ):SmokeZone( POINT_VEC3.SmokeColor.White ) + +SetVehicleCompletely:ForEachGroupCompletelyInZone( ZoneCompletely, + --- @param Group#GROUP MooseGroup + function( MooseGroup ) + for UnitId, UnitData in pairs( MooseGroup:GetUnits() ) do + local UnitAction = UnitData -- Unit#UNIT + UnitAction:SmokeBlue() + end + end +) + +SetVehiclePartly:ForEachGroupPartlyInZone( ZonePartly, + --- @param Group#GROUP MooseGroup + function( MooseGroup ) + for UnitId, UnitData in pairs( MooseGroup:GetUnits() ) do + local UnitAction = UnitData -- Unit#UNIT + UnitAction:SmokeBlue() + end + end +) + +SetVehicleNot:ForEachGroupNotInZone( ZoneNot, + --- @param Group#GROUP MooseGroup + function( MooseGroup ) + for UnitId, UnitData in pairs( MooseGroup:GetUnits() ) do + local UnitAction = UnitData -- Unit#UNIT + UnitAction:SmokeBlue() + end + end +) + \ No newline at end of file diff --git a/Moose Test Missions/Moose_Test_SET_GROUP/Moose_Test_SET_GROUP.miz b/Moose Test Missions/Moose_Test_SET_GROUP/Moose_Test_SET_GROUP.miz new file mode 100644 index 000000000..ff34c3c56 Binary files /dev/null and b/Moose Test Missions/Moose_Test_SET_GROUP/Moose_Test_SET_GROUP.miz differ diff --git a/Moose Test Missions/Moose_Test_SPAWN/MOOSE_Test_SPAWN.miz b/Moose Test Missions/Moose_Test_SPAWN/MOOSE_Test_SPAWN.miz index c24c54e08..3f86dba7e 100644 Binary files a/Moose Test Missions/Moose_Test_SPAWN/MOOSE_Test_SPAWN.miz and b/Moose Test Missions/Moose_Test_SPAWN/MOOSE_Test_SPAWN.miz differ diff --git a/Moose Test Missions/Moose_Test_SPAWN_Repeat/MOOSE_Test_SPAWN_Repeat.miz b/Moose Test Missions/Moose_Test_SPAWN_Repeat/MOOSE_Test_SPAWN_Repeat.miz index f027c4c2b..e6d5241b0 100644 Binary files a/Moose Test Missions/Moose_Test_SPAWN_Repeat/MOOSE_Test_SPAWN_Repeat.miz and b/Moose Test Missions/Moose_Test_SPAWN_Repeat/MOOSE_Test_SPAWN_Repeat.miz differ diff --git a/Moose Test Missions/Moose_Test_TASK_Pickup_and_Deploy/MOOSE_Test_TASK_Pickup_and_Deploy.miz b/Moose Test Missions/Moose_Test_TASK_Pickup_and_Deploy/MOOSE_Test_TASK_Pickup_and_Deploy.miz index 6368d9a31..8b181a119 100644 Binary files a/Moose Test Missions/Moose_Test_TASK_Pickup_and_Deploy/MOOSE_Test_TASK_Pickup_and_Deploy.miz and b/Moose Test Missions/Moose_Test_TASK_Pickup_and_Deploy/MOOSE_Test_TASK_Pickup_and_Deploy.miz differ diff --git a/Moose Test Missions/Moose_Test_WRAPPER/Moose_Test_WRAPPER.miz b/Moose Test Missions/Moose_Test_WRAPPER/Moose_Test_WRAPPER.miz index 3a2f0591a..79f9a2386 100644 Binary files a/Moose Test Missions/Moose_Test_WRAPPER/Moose_Test_WRAPPER.miz and b/Moose Test Missions/Moose_Test_WRAPPER/Moose_Test_WRAPPER.miz differ diff --git a/Moose Test Missions/Moose_Test_ZONE/Moose_Test_ZONE.miz b/Moose Test Missions/Moose_Test_ZONE/Moose_Test_ZONE.miz index 0f9f80e19..da611d379 100644 Binary files a/Moose Test Missions/Moose_Test_ZONE/Moose_Test_ZONE.miz and b/Moose Test Missions/Moose_Test_ZONE/Moose_Test_ZONE.miz differ diff --git a/Moose Test Missions/Moose_Test_ZONE_POLYGON/Moose_Test_ZONE_POLYGON.miz b/Moose Test Missions/Moose_Test_ZONE_POLYGON/Moose_Test_ZONE_POLYGON.miz index cb1163829..0704d9e83 100644 Binary files a/Moose Test Missions/Moose_Test_ZONE_POLYGON/Moose_Test_ZONE_POLYGON.miz and b/Moose Test Missions/Moose_Test_ZONE_POLYGON/Moose_Test_ZONE_POLYGON.miz differ diff --git a/Moose Test Missions/Moose_Test_ZONE_RADIUS/Moose_Test_ZONE_RADIUS.miz b/Moose Test Missions/Moose_Test_ZONE_RADIUS/Moose_Test_ZONE_RADIUS.miz index c3e2b170d..ae305da72 100644 Binary files a/Moose Test Missions/Moose_Test_ZONE_RADIUS/Moose_Test_ZONE_RADIUS.miz and b/Moose Test Missions/Moose_Test_ZONE_RADIUS/Moose_Test_ZONE_RADIUS.miz differ diff --git a/Moose Test Missions/Moose_Test_ZONE_UNIT/Moose_Test_ZONE_UNIT.miz b/Moose Test Missions/Moose_Test_ZONE_UNIT/Moose_Test_ZONE_UNIT.miz index ecea055ac..a2bcee063 100644 Binary files a/Moose Test Missions/Moose_Test_ZONE_UNIT/Moose_Test_ZONE_UNIT.miz and b/Moose Test Missions/Moose_Test_ZONE_UNIT/Moose_Test_ZONE_UNIT.miz differ diff --git a/Moose Training/Documentation/Airbase.html b/Moose Training/Documentation/Airbase.html index be9848189..528f6b026 100644 --- a/Moose Training/Documentation/Airbase.html +++ b/Moose Training/Documentation/Airbase.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Base.html b/Moose Training/Documentation/Base.html index bd96b901b..fb63c1547 100644 --- a/Moose Training/Documentation/Base.html +++ b/Moose Training/Documentation/Base.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/CARGO.html b/Moose Training/Documentation/CARGO.html index b87c177e3..a6736c085 100644 --- a/Moose Training/Documentation/CARGO.html +++ b/Moose Training/Documentation/CARGO.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/CleanUp.html b/Moose Training/Documentation/CleanUp.html index d1ade1478..192c54b52 100644 --- a/Moose Training/Documentation/CleanUp.html +++ b/Moose Training/Documentation/CleanUp.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Client.html b/Moose Training/Documentation/Client.html index d0fc0da40..c598043e8 100644 --- a/Moose Training/Documentation/Client.html +++ b/Moose Training/Documentation/Client.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DCSAirbase.html b/Moose Training/Documentation/DCSAirbase.html index da2207317..20c970f2a 100644 --- a/Moose Training/Documentation/DCSAirbase.html +++ b/Moose Training/Documentation/DCSAirbase.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DCSCoalitionObject.html b/Moose Training/Documentation/DCSCoalitionObject.html index 563037392..a6e10abeb 100644 --- a/Moose Training/Documentation/DCSCoalitionObject.html +++ b/Moose Training/Documentation/DCSCoalitionObject.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DCSCommand.html b/Moose Training/Documentation/DCSCommand.html index e52889367..38d4e6b58 100644 --- a/Moose Training/Documentation/DCSCommand.html +++ b/Moose Training/Documentation/DCSCommand.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DCSController.html b/Moose Training/Documentation/DCSController.html index eabadf9b3..763eb4b79 100644 --- a/Moose Training/Documentation/DCSController.html +++ b/Moose Training/Documentation/DCSController.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DCSGroup.html b/Moose Training/Documentation/DCSGroup.html index d3dc0c75a..685694b71 100644 --- a/Moose Training/Documentation/DCSGroup.html +++ b/Moose Training/Documentation/DCSGroup.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DCSObject.html b/Moose Training/Documentation/DCSObject.html index 5120affce..a255ab69c 100644 --- a/Moose Training/Documentation/DCSObject.html +++ b/Moose Training/Documentation/DCSObject.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DCSTask.html b/Moose Training/Documentation/DCSTask.html index cdbe87871..47a8e0e8e 100644 --- a/Moose Training/Documentation/DCSTask.html +++ b/Moose Training/Documentation/DCSTask.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DCSTypes.html b/Moose Training/Documentation/DCSTypes.html index e4fa753f7..39b519636 100644 --- a/Moose Training/Documentation/DCSTypes.html +++ b/Moose Training/Documentation/DCSTypes.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DCSUnit.html b/Moose Training/Documentation/DCSUnit.html index 20b5c9f57..421156d53 100644 --- a/Moose Training/Documentation/DCSUnit.html +++ b/Moose Training/Documentation/DCSUnit.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DCSWorld.html b/Moose Training/Documentation/DCSWorld.html index 8afaae99a..21cb3b7d6 100644 --- a/Moose Training/Documentation/DCSWorld.html +++ b/Moose Training/Documentation/DCSWorld.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DCStimer.html b/Moose Training/Documentation/DCStimer.html index e09e649cb..f1d0e61d4 100644 --- a/Moose Training/Documentation/DCStimer.html +++ b/Moose Training/Documentation/DCStimer.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DEPLOYTASK.html b/Moose Training/Documentation/DEPLOYTASK.html index 02f845c63..75ab0d37a 100644 --- a/Moose Training/Documentation/DEPLOYTASK.html +++ b/Moose Training/Documentation/DEPLOYTASK.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DESTROYBASETASK.html b/Moose Training/Documentation/DESTROYBASETASK.html index fb41bfe0f..03d0d6973 100644 --- a/Moose Training/Documentation/DESTROYBASETASK.html +++ b/Moose Training/Documentation/DESTROYBASETASK.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DESTROYGROUPSTASK.html b/Moose Training/Documentation/DESTROYGROUPSTASK.html index 22e462095..b1afdec18 100644 --- a/Moose Training/Documentation/DESTROYGROUPSTASK.html +++ b/Moose Training/Documentation/DESTROYGROUPSTASK.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DESTROYRADARSTASK.html b/Moose Training/Documentation/DESTROYRADARSTASK.html index f61ac25ed..09c66cdbd 100644 --- a/Moose Training/Documentation/DESTROYRADARSTASK.html +++ b/Moose Training/Documentation/DESTROYRADARSTASK.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/DESTROYUNITTYPESTASK.html b/Moose Training/Documentation/DESTROYUNITTYPESTASK.html index bea58fa6f..cdf34dece 100644 --- a/Moose Training/Documentation/DESTROYUNITTYPESTASK.html +++ b/Moose Training/Documentation/DESTROYUNITTYPESTASK.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Database.html b/Moose Training/Documentation/Database.html index e4a84907d..f59745b8f 100644 --- a/Moose Training/Documentation/Database.html +++ b/Moose Training/Documentation/Database.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Escort.html b/Moose Training/Documentation/Escort.html index 5a831df88..b0c1318cd 100644 --- a/Moose Training/Documentation/Escort.html +++ b/Moose Training/Documentation/Escort.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Event.html b/Moose Training/Documentation/Event.html index 11e6c6d9a..c455ef683 100644 --- a/Moose Training/Documentation/Event.html +++ b/Moose Training/Documentation/Event.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/GOHOMETASK.html b/Moose Training/Documentation/GOHOMETASK.html index 407e6bfac..169154def 100644 --- a/Moose Training/Documentation/GOHOMETASK.html +++ b/Moose Training/Documentation/GOHOMETASK.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Group.html b/Moose Training/Documentation/Group.html index 3bd916c01..4d5dda341 100644 --- a/Moose Training/Documentation/Group.html +++ b/Moose Training/Documentation/Group.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/MISSION.html b/Moose Training/Documentation/MISSION.html index 977eb7641..bb0b028e1 100644 --- a/Moose Training/Documentation/MISSION.html +++ b/Moose Training/Documentation/MISSION.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/MOVEMENT.html b/Moose Training/Documentation/MOVEMENT.html index 8808e50ae..e780c1960 100644 --- a/Moose Training/Documentation/MOVEMENT.html +++ b/Moose Training/Documentation/MOVEMENT.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Menu.html b/Moose Training/Documentation/Menu.html index 6b2a14236..1030e5d3c 100644 --- a/Moose Training/Documentation/Menu.html +++ b/Moose Training/Documentation/Menu.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Message.html b/Moose Training/Documentation/Message.html index 0646a26d4..b272f052c 100644 --- a/Moose Training/Documentation/Message.html +++ b/Moose Training/Documentation/Message.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/MissileTrainer.html b/Moose Training/Documentation/MissileTrainer.html index ca64eaf84..cb7573dbd 100644 --- a/Moose Training/Documentation/MissileTrainer.html +++ b/Moose Training/Documentation/MissileTrainer.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/NOTASK.html b/Moose Training/Documentation/NOTASK.html index 932d91fa2..a16acc7f7 100644 --- a/Moose Training/Documentation/NOTASK.html +++ b/Moose Training/Documentation/NOTASK.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/PICKUPTASK.html b/Moose Training/Documentation/PICKUPTASK.html index e19440ba3..88c16ead1 100644 --- a/Moose Training/Documentation/PICKUPTASK.html +++ b/Moose Training/Documentation/PICKUPTASK.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Point.html b/Moose Training/Documentation/Point.html index 90905194b..84d50a13d 100644 --- a/Moose Training/Documentation/Point.html +++ b/Moose Training/Documentation/Point.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/ROUTETASK.html b/Moose Training/Documentation/ROUTETASK.html index 05977ad42..6808f2933 100644 --- a/Moose Training/Documentation/ROUTETASK.html +++ b/Moose Training/Documentation/ROUTETASK.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/STAGE.html b/Moose Training/Documentation/STAGE.html index 3cd29ea7b..d4e26709d 100644 --- a/Moose Training/Documentation/STAGE.html +++ b/Moose Training/Documentation/STAGE.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Scheduler.html b/Moose Training/Documentation/Scheduler.html index 0ca0aa1dc..55b979b86 100644 --- a/Moose Training/Documentation/Scheduler.html +++ b/Moose Training/Documentation/Scheduler.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Scoring.html b/Moose Training/Documentation/Scoring.html index 10a4e3e44..c37ce03ca 100644 --- a/Moose Training/Documentation/Scoring.html +++ b/Moose Training/Documentation/Scoring.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Sead.html b/Moose Training/Documentation/Sead.html index 10b277bd4..f756d0ec7 100644 --- a/Moose Training/Documentation/Sead.html +++ b/Moose Training/Documentation/Sead.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Set.html b/Moose Training/Documentation/Set.html index 12c0764fe..5fb1409fc 100644 --- a/Moose Training/Documentation/Set.html +++ b/Moose Training/Documentation/Set.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • @@ -73,12 +71,71 @@

    Module Set

    -

    Manage sets of units and groups.

    +

    This module contains the SET classes.

    -

    #Set class

    -

    Mission designers can use the SET class to build sets of units belonging to certain:

    +
    + +

    1) Set#SET_BASE class, extending Base#BASE

    +

    The Set#SET_BASE class defines the core functions that define a collection of objects.

    + +
    + +

    2) Set#SET_GROUP class, extending Set#SET_BASE

    +

    Mission designers can use the Set#SET_GROUP class to build sets of groups belonging to certain:

    + + + +

    2.1) SET_GROUP construction methods:

    +

    Create a new SET_GROUP object with the SET_GROUP.New method:

    + + + +

    2.2) SET_GROUP filter criteria:

    +

    You can set filter criteria to define the set of groups within the SET_GROUP. +Filter criteria are defined by:

    + + + +

    Once the filter criteria have been set for the SET_GROUP, you can start filtering using:

    + + + +

    Planned filter criteria within development are (so these are not yet available):

    + + + + +

    2.3) SET_GROUP iterators:

    +

    Once the filters have been defined and the SETGROUP has been built, you can iterate the SETGROUP with the available iterator methods. +The iterator methods will walk the SETGROUP set, and call for each element within the set a function that you provide. +The following iterator methods are currently available within the SETGROUP:

    + + + +
    + +

    3) Set#SET_UNIT class, extending Set#SET_BASE

    +

    Mission designers can use the Set#SET_UNIT class to build sets of units belonging to certain:

    -

    This list will grow over time. Planned developments are to include filters and iterators. -Additional filters will be added around Zone#ZONEs, Radiuses, Active players, ... -More iterators will be implemented in the near future ...

    - -

    Administers the Initial Sets of the Mission Templates as defined within the Mission Editor.

    - -

    SET construction methods:

    -

    Create a new SET object with the SET.New method:

    +

    3.1) SET_UNIT construction methods:

    +

    Create a new SET_UNIT object with the SET_UNIT.New method:

    -

    SET filter criteria:

    -

    You can set filter criteria to define the set of units within the SET. +

    3.2) SET_UNIT filter criteria:

    +

    You can set filter criteria to define the set of units within the SET_UNIT. Filter criteria are defined by:

    -

    Once the filter criteria have been set for the SET, you can start filtering using:

    +

    Once the filter criteria have been set for the SET_UNIT, you can start filtering using:

    Planned filter criteria within development are (so these are not yet available):

    - -

    SET iterators:

    -

    Once the filters have been defined and the SET has been built, you can iterate the SET with the available iterator methods. -The iterator methods will walk the SET set, and call for each element within the set a function that you provide. -The following iterator methods are currently available within the SET:

    +

    3.3) SET_UNIT iterators:

    +

    Once the filters have been defined and the SETUNIT has been built, you can iterate the SETUNIT with the available iterator methods. +The iterator methods will walk the SETUNIT set, and call for each element within the set a function that you provide. +The following iterator methods are currently available within the SETUNIT:

    Planned iterators methods in development are (so these are not yet available):

    +
    +

    Global(s)

    - + + + + + + + + +
    SETSET_BASE + +
    SET_GROUP + +
    SET_UNIT
    -

    Type SET

    +

    Type SET_BASE

    - + - + - + - + - + - + - + - + - + - + - + - + + +
    SET.ClassNameSET_BASE.ClassName
    SET.DatabaseSET_BASE.Database
    SET:Flush()SET_BASE:Flush() -

    Flushes the current SET contents in the log ...

    +

    Flushes the current SET_BASE contents in the log ...

    SET:ForEach(IteratorFunction, arg, Set)SET_BASE:ForEach(IteratorFunction, arg, Set, Function, FunctionArguments) -

    Interate the SET and call an interator function for the given set, providing the Object for each element within the set and optional parameters.

    +

    Interate the SET_BASE and call an interator function for the given set, providing the Object for each element within the set and optional parameters.

    SET:IsIncludeObject(Object)SET_BASE:IsIncludeObject(Object)

    Decides whether to include the Object

    SET:New(Database)SET_BASE:New(Database) -

    Creates a new SET object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names.

    +

    Creates a new SET_BASE object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names.

    SET.SetSET_BASE.Set
    SET:_Add(ObjectName, Object)SET_BASE:_Add(ObjectName, Object)

    Adds a Object based on the Object Name.

    SET:_EventOnBirth(Event)SET_BASE:_EventOnBirth(Event)

    Handles the OnBirth event for the Set.

    SET:_EventOnDeadOrCrash(Event)SET_BASE:_EventOnDeadOrCrash(Event)

    Handles the OnDead or OnCrash event for alive units set.

    SET:_FilterStart()SET_BASE:_FilterStart()

    Starts the filtering for the defined collection.

    SET:_Find(ObjectName)SET_BASE:_Find(ObjectName)

    Finds an Object based on the Object Name.

    +
    + +

    Type SET_GROUP

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SET_GROUP:AddInDatabase(Event) +

    Handles the Database to check on an event (birth) that the Object was added in the Database.

    +
    SET_GROUP.ClassName + +
    SET_GROUP.Filter + +
    SET_GROUP:FilterCategories(Categories) +

    Builds a set of groups out of categories.

    +
    SET_GROUP:FilterCoalitions(Coalitions) +

    Builds a set of groups of coalitions.

    +
    SET_GROUP:FilterCountries(Countries) +

    Builds a set of groups of defined countries.

    +
    SET_GROUP.FilterMeta + +
    SET_GROUP:FilterPrefixes(Prefixes) +

    Builds a set of groups of defined GROUP prefixes.

    +
    SET_GROUP:FilterStart() +

    Starts the filtering.

    +
    SET_GROUP:FindGroup(GroupName) +

    Finds a Group based on the Group Name.

    +
    SET_GROUP:FindInDatabase(Event) +

    Handles the Database to check on any event that Object exists in the Database.

    +
    SET_GROUP:ForEachGroup(IteratorFunction, ...) +

    Iterate the SET_GROUP and call an iterator function for each alive GROUP, providing the GROUP and optional parameters.

    +
    SET_GROUP:ForEachGroupCompletelyInZone(ZoneObject, IteratorFunction, ...) +

    Iterate the SET_GROUP and call an iterator function for each alive GROUP presence completely in a Zone, providing the GROUP and optional parameters to the called function.

    +
    SET_GROUP:ForEachGroupNotInZone(ZoneObject, IteratorFunction, ...) +

    Iterate the SET_GROUP and call an iterator function for each alive GROUP presence not in a Zone, providing the GROUP and optional parameters to the called function.

    +
    SET_GROUP:ForEachGroupPartlyInZone(ZoneObject, IteratorFunction, ...) +

    Iterate the SET_GROUP and call an iterator function for each alive GROUP presence partly in a Zone, providing the GROUP and optional parameters to the called function.

    +
    SET_GROUP:IsIncludeObject(MooseGroup) + +
    SET_GROUP:New() +

    Creates a new SET_GROUP object, building a set of groups belonging to a coalitions, categories, countries, types or with defined prefix names.

    +
    + +

    Type SET_UNIT

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SET_UNIT:AddInDatabase(Event) +

    Handles the Database to check on an event (birth) that the Object was added in the Database.

    +
    SET_UNIT.ClassName + +
    SET_UNIT.Filter + +
    SET_UNIT:FilterCategories(Categories) +

    Builds a set of units out of categories.

    +
    SET_UNIT:FilterCoalitions(Coalitions) +

    Builds a set of units of coalitions.

    +
    SET_UNIT:FilterCountries(Countries) +

    Builds a set of units of defined countries.

    +
    SET_UNIT.FilterMeta + +
    SET_UNIT:FilterPrefixes(Prefixes) +

    Builds a set of units of defined unit prefixes.

    +
    SET_UNIT:FilterStart() +

    Starts the filtering.

    +
    SET_UNIT:FilterTypes(Types) +

    Builds a set of units of defined unit types.

    +
    SET_UNIT:FindInDatabase(Event) +

    Handles the Database to check on any event that Object exists in the Database.

    +
    SET_UNIT:FindUnit(UnitName) +

    Finds a Unit based on the Unit Name.

    +
    SET_UNIT:ForEachUnit(IteratorFunction, ...) +

    Interate the SET_UNIT and call an interator function for each alive UNIT, providing the UNIT and optional parameters.

    +
    SET_UNIT:IsIncludeObject(MUnit) + +
    SET_UNIT:New() +

    Creates a new SET_UNIT object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names.

    +
    SET_UNIT.Units +
    @@ -236,9 +504,37 @@ The following iterator methods are currently available within the SET:

    - #SET - -SET + #SET_BASE + +SET_BASE + +
    +
    + + + +
    +
    +
    +
    + + #SET_GROUP + +SET_GROUP + +
    +
    + + + +
    +
    +
    +
    + + #SET_UNIT + +SET_UNIT
    @@ -249,17 +545,17 @@ The following iterator methods are currently available within the SET:

    Type Set

    -

    Type SET

    +

    Type SET_BASE

    -

    SET class

    +

    SET_BASE class

    Field(s)

    #string - -SET.ClassName + +SET_BASE.ClassName
    @@ -272,8 +568,8 @@ The following iterator methods are currently available within the SET:

    - -SET.Database + +SET_BASE.Database
    @@ -285,13 +581,13 @@ The following iterator methods are currently available within the SET:

    - -SET:Flush() + +SET_BASE:Flush()
    -

    Flushes the current SET contents in the log ...

    +

    Flushes the current SET_BASE contents in the log ...

    (for debug reasons).

    @@ -306,20 +602,20 @@ A string with the names of the objects.

    - -SET:ForEach(IteratorFunction, arg, Set) + +SET_BASE:ForEach(IteratorFunction, arg, Set, Function, FunctionArguments)
    -

    Interate the SET and call an interator function for the given set, providing the Object for each element within the set and optional parameters.

    +

    Interate the SET_BASE and call an interator function for the given set, providing the Object for each element within the set and optional parameters.

    Parameters

    • #function IteratorFunction : -The function that will be called when there is an alive player in the SET.

      +The function that will be called when there is an alive player in the SET_BASE.

    • @@ -331,11 +627,21 @@ The function that will be called when there is an alive player in the SET.

      Set :

      +
    • +
    • + +

      Function :

      + +
    • +
    • + +

      FunctionArguments :

      +

    Return value

    -

    #SET: +

    #SET_BASE: self

    @@ -343,8 +649,8 @@ self

    - -SET:IsIncludeObject(Object) + +SET_BASE:IsIncludeObject(Object)
    @@ -361,7 +667,7 @@ self

    Return value

    -

    #SET: +

    #SET_BASE: self

    @@ -369,13 +675,13 @@ self

    - -SET:New(Database) + +SET_BASE:New(Database)
    -

    Creates a new SET object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names.

    +

    Creates a new SET_BASE object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names.

    Parameter

      @@ -387,12 +693,12 @@ self

    Return value

    -

    #SET:

    +

    #SET_BASE:

    Usage:

    -
    -- Define a new SET Object. This DBObject will contain a reference to all Group and Unit Templates defined within the ME and the DCSRTE.
    -DBObject = SET:New()
    +
    -- Define a new SET_BASE Object. This DBObject will contain a reference to all Group and Unit Templates defined within the ME and the DCSRTE.
    +DBObject = SET_BASE:New()
    @@ -400,8 +706,8 @@ DBObject = SET:New()
    - -SET.Set + +SET_BASE.Set
    @@ -413,8 +719,8 @@ DBObject = SET:New()
    - -SET:_Add(ObjectName, Object) + +SET_BASE:_Add(ObjectName, Object)
    @@ -444,8 +750,8 @@ The added Object.

    - -SET:_EventOnBirth(Event) + +SET_BASE:_EventOnBirth(Event)
    @@ -465,8 +771,8 @@ The added Object.

    - -SET:_EventOnDeadOrCrash(Event) + +SET_BASE:_EventOnDeadOrCrash(Event)
    @@ -486,8 +792,8 @@ The added Object.

    - -SET:_FilterStart() + +SET_BASE:_FilterStart()
    @@ -496,7 +802,7 @@ The added Object.

    Return value

    -

    #SET: +

    #SET_BASE: self

    @@ -504,8 +810,8 @@ self

    - -SET:_Find(ObjectName) + +SET_BASE:_Find(ObjectName)
    @@ -525,6 +831,904 @@ self

    #table: The Object found.

    +
    +
    + +

    Type SET_GROUP

    + +

    SET_GROUP class

    + +

    Field(s)

    +
    +
    + + +SET_GROUP:AddInDatabase(Event) + +
    +
    + +

    Handles the Database to check on an event (birth) that the Object was added in the Database.

    + + +

    This is required, because sometimes the DATABASE birth event gets called later than the SETBASE birth event!

    + +

    Parameter

    + +

    Return values

    +
      +
    1. + +

      #string: +The name of the GROUP

      + +
    2. +
    3. + +

      #table: +The GROUP

      + +
    4. +
    +
    +
    +
    +
    + + #string + +SET_GROUP.ClassName + +
    +
    + + + +
    +
    +
    +
    + + + +SET_GROUP.Filter + +
    +
    + + + +
    +
    +
    +
    + + +SET_GROUP:FilterCategories(Categories) + +
    +
    + +

    Builds a set of groups out of categories.

    + + +

    Possible current categories are plane, helicopter, ground, ship.

    + +

    Parameter

    +
      +
    • + +

      #string Categories : +Can take the following values: "plane", "helicopter", "ground", "ship".

      + +
    • +
    +

    Return value

    + +

    #SET_GROUP: +self

    + +
    +
    +
    +
    + + +SET_GROUP:FilterCoalitions(Coalitions) + +
    +
    + +

    Builds a set of groups of coalitions.

    + + +

    Possible current coalitions are red, blue and neutral.

    + +

    Parameter

    +
      +
    • + +

      #string Coalitions : +Can take the following values: "red", "blue", "neutral".

      + +
    • +
    +

    Return value

    + +

    #SET_GROUP: +self

    + +
    +
    +
    +
    + + +SET_GROUP:FilterCountries(Countries) + +
    +
    + +

    Builds a set of groups of defined countries.

    + + +

    Possible current countries are those known within DCS world.

    + +

    Parameter

    +
      +
    • + +

      #string Countries : +Can take those country strings known within DCS world.

      + +
    • +
    +

    Return value

    + +

    #SET_GROUP: +self

    + +
    +
    +
    +
    + + + +SET_GROUP.FilterMeta + +
    +
    + + + +
    +
    +
    +
    + + +SET_GROUP:FilterPrefixes(Prefixes) + +
    +
    + +

    Builds a set of groups of defined GROUP prefixes.

    + + +

    All the groups starting with the given prefixes will be included within the set.

    + +

    Parameter

    +
      +
    • + +

      #string Prefixes : +The prefix of which the group name starts with.

      + +
    • +
    +

    Return value

    + +

    #SET_GROUP: +self

    + +
    +
    +
    +
    + + +SET_GROUP:FilterStart() + +
    +
    + +

    Starts the filtering.

    + +

    Return value

    + +

    #SET_GROUP: +self

    + +
    +
    +
    +
    + + +SET_GROUP:FindGroup(GroupName) + +
    +
    + +

    Finds a Group based on the Group Name.

    + +

    Parameter

    +
      +
    • + +

      #string GroupName :

      + +
    • +
    +

    Return value

    + +

    Group#GROUP: +The found Group.

    + +
    +
    +
    +
    + + +SET_GROUP:FindInDatabase(Event) + +
    +
    + +

    Handles the Database to check on any event that Object exists in the Database.

    + + +

    This is required, because sometimes the DATABASE event gets called later than the SETBASE event or vise versa!

    + +

    Parameter

    + +

    Return values

    +
      +
    1. + +

      #string: +The name of the GROUP

      + +
    2. +
    3. + +

      #table: +The GROUP

      + +
    4. +
    +
    +
    +
    +
    + + +SET_GROUP:ForEachGroup(IteratorFunction, ...) + +
    +
    + +

    Iterate the SET_GROUP and call an iterator function for each alive GROUP, providing the GROUP and optional parameters.

    + +

    Parameters

    +
      +
    • + +

      #function IteratorFunction : +The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter.

      + +
    • +
    • + +

      ... :

      + +
    • +
    +

    Return value

    + +

    #SET_GROUP: +self

    + +
    +
    +
    +
    + + +SET_GROUP:ForEachGroupCompletelyInZone(ZoneObject, IteratorFunction, ...) + +
    +
    + +

    Iterate the SET_GROUP and call an iterator function for each alive GROUP presence completely in a Zone, providing the GROUP and optional parameters to the called function.

    + +

    Parameters

    +
      +
    • + +

      Zone#ZONE ZoneObject : +The Zone to be tested for.

      + +
    • +
    • + +

      #function IteratorFunction : +The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter.

      + +
    • +
    • + +

      ... :

      + +
    • +
    +

    Return value

    + +

    #SET_GROUP: +self

    + +
    +
    +
    +
    + + +SET_GROUP:ForEachGroupNotInZone(ZoneObject, IteratorFunction, ...) + +
    +
    + +

    Iterate the SET_GROUP and call an iterator function for each alive GROUP presence not in a Zone, providing the GROUP and optional parameters to the called function.

    + +

    Parameters

    +
      +
    • + +

      Zone#ZONE ZoneObject : +The Zone to be tested for.

      + +
    • +
    • + +

      #function IteratorFunction : +The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter.

      + +
    • +
    • + +

      ... :

      + +
    • +
    +

    Return value

    + +

    #SET_GROUP: +self

    + +
    +
    +
    +
    + + +SET_GROUP:ForEachGroupPartlyInZone(ZoneObject, IteratorFunction, ...) + +
    +
    + +

    Iterate the SET_GROUP and call an iterator function for each alive GROUP presence partly in a Zone, providing the GROUP and optional parameters to the called function.

    + +

    Parameters

    +
      +
    • + +

      Zone#ZONE ZoneObject : +The Zone to be tested for.

      + +
    • +
    • + +

      #function IteratorFunction : +The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter.

      + +
    • +
    • + +

      ... :

      + +
    • +
    +

    Return value

    + +

    #SET_GROUP: +self

    + +
    +
    +
    +
    + + +SET_GROUP:IsIncludeObject(MooseGroup) + +
    +
    + + + +

    Parameter

    + +

    Return value

    + +

    #SET_GROUP: +self

    + +
    +
    +
    +
    + + +SET_GROUP:New() + +
    +
    + +

    Creates a new SET_GROUP object, building a set of groups belonging to a coalitions, categories, countries, types or with defined prefix names.

    + +

    Return value

    + +

    #SET_GROUP:

    + + +

    Usage:

    +
    -- Define a new SET_GROUP Object. This DBObject will contain a reference to all alive GROUPS.
    +DBObject = SET_GROUP:New()
    + +
    +
    + +

    Type SET_UNIT

    + +

    SET_UNIT class

    + +

    Field(s)

    +
    +
    + + +SET_UNIT:AddInDatabase(Event) + +
    +
    + +

    Handles the Database to check on an event (birth) that the Object was added in the Database.

    + + +

    This is required, because sometimes the DATABASE birth event gets called later than the SETBASE birth event!

    + +

    Parameter

    + +

    Return values

    +
      +
    1. + +

      #string: +The name of the UNIT

      + +
    2. +
    3. + +

      #table: +The UNIT

      + +
    4. +
    +
    +
    +
    +
    + + #string + +SET_UNIT.ClassName + +
    +
    + + + +
    +
    +
    +
    + + + +SET_UNIT.Filter + +
    +
    + + + +
    +
    +
    +
    + + +SET_UNIT:FilterCategories(Categories) + +
    +
    + +

    Builds a set of units out of categories.

    + + +

    Possible current categories are plane, helicopter, ground, ship.

    + +

    Parameter

    +
      +
    • + +

      #string Categories : +Can take the following values: "plane", "helicopter", "ground", "ship".

      + +
    • +
    +

    Return value

    + +

    #SET_UNIT: +self

    + +
    +
    +
    +
    + + +SET_UNIT:FilterCoalitions(Coalitions) + +
    +
    + +

    Builds a set of units of coalitions.

    + + +

    Possible current coalitions are red, blue and neutral.

    + +

    Parameter

    +
      +
    • + +

      #string Coalitions : +Can take the following values: "red", "blue", "neutral".

      + +
    • +
    +

    Return value

    + +

    #SET_UNIT: +self

    + +
    +
    +
    +
    + + +SET_UNIT:FilterCountries(Countries) + +
    +
    + +

    Builds a set of units of defined countries.

    + + +

    Possible current countries are those known within DCS world.

    + +

    Parameter

    +
      +
    • + +

      #string Countries : +Can take those country strings known within DCS world.

      + +
    • +
    +

    Return value

    + +

    #SET_UNIT: +self

    + +
    +
    +
    +
    + + + +SET_UNIT.FilterMeta + +
    +
    + + + +
    +
    +
    +
    + + +SET_UNIT:FilterPrefixes(Prefixes) + +
    +
    + +

    Builds a set of units of defined unit prefixes.

    + + +

    All the units starting with the given prefixes will be included within the set.

    + +

    Parameter

    +
      +
    • + +

      #string Prefixes : +The prefix of which the unit name starts with.

      + +
    • +
    +

    Return value

    + +

    #SET_UNIT: +self

    + +
    +
    +
    +
    + + +SET_UNIT:FilterStart() + +
    +
    + +

    Starts the filtering.

    + +

    Return value

    + +

    #SET_UNIT: +self

    + +
    +
    +
    +
    + + +SET_UNIT:FilterTypes(Types) + +
    +
    + +

    Builds a set of units of defined unit types.

    + + +

    Possible current types are those types known within DCS world.

    + +

    Parameter

    +
      +
    • + +

      #string Types : +Can take those type strings known within DCS world.

      + +
    • +
    +

    Return value

    + +

    #SET_UNIT: +self

    + +
    +
    +
    +
    + + +SET_UNIT:FindInDatabase(Event) + +
    +
    + +

    Handles the Database to check on any event that Object exists in the Database.

    + + +

    This is required, because sometimes the DATABASE event gets called later than the SETBASE event or vise versa!

    + +

    Parameter

    + +

    Return values

    +
      +
    1. + +

      #string: +The name of the UNIT

      + +
    2. +
    3. + +

      #table: +The UNIT

      + +
    4. +
    +
    +
    +
    +
    + + +SET_UNIT:FindUnit(UnitName) + +
    +
    + +

    Finds a Unit based on the Unit Name.

    + +

    Parameter

    +
      +
    • + +

      #string UnitName :

      + +
    • +
    +

    Return value

    + +

    Unit#UNIT: +The found Unit.

    + +
    +
    +
    +
    + + +SET_UNIT:ForEachUnit(IteratorFunction, ...) + +
    +
    + +

    Interate the SET_UNIT and call an interator function for each alive UNIT, providing the UNIT and optional parameters.

    + +

    Parameters

    +
      +
    • + +

      #function IteratorFunction : +The function that will be called when there is an alive UNIT in the SET_UNIT. The function needs to accept a UNIT parameter.

      + +
    • +
    • + +

      ... :

      + +
    • +
    +

    Return value

    + +

    #SET_UNIT: +self

    + +
    +
    +
    +
    + + +SET_UNIT:IsIncludeObject(MUnit) + +
    +
    + + + +

    Parameter

    + +

    Return value

    + +

    #SET_UNIT: +self

    + +
    +
    +
    +
    + + +SET_UNIT:New() + +
    +
    + +

    Creates a new SET_UNIT object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names.

    + +

    Return value

    + +

    #SET_UNIT:

    + + +

    Usage:

    +
    -- Define a new SET_UNIT Object. This DBObject will contain a reference to all alive Units.
    +DBObject = SET_UNIT:New()
    + +
    +
    +
    +
    + + + +SET_UNIT.Units + +
    +
    + + +
    diff --git a/Moose Training/Documentation/Spawn.html b/Moose Training/Documentation/Spawn.html index 05801f80f..dd8c1ec10 100644 --- a/Moose Training/Documentation/Spawn.html +++ b/Moose Training/Documentation/Spawn.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Static.html b/Moose Training/Documentation/Static.html index c298df14c..3d3ee61c2 100644 --- a/Moose Training/Documentation/Static.html +++ b/Moose Training/Documentation/Static.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/StaticObject.html b/Moose Training/Documentation/StaticObject.html index 013f3334a..bbf2cba18 100644 --- a/Moose Training/Documentation/StaticObject.html +++ b/Moose Training/Documentation/StaticObject.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/TASK.html b/Moose Training/Documentation/TASK.html index d62f547dc..3855d0f1e 100644 --- a/Moose Training/Documentation/TASK.html +++ b/Moose Training/Documentation/TASK.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Unit.html b/Moose Training/Documentation/Unit.html index e2035c8b5..8f51b0453 100644 --- a/Moose Training/Documentation/Unit.html +++ b/Moose Training/Documentation/Unit.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/Zone.html b/Moose Training/Documentation/Zone.html index 72034c196..490e4449d 100644 --- a/Moose Training/Documentation/Zone.html +++ b/Moose Training/Documentation/Zone.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/env.html b/Moose Training/Documentation/env.html index 749d7eafa..927b69495 100644 --- a/Moose Training/Documentation/env.html +++ b/Moose Training/Documentation/env.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/index.html b/Moose Training/Documentation/index.html index 890d5b675..71f021a69 100644 --- a/Moose Training/Documentation/index.html +++ b/Moose Training/Documentation/index.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • @@ -234,12 +232,6 @@ Group

    This module contains the GROUP class.

    - - - - GroupSet - -

    Create and manage a set of groups.

    @@ -323,7 +315,7 @@ Set -

    Manage sets of units and groups.

    +

    This module contains the SET classes.

    @@ -354,12 +346,6 @@ Unit

    This module contains the UNIT class.

    - - - - UnitSet - -

    Create and manage a set of units.

    diff --git a/Moose Training/Documentation/land.html b/Moose Training/Documentation/land.html index 2bc1f0b6c..2164e74b0 100644 --- a/Moose Training/Documentation/land.html +++ b/Moose Training/Documentation/land.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Documentation/routines.html b/Moose Training/Documentation/routines.html index 8b1ea6154..2a4b23fd8 100644 --- a/Moose Training/Documentation/routines.html +++ b/Moose Training/Documentation/routines.html @@ -43,7 +43,6 @@
  • Event
  • GOHOMETASK
  • Group
  • -
  • GroupSet
  • MOVEMENT
  • Menu
  • Message
  • @@ -63,7 +62,6 @@
  • StaticObject
  • TASK
  • Unit
  • -
  • UnitSet
  • Zone
  • env
  • land
  • diff --git a/Moose Training/Presentations/DCS World - MOOSE - Sets - Part 1 - SET_GROUP.pptx b/Moose Training/Presentations/DCS World - MOOSE - Sets - Part 1 - SET_GROUP.pptx new file mode 100644 index 000000000..f2eeb21b8 Binary files /dev/null and b/Moose Training/Presentations/DCS World - MOOSE - Sets - Part 1 - SET_GROUP.pptx differ diff --git a/Moose Training/Presentations/DCS World - MOOSE - Zones - Part 1 - Use zones with GROUP and UNIT.pptx b/Moose Training/Presentations/DCS World - MOOSE - Zones - Part 1 - Use zones with GROUP and UNIT - kopie.pptx similarity index 100% rename from Moose Training/Presentations/DCS World - MOOSE - Zones - Part 1 - Use zones with GROUP and UNIT.pptx rename to Moose Training/Presentations/DCS World - MOOSE - Zones - Part 1 - Use zones with GROUP and UNIT - kopie.pptx