diff --git a/Moose Development/Moose/Base.lua b/Moose Development/Moose/Base.lua index d30d37c5a..5e678ec66 100644 --- a/Moose Development/Moose/Base.lua +++ b/Moose Development/Moose/Base.lua @@ -331,9 +331,8 @@ function BASE:SetState( Object, StateName, State ) if not self.States[ClassNameAndID] then self.States[ClassNameAndID] = {} end - self.States[ClassNameAndID][StateName] = State - self:E( { "SetState " .. ClassNameAndID .. "." .. StateName, State } ) + self:E( { ClassNameAndID, StateName, State } ) return self.States[ClassNameAndID][StateName] end @@ -341,9 +340,11 @@ end function BASE:GetState( Object, StateName ) local ClassNameAndID = Object:GetClassNameAndID() + self:E( { ClassNameAndID } ) if self.States[ClassNameAndID] then - self:E( { " GetState " .. ClassNameAndID .. "." .. StateName, self.States[ClassNameAndID][StateName] } ) - return self.States[ClassNameAndID][StateName] + local State = self.States[ClassNameAndID][StateName] + self:E( { ClassNameAndID, StateName, State } ) + return State end return nil @@ -422,7 +423,10 @@ function BASE:F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam ) end if _TraceAll == true or _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName].Method[Function] then - local LineCurrent = DebugInfoCurrent.currentline + local LineCurrent = 0 + if DebugInfoCurrent.currentline then + LineCurrent = DebugInfoCurrent.currentline + end local LineFrom = 0 if DebugInfoFrom then LineFrom = DebugInfoFrom.currentline @@ -476,7 +480,10 @@ function BASE:_T( Arguments, DebugInfoCurrentParam, DebugInfoFromParam ) end if _TraceAll == true or _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName].Method[Function] then - local LineCurrent = DebugInfoCurrent.currentline + local LineCurrent = 0 + if DebugInfoCurrent.currentline then + LineCurrent = DebugInfoCurrent.currentline + end local LineFrom = 0 if DebugInfoFrom then LineFrom = DebugInfoFrom.currentline diff --git a/Moose Development/Moose/Database.lua b/Moose Development/Moose/Database.lua index ca8dfa7f2..c74cbdd64 100644 --- a/Moose Development/Moose/Database.lua +++ b/Moose Development/Moose/Database.lua @@ -54,9 +54,6 @@ DATABASE = { ClientsByName = {}, ClientsByID = {}, }, - DCSUnits = {}, - DCSGroups = {}, - DCSStatics = {}, UNITS = {}, STATICS = {}, GROUPS = {}, @@ -125,10 +122,13 @@ end --- Adds a Unit based on the Unit Name in the DATABASE. -- @param #DATABASE self -function DATABASE:AddUnit( DCSUnit, DCSUnitName ) +function DATABASE:AddUnit( DCSUnitName ) - self.DCSUnits[DCSUnitName] = DCSUnit - self.UNITS[DCSUnitName] = UNIT:Register( DCSUnitName ) + if not self.UNITS[DCSUnitName] then + self.UNITS[DCSUnitName] = UNIT:Register( DCSUnitName ) + end + + return self.UNITS[DCSUnitName] end @@ -136,15 +136,16 @@ end -- @param #DATABASE self function DATABASE:DeleteUnit( DCSUnitName ) - self.DCSUnits[DCSUnitName] = nil + --self.UNITS[DCSUnitName] = nil end --- Adds a Static based on the Static Name in the DATABASE. -- @param #DATABASE self -function DATABASE:AddStatic( DCSStatic, DCSStaticName ) +function DATABASE:AddStatic( DCSStaticName ) - self.DCSStatics[DCSStaticName] = DCSStatic - self.STATICS[DCSStaticName] = STATIC:Register( DCSStaticName ) + if not self.STATICS[DCSStaticName] then + self.STATICS[DCSStaticName] = STATIC:Register( DCSStaticName ) + end end @@ -152,7 +153,7 @@ end -- @param #DATABASE self function DATABASE:DeleteStatic( DCSStaticName ) - self.DCSStatics[DCSStaticName] = nil + --self.STATICS[DCSStaticName] = nil end --- Finds a STATIC based on the StaticName. @@ -181,8 +182,11 @@ end -- @param #DATABASE self function DATABASE:AddClient( ClientName ) - self.CLIENTS[ClientName] = CLIENT:Register( ClientName ) - self:E( self.CLIENTS[ClientName]:GetClassNameAndID() ) + if not self.CLIENTS[ClientName] then + self.CLIENTS[ClientName] = CLIENT:Register( ClientName ) + end + + return self.CLIENTS[ClientName] end @@ -199,10 +203,13 @@ end --- Adds a GROUP based on the GroupName in the DATABASE. -- @param #DATABASE self -function DATABASE:AddGroup( DCSGroup, GroupName ) +function DATABASE:AddGroup( GroupName ) - self.DCSGroups[GroupName] = DCSGroup - self.GROUPS[GroupName] = GROUP:Register( GroupName ) + if not self.GROUPS[GroupName] then + self.GROUPS[GroupName] = GROUP:Register( GroupName ) + end + + return self.GROUPS[GroupName] end --- Adds a player based on the Player Name in the DATABASE. @@ -261,7 +268,7 @@ function DATABASE:Spawn( SpawnTemplate ) SpawnTemplate.SpawnCountryID = SpawnCountryID SpawnTemplate.SpawnCategoryID = SpawnCategoryID - local SpawnGroup = GROUP:Register( SpawnTemplate.name ) + local SpawnGroup = self:AddGroup( SpawnTemplate.name ) return SpawnGroup end @@ -400,14 +407,14 @@ function DATABASE:_RegisterGroupsAndUnits() if DCSGroup:isExist() then local DCSGroupName = DCSGroup:getName() - self:E( { "Register Group:", DCSGroup, DCSGroupName } ) - self:AddGroup( DCSGroup, DCSGroupName ) + self:E( { "Register Group:", DCSGroupName } ) + self:AddGroup( DCSGroupName ) for DCSUnitId, DCSUnit in pairs( DCSGroup:getUnits() ) do local DCSUnitName = DCSUnit:getName() - self:E( { "Register Unit:", DCSUnit, DCSUnitName } ) - self:AddUnit( DCSUnit, DCSUnitName ) + self:E( { "Register Unit:", DCSUnitName } ) + self:AddUnit( DCSUnitName ) end else self:E( { "Group does not exist: ", DCSGroup } ) @@ -441,8 +448,8 @@ function DATABASE:_RegisterStatics() if DCSStatic:isExist() then local DCSStaticName = DCSStatic:getName() - self:E( { "Register Static:", DCSStatic, DCSStaticName } ) - self:AddStatic( DCSStatic, DCSStaticName ) + self:E( { "Register Static:", DCSStaticName } ) + self:AddStatic( DCSStaticName ) else self:E( { "Static does not exist: ", DCSStatic } ) end @@ -462,8 +469,8 @@ function DATABASE:_EventOnBirth( Event ) self:F2( { Event } ) if Event.IniDCSUnit then - self:AddUnit( Event.IniDCSUnit, Event.IniDCSUnitName ) - self:AddGroup( Event.IniDCSGroup, Event.IniDCSGroupName ) + self:AddUnit( Event.IniDCSUnitName ) + self:AddGroup( Event.IniDCSGroupName ) self:_EventOnPlayerEnterUnit( Event ) end end @@ -476,7 +483,7 @@ function DATABASE:_EventOnDeadOrCrash( Event ) self:F2( { Event } ) if Event.IniDCSUnit then - if self.DCSUnits[Event.IniDCSUnitName] then + if self.UNITS[Event.IniDCSUnitName] then self:DeleteUnit( Event.IniDCSUnitName ) -- add logic to correctly remove a group once all units are destroyed... end @@ -558,19 +565,6 @@ function DATABASE:ForEach( IteratorFunction, arg, Set ) end ---- Iterate the DATABASE and call an iterator function for each **alive** unit, providing the DCSUnit and optional parameters. --- @param #DATABASE self --- @param #function IteratorFunction The function that will be called when there is an alive unit in the database. The function needs to accept a DCSUnit parameter. --- @return #DATABASE self -function DATABASE:ForEachDCSUnit( IteratorFunction, ... ) - self:F2( arg ) - - self:ForEach( IteratorFunction, arg, self.DCSUnits ) - - return self -end - - --- Iterate the DATABASE and call an iterator function for each **alive** UNIT, providing the UNIT and optional parameters. -- @param #DATABASE self -- @param #function IteratorFunction The function that will be called when there is an alive UNIT in the database. The function needs to accept a UNIT parameter. diff --git a/Moose Development/Moose/Escort.lua b/Moose Development/Moose/Escort.lua index 355a576fb..2a543e7c5 100644 --- a/Moose Development/Moose/Escort.lua +++ b/Moose Development/Moose/Escort.lua @@ -99,23 +99,31 @@ -- * @{#ESCORT.MenuEvasion: Creates a menu structure to set the evasion techniques when the escort is under threat. -- * @{#ESCORT.MenuResumeMission}: Creates a menu structure so that the escort can resume from a waypoint. -- +-- +-- @usage +-- -- Declare a new EscortPlanes object as follows: +-- +-- -- First find the GROUP object and the CLIENT object. +-- local EscortClient = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor. +-- local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client. +-- +-- -- Now use these 2 objects to construct the new EscortPlanes object. +-- EscortPlanes = ESCORT:New( EscortClient, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." ) +-- +-- +-- -- @module Escort -- @author FlightControl - - - - - - ---- +--- ESCORT class -- @type ESCORT -- @extends Base#BASE -- @field Client#CLIENT EscortClient -- @field Group#GROUP EscortGroup -- @field #string EscortName -- @field #ESCORT.MODE EscortMode The mode the escort is in. --- @field #number FollowScheduler The id of the _FollowScheduler function. +-- @field Scheduler#SCHEDULER FollowScheduler The instance of the SCHEDULER class. +-- @field #number FollowDistance The current follow distance. -- @field #boolean ReportTargets If true, nearby targets are reported. -- @Field DCSTypes#AI.Option.Air.val.ROE OptionROE Which ROE is set to the EscortGroup. -- @field DCSTypes#AI.Option.Air.val.REACTION_ON_THREAT OptionReactionOnThreat Which REACTION_ON_THREAT is set to the EscortGroup. @@ -125,7 +133,7 @@ ESCORT = { EscortName = nil, -- The Escort Name EscortClient = nil, EscortGroup = nil, - EscortMode = nil, + EscortMode = 1, MODE = { FOLLOW = 1, MISSION = 2, @@ -135,6 +143,7 @@ ESCORT = { ReportTargets = true, OptionROE = AI.Option.Air.val.ROE.OPEN_FIRE, OptionReactionOnThreat = AI.Option.Air.val.REACTION_ON_THREAT.ALLOW_ABORT_MISSION, + SmokeDirectionVector = false, TaskPoints = {} } @@ -156,6 +165,15 @@ ESCORT = { -- @param Group#GROUP EscortGroup The group AI escorting the EscortClient. -- @param #string EscortName Name of the escort. -- @return #ESCORT self +-- @usage +-- -- Declare a new EscortPlanes object as follows: +-- +-- -- First find the GROUP object and the CLIENT object. +-- local EscortClient = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor. +-- local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client. +-- +-- -- Now use these 2 objects to construct the new EscortPlanes object. +-- EscortPlanes = ESCORT:New( EscortClient, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." ) function ESCORT:New( EscortClient, EscortGroup, EscortName, EscortBriefing ) local self = BASE:Inherit( self, BASE:New() ) self:F( { EscortClient, EscortGroup, EscortName } ) @@ -165,8 +183,6 @@ function ESCORT:New( EscortClient, EscortGroup, EscortName, EscortBriefing ) self.EscortName = EscortName self.EscortBriefing = EscortBriefing - self:T( EscortGroup:GetClassNameAndID() ) - -- Set EscortGroup known at EscortClient. if not self.EscortClient._EscortGroups then self.EscortClient._EscortGroups = {} @@ -177,10 +193,8 @@ function ESCORT:New( EscortClient, EscortGroup, EscortName, EscortBriefing ) self.EscortClient._EscortGroups[EscortGroup:GetName()].EscortGroup = self.EscortGroup self.EscortClient._EscortGroups[EscortGroup:GetName()].EscortName = self.EscortName self.EscortClient._EscortGroups[EscortGroup:GetName()].Targets = {} - self.EscortMode = ESCORT.MODE.FOLLOW end - self.EscortMenu = MENU_CLIENT:New( self.EscortClient, self.EscortName ) self.EscortGroup:WayPointInitialize(1) @@ -194,9 +208,24 @@ function ESCORT:New( EscortClient, EscortGroup, EscortName, EscortBriefing ) 60, EscortClient ) + self.FollowDistance = 100 + self.CT1 = 0 + self.GT1 = 0 + self.FollowScheduler = SCHEDULER:New( self, self._FollowScheduler, {}, 1, .5, .01 ) + self.EscortMode = ESCORT.MODE.MISSION + self.FollowScheduler:Stop() + return self end +--- This function is for test, it will put on the frequency of the FollowScheduler a red smoke at the direction vector calculated for the escort to fly to. +-- This allows to visualize where the escort is flying to. +-- @param #ESCORT self +-- @param #boolean SmokeDirection If true, then the direction vector will be smoked. +function ESCORT:TestSmokeDirectionVector( SmokeDirection ) + self.SmokeDirectionVector = ( SmokeDirection == true ) and true or false +end + --- Defines the default menus -- @param #ESCORT self @@ -223,6 +252,7 @@ function ESCORT:Menus() self:MenuEvasion() self:MenuResumeMission() + return self end @@ -633,7 +663,7 @@ function ESCORT._HoldPosition( MenuParam ) local OrbitHeight = MenuParam.ParamHeight local OrbitSeconds = MenuParam.ParamSeconds -- Not implemented yet - routines.removeFunction( self.FollowScheduler ) + self.FollowScheduler:Stop() local PointFrom = {} local GroupPoint = EscortGroup:GetUnit(1):GetPointVec3() @@ -662,6 +692,7 @@ function ESCORT._HoldPosition( MenuParam ) EscortGroup:SetTask( EscortGroup:TaskRoute( Points ) ) EscortGroup:MessageToClient( "Orbiting at location.", 10, EscortClient ) + end --- @param #MENUPARAM MenuParam @@ -684,9 +715,7 @@ end function ESCORT:JoinUpAndFollow( EscortGroup, EscortClient, Distance ) self:F( { EscortGroup, EscortClient, Distance } ) - if self.FollowScheduler then - routines.removeFunction( self.FollowScheduler ) - end + self.FollowScheduler:Stop() EscortGroup:OptionROEHoldFire() EscortGroup:OptionROTPassiveDefense() @@ -695,8 +724,8 @@ function ESCORT:JoinUpAndFollow( EscortGroup, EscortClient, Distance ) self.CT1 = 0 self.GT1 = 0 - --self.FollowScheduler = routines.scheduleFunction( self._FollowScheduler, { self, Distance }, timer.getTime() + 1, .5 ) - self.FollowScheduler = SCHEDULER:New( self, self._FollowScheduler, { Distance }, 1, .5, .1 ) + self.FollowScheduler:Start() + EscortGroup:MessageToClient( "Rejoining and Following at " .. Distance .. "!", 30, EscortClient ) end @@ -768,11 +797,7 @@ function ESCORT._ScanTargets( MenuParam ) local ScanDuration = MenuParam.ParamScanDuration - if self.FollowScheduler then - routines.removeFunction( self.FollowScheduler ) - end - - self:T( { "FollowScheduler after removefunction: ", self.FollowScheduler } ) + self.FollowScheduler:Stop() if EscortGroup:IsHelicopter() then SCHEDULER:New( EscortGroup, EscortGroup.PushTask, @@ -797,16 +822,16 @@ function ESCORT._ScanTargets( MenuParam ) EscortGroup:MessageToClient( "Scanning targets for " .. ScanDuration .. " seconds.", ScanDuration, EscortClient ) if self.EscortMode == ESCORT.MODE.FOLLOW then - --self.FollowScheduler = routines.scheduleFunction( self._FollowScheduler, { self, Distance }, timer.getTime() + ScanDuration, 1 ) self.FollowScheduler:Start() end end +--- @param Group#GROUP EscortGroup function _Resume( EscortGroup ) env.info( '_Resume' ) - local Escort = EscortGroup.Escort -- #ESCORT + local Escort = EscortGroup:GetState( EscortGroup, "Escort" ) env.info( "EscortMode = " .. Escort.EscortMode ) if Escort.EscortMode == ESCORT.MODE.FOLLOW then Escort:JoinUpAndFollow( EscortGroup, Escort.EscortClient, Escort.Distance ) @@ -819,19 +844,18 @@ function ESCORT._AttackTarget( MenuParam ) local self = MenuParam.ParamSelf local EscortGroup = self.EscortGroup + local EscortClient = self.EscortClient local AttackUnit = MenuParam.ParamUnit -- Unit#UNIT - if self.FollowScheduler then - routines.removeFunction( self.FollowScheduler ) - end + self.FollowScheduler:Stop() self:T( AttackUnit ) if EscortGroup:IsAir() then EscortGroup:OptionROEOpenFire() EscortGroup:OptionROTPassiveDefense() - EscortGroup.Escort = self -- Need to do this trick to get the reference for the escort in the _Resume function. + EscortGroup:SetState( EscortGroup, "Escort", self ) -- routines.scheduleFunction( -- EscortGroup.PushTask, -- { EscortGroup, @@ -846,7 +870,7 @@ function ESCORT._AttackTarget( MenuParam ) EscortGroup.PushTask, { EscortGroup:TaskCombo( { EscortGroup:TaskAttackUnit( AttackUnit ), - EscortGroup:TaskFunction( 1, 2, "_Resume", {"''"} ) + EscortGroup:TaskFunction( 1, 2, "_Resume", { "''" } ) } ) }, 10 @@ -870,9 +894,9 @@ function ESCORT._AttackTarget( MenuParam ) }, 10 ) end + EscortGroup:MessageToClient( "Engaging Designated Unit!", 10, EscortClient ) - end --- @param #MENUPARAM MenuParam @@ -884,10 +908,7 @@ function ESCORT._AssistTarget( MenuParam ) local EscortGroupAttack = MenuParam.ParamEscortGroup local AttackUnit = MenuParam.ParamUnit -- Unit#UNIT - if self.FollowScheduler then - routines.removeFunction( self.FollowScheduler ) - end - + self.FollowScheduler:Stop() self:T( AttackUnit ) @@ -973,8 +994,7 @@ function ESCORT._ResumeMission( MenuParam ) local WayPoint = MenuParam.ParamWayPoint - routines.removeFunction( self.FollowScheduler ) - self.FollowScheduler = nil + self.FollowScheduler:Stop() local WayPoints = EscortGroup:GetTaskRoute() self:T( WayPoint, WayPoints ) @@ -1005,16 +1025,21 @@ function ESCORT:RegisterRoute() end --- @param Escort#ESCORT self -function ESCORT:_FollowScheduler( FollowDistance ) - self:F( { FollowDistance }) +function ESCORT:_FollowScheduler() + self:F( { self.FollowDistance } ) + self:T( {self.EscortClient.UnitName, self.EscortGroup.GroupName } ) if self.EscortGroup:IsAlive() and self.EscortClient:IsAlive() then local ClientUnit = self.EscortClient:GetClientGroupUnit() local GroupUnit = self.EscortGroup:GetUnit( 1 ) + local FollowDistance = self.FollowDistance + + self:T( {ClientUnit.UnitName, GroupUnit.UnitName } ) if self.CT1 == 0 and self.GT1 == 0 then self.CV1 = ClientUnit:GetPointVec3() + self:T( { "self.CV1", self.CV1 } ) self.CT1 = timer.getTime() self.GV1 = GroupUnit:GetPointVec3() self.GT1 = timer.getTime() @@ -1074,7 +1099,10 @@ function ESCORT:_FollowScheduler( FollowDistance ) -- Now we can calculate the group destination vector GDV. local GDV = { x = DVu.x * CS * 8 + CVI.x, y = CVI.y, z = DVu.z * CS * 8 + CVI.z } - --trigger.action.smoke( GDV, trigger.smokeColor.Red ) + if self.SmokeDirectionVector == true then + trigger.action.smoke( GDV, trigger.smokeColor.Red ) + end + self:T2( { "CV2:", CV2 } ) self:T2( { "CVI:", CVI } ) self:T2( { "GDV:", GDV } ) @@ -1092,11 +1120,12 @@ function ESCORT:_FollowScheduler( FollowDistance ) Speed = 0 end - self:T( { "Client Speed, Escort Speed, Speed, FlyDistance, Time:", CS, GS, Speed, Distance, Time } ) + self:T( { "Client Speed, Escort Speed, Speed, FollowDistance, Time:", CS, GS, Speed, FollowDistance, Time } ) -- Now route the escort to the desired point with the desired speed. self.EscortGroup:TaskRouteToVec3( GDV, Speed / 3.6 ) -- DCS models speed in Mps (Miles per second) end + return true end @@ -1278,6 +1307,7 @@ function ESCORT:_ReportTargetsScheduler() MENU_CLIENT_COMMAND:New( self.EscortClient, "Waypoint " .. WayPointID .. " at " .. string.format( "%.2f", Distance ).. "km", self.EscortMenuResumeMission, ESCORT._ResumeMission, { ParamSelf = self, ParamWayPoint = WayPointID } ) end end + return true end diff --git a/Moose Development/Moose/Event.lua b/Moose Development/Moose/Event.lua index e58e8a2ec..959d9839a 100644 --- a/Moose Development/Moose/Event.lua +++ b/Moose Development/Moose/Event.lua @@ -494,11 +494,11 @@ function EVENT:onEvent( Event ) self:E( { _EVENTCODES[Event.id], Event } ) for ClassName, EventData in pairs( self.Events[Event.id] ) do if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then - self:T2( { "Calling event function for class ", ClassName, " unit ", Event.IniDCSUnitName } ) + self:E( { "Calling event function for class ", ClassName, " unit ", Event.IniDCSUnitName } ) EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventSelf, Event ) else if Event.IniDCSUnit and not EventData.IniUnit then - self:T2( { "Calling event function for class ", ClassName } ) + self:E( { "Calling event function for class ", ClassName } ) EventData.EventFunction( EventData.EventSelf, Event ) end end diff --git a/Moose Development/Moose/Group.lua b/Moose Development/Moose/Group.lua index 4778c31c5..87cddd07e 100644 --- a/Moose Development/Moose/Group.lua +++ b/Moose Development/Moose/Group.lua @@ -185,6 +185,7 @@ function GROUP:Find( DCSGroup ) local GroupName = DCSGroup:getName() -- Group#GROUP local GroupFound = _DATABASE:FindGroup( GroupName ) + GroupFound:E( { GroupName, GroupFound:GetClassNameAndID() } ) return GroupFound end @@ -517,13 +518,14 @@ end function GROUP:TaskFunction( WayPoint, WayPointIndex, FunctionString, FunctionArguments ) + self:F2( { WayPoint, WayPointIndex, FunctionString, FunctionArguments } ) local DCSTask local DCSScript = {} DCSScript[#DCSScript+1] = "local MissionGroup = GROUP:Find( ... ) " - if FunctionArguments.n > 0 then + if FunctionArguments and #FunctionArguments > 0 then DCSScript[#DCSScript+1] = FunctionString .. "( MissionGroup, " .. table.concat( FunctionArguments, "," ) .. ")" else DCSScript[#DCSScript+1] = FunctionString .. "( MissionGroup )" diff --git a/Moose Development/Moose/Scheduler.lua b/Moose Development/Moose/Scheduler.lua index 652c74da9..82e78c5d3 100644 --- a/Moose Development/Moose/Scheduler.lua +++ b/Moose Development/Moose/Scheduler.lua @@ -46,13 +46,12 @@ function SCHEDULER:New( TimeEventObject, TimeEventFunction, TimeEventFunctionArg self.TimeEventFunction = TimeEventFunction self.TimeEventFunctionArguments = TimeEventFunctionArguments self.StartSeconds = StartSeconds + self.Repeat = false if RepeatSecondsInterval then self.RepeatSecondsInterval = RepeatSecondsInterval - self.Repeat = true else self.RepeatSecondsInterval = 0 - self.Repeat = false end if RandomizationFactor then @@ -79,7 +78,10 @@ end function SCHEDULER:Start() self:F2( self.TimeEventObject ) - timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 ) + if self.RepeatSecondsInterval ~= 0 then + self.Repeat = true + end + timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 ) return self end diff --git a/Moose Development/Moose/Test.lua b/Moose Development/Moose/Test.lua deleted file mode 100644 index e69de29bb..000000000 diff --git a/Moose Test Missions/Moose_Test_ESCORT/MOOSE_Test_ESCORT.lua b/Moose Test Missions/Moose_Test_ESCORT/MOOSE_Test_ESCORT.lua index 732b5b5ac..0af903907 100644 --- a/Moose Test Missions/Moose_Test_ESCORT/MOOSE_Test_ESCORT.lua +++ b/Moose Test Missions/Moose_Test_ESCORT/MOOSE_Test_ESCORT.lua @@ -19,6 +19,11 @@ do :MenuReportTargets( 60, 20 ) :MenuResumeMission() :MenuAssistedAttack() + + local EscortGroupArtillery = SpawnEscortArtillery:ReSpawn(1) + local EscortArtillery = ESCORT + :New( Client, EscortGroupArtillery, "Escort Artillery" ) + :Menus() end local function EventAlivePlane( Client ) @@ -52,6 +57,7 @@ do SpawnEscortPlane = SPAWN:New( "Escort Plane" ) SpawnEscortGround = SPAWN:New( "Escort Ground" ) SpawnEscortShip = SPAWN:New( "Escort Ship" ) + SpawnEscortArtillery = SPAWN:New( "Ground Attack Assistance" ) EscortClientHeli = CLIENT:FindByName( "Lead Helicopter", "Fly around and observe the behaviour of the escort helicopter" ):Alive( EventAliveHelicopter ) EscortClientPlane = CLIENT:FindByName( "Lead Plane", "Fly around and observe the behaviour of the escort airplane. Select Navigate->Joun-Up and airplane should follow you. Change speed and directions." ) diff --git a/Moose Training/Documentation/AIBalancer.html b/Moose Training/Documentation/AIBalancer.html new file mode 100644 index 000000000..12bf002c5 --- /dev/null +++ b/Moose Training/Documentation/AIBalancer.html @@ -0,0 +1,253 @@ + + + + + + +
+
+ +
+
+
+
+ +
+

Module AIBalancer

+ +

This module contains the AIBALANCER class.

+ + + +
+ +

1) AIBalancer#AIBALANCER class, extends Base#BASE

+

The AIBalancer#AIBALANCER class controls the dynamic spawning of AI GROUPS depending on a SETCLIENT. +There will be as many AI GROUPS spawned as there at CLIENTS in SETCLIENT not spawned.

+ +

1.1) AIBALANCER construction method:

+

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

+ + + + +
+ +

Global(s)

+ + + + + +
AIBALANCER + +
+

Type AIBALANCER

+ + + + + + + + + + + + + + + + + + + + + +
AIBALANCER.ClassName + +
AIBALANCER:New(SetClient, SpawnAI) +

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

+
AIBALANCER.SetClient + +
AIBALANCER.SpawnAI + +
AIBALANCER:_ClientAliveMonitorScheduler() + +
+ +

Global(s)

+
+
+ + #AIBALANCER + +AIBALANCER + +
+
+ + + +
+
+

Type AIBalancer

+ +

Type AIBALANCER

+ +

AIBALANCER class

+ +

Field(s)

+
+
+ + #string + +AIBALANCER.ClassName + +
+
+ + + +
+
+
+
+ + +AIBALANCER:New(SetClient, SpawnAI) + +
+
+ +

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

+ +

Parameters

+
    +
  • + +

    SetClient : +A SET_CLIENT object that will contain the CLIENT objects to be monitored if they are alive or not (joined by a player).

    + +
  • +
  • + +

    SpawnAI : +A SPAWN object that will spawn the AI units required, balancing the SetClient.

    + +
  • +
+

Return value

+ +

#AIBALANCER: +self

+ +
+
+
+
+ + Set#SET_CLIENT + +AIBALANCER.SetClient + +
+
+ + + +
+
+
+
+ + Spawn#SPAWN + +AIBALANCER.SpawnAI + +
+
+ + + +
+
+
+
+ + +AIBALANCER:_ClientAliveMonitorScheduler() + +
+
+ + + +
+
+ +
+ +
+ + diff --git a/Moose Training/Documentation/Airbase.html b/Moose Training/Documentation/Airbase.html index 528f6b026..4348feac2 100644 --- a/Moose Training/Documentation/Airbase.html +++ b/Moose Training/Documentation/Airbase.html @@ -17,6 +17,7 @@ index + +

Usage:

+
-- Declare a new EscortPlanes object as follows:
+
+-- First find the GROUP object and the CLIENT object.
+local EscortClient = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
+local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client.
+
+-- Now use these 2 objects to construct the new EscortPlanes object.
+EscortPlanes = ESCORT:New( EscortClient, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
+
+
+
+

Global(s)

@@ -430,12 +445,18 @@ Note that this is really fantastic, as you now have the dynamic of taking contro + + + + @@ -589,7 +610,7 @@ Note that this is really fantastic, as you now have the dynamic of taking contro - + @@ -1322,13 +1343,27 @@ Note that this is really fantastic, as you now have the dynamic of taking contro
#number + +ESCORT.FollowDistance + +
+
+ +

The current follow distance.

+ +
+ +
+
+ + Scheduler#SCHEDULER ESCORT.FollowScheduler
-

The id of the _FollowScheduler function.

+

The instance of the SCHEDULER class.

@@ -1788,6 +1823,16 @@ Name of the escort.

#ESCORT: self

+

Usage:

+
-- Declare a new EscortPlanes object as follows:
+
+-- First find the GROUP object and the CLIENT object.
+local EscortClient = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
+local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client.
+
+-- Now use these 2 objects to construct the new EscortPlanes object.
+EscortPlanes = ESCORT:New( EscortClient, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
+
@@ -1962,21 +2007,13 @@ self

-ESCORT:_FollowScheduler(FollowDistance) +ESCORT:_FollowScheduler()
-

Parameter

-
    -
  • - -

    FollowDistance :

    - -
  • -
diff --git a/Moose Training/Documentation/Event.html b/Moose Training/Documentation/Event.html index c455ef683..93784120c 100644 --- a/Moose Training/Documentation/Event.html +++ b/Moose Training/Documentation/Event.html @@ -17,6 +17,7 @@ index
+ + + + @@ -286,6 +293,12 @@ It suports the following functionality:

+ + + + @@ -310,6 +323,12 @@ It suports the following functionality:

+ + + + @@ -408,6 +427,20 @@ It suports the following functionality:

+ + +
+
+ + Set#SET_CLIENT + +MISSILETRAINER.DBClients + +
+
+ + +
@@ -786,6 +819,20 @@ The distance in meters when a tracked missile needs to be destroyed when close t + +
+
+
+ + + +MISSILETRAINER.TrackingMissiles + +
+
+ + +
@@ -871,6 +918,32 @@ The distance in meters when a tracked missile needs to be destroyed when close t
+ +MISSILETRAINER._Alive(Client, self) + +
+
+ + + +

Parameters

+
    +
  • + +

    Client :

    + +
  • +
  • + +

    self :

    + +
  • +
+
+
+
+
+ MISSILETRAINER:_EventShot(Event) diff --git a/Moose Training/Documentation/NOTASK.html b/Moose Training/Documentation/NOTASK.html index a16acc7f7..91637bb7f 100644 --- a/Moose Training/Documentation/NOTASK.html +++ b/Moose Training/Documentation/NOTASK.html @@ -17,6 +17,7 @@ index
    +
  • AIBalancer
  • Airbase
  • Base
  • CARGO
  • diff --git a/Moose Training/Documentation/PICKUPTASK.html b/Moose Training/Documentation/PICKUPTASK.html index 88c16ead1..b00b67633 100644 --- a/Moose Training/Documentation/PICKUPTASK.html +++ b/Moose Training/Documentation/PICKUPTASK.html @@ -17,6 +17,7 @@ index
    +
  • AIBalancer
  • Airbase
  • Base
  • CARGO
  • diff --git a/Moose Training/Documentation/Point.html b/Moose Training/Documentation/Point.html index 84d50a13d..5ce62bfb0 100644 --- a/Moose Training/Documentation/Point.html +++ b/Moose Training/Documentation/Point.html @@ -17,6 +17,7 @@ index
    +
  • AIBalancer
  • Airbase
  • Base
  • CARGO
  • diff --git a/Moose Training/Documentation/ROUTETASK.html b/Moose Training/Documentation/ROUTETASK.html index 6808f2933..524cc693f 100644 --- a/Moose Training/Documentation/ROUTETASK.html +++ b/Moose Training/Documentation/ROUTETASK.html @@ -17,6 +17,7 @@ index
    +
  • AIBalancer
  • Airbase
  • Base
  • CARGO
  • diff --git a/Moose Training/Documentation/STAGE.html b/Moose Training/Documentation/STAGE.html index d4e26709d..beb73a83b 100644 --- a/Moose Training/Documentation/STAGE.html +++ b/Moose Training/Documentation/STAGE.html @@ -17,6 +17,7 @@ index
    +
  • AIBalancer
  • Airbase
  • Base
  • CARGO
  • diff --git a/Moose Training/Documentation/Scheduler.html b/Moose Training/Documentation/Scheduler.html index 55b979b86..27b4935ba 100644 --- a/Moose Training/Documentation/Scheduler.html +++ b/Moose Training/Documentation/Scheduler.html @@ -17,6 +17,7 @@ index
    +
  • AIBalancer
  • Airbase
  • Base
  • CARGO
  • diff --git a/Moose Training/Documentation/Scoring.html b/Moose Training/Documentation/Scoring.html index c37ce03ca..22c920010 100644 --- a/Moose Training/Documentation/Scoring.html +++ b/Moose Training/Documentation/Scoring.html @@ -17,6 +17,7 @@ index
    +
  • AIBalancer
  • Airbase
  • Base
  • CARGO
  • diff --git a/Moose Training/Documentation/Sead.html b/Moose Training/Documentation/Sead.html index f756d0ec7..f9186167b 100644 --- a/Moose Training/Documentation/Sead.html +++ b/Moose Training/Documentation/Sead.html @@ -17,6 +17,7 @@ index
    +
  • AIBalancer
  • Airbase
  • Base
  • CARGO
  • diff --git a/Moose Training/Documentation/Set.html b/Moose Training/Documentation/Set.html index 684113b13..093aa3c2b 100644 --- a/Moose Training/Documentation/Set.html +++ b/Moose Training/Documentation/Set.html @@ -17,6 +17,7 @@ index

2.2) Add or Remove GROUP(s) from SET_GROUP:

-

GROUPS can be added and removed using the Set#SET_GROUP.AddGroupsByName and Set#SET_GROUPS.RemoveGroupsByName respectively. +

GROUPS can be added and removed using the Set#SET_GROUP.AddGroupsByName and Set#SET_GROUP.RemoveGroupsByName respectively. These methods take a single GROUP name or an array of GROUP names to be added or removed from SET_GROUP.

2.3) SET_GROUP filter criteria:

@@ -169,8 +170,11 @@ The following iterator methods are currently available within the SETGROUP:
  • SET_UNIT.New: Creates a new SET_UNIT object.
  • +

    3.2) Add or Remove UNIT(s) from SET_UNIT:

    +

    UNITs can be added and removed using the Set#SET_UNIT.AddUnitsByName and Set#SET_UNIT.RemoveUnitsByName respectively. +These methods take a single UNIT name or an array of UNIT names to be added or removed from SET_UNIT.

    -

    3.2) SET_UNIT filter criteria:

    +

    3.3) SET_UNIT filter criteria:

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

    @@ -194,22 +198,79 @@ Filter criteria are defined by:

  • SET_UNIT.FilterZones: Builds the SET_UNIT with the units within a Zone#ZONE.
  • -

    3.3) SET_UNIT iterators:

    +

    3.4) 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:

    • SET_UNIT.ForEachUnit: Calls a function for each alive unit it finds within the SET_UNIT.
    • +
    • SET_GROUP.ForEachGroupCompletelyInZone: 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: 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.

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

    +

    4) Set#SET_CLIENT class, extends Set#SET_BASE

    +

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

    + +
      +
    • Coalitions
    • +
    • Categories
    • +
    • Countries
    • +
    • Client types
    • +
    • Starting with certain prefix strings.
    • +
    + +

    4.1) SET_CLIENT construction method:

    +

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

    + + + +

    4.2) Add or Remove CLIENT(s) from SET_CLIENT:

    +

    CLIENTs can be added and removed using the Set#SET_CLIENT.AddClientsByName and Set#SET_CLIENT.RemoveClientsByName respectively. +These methods take a single CLIENT name or an array of CLIENT names to be added or removed from SET_CLIENT.

    + +

    4.3) SET_CLIENT filter criteria:

    +

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

    + + + +

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

    + + + +

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

    + + + +

    4.4) SET_CLIENT iterators:

    +

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

    + +
    @@ -220,6 +281,12 @@ The following iterator methods are currently available within the SETUNIT:<
    + + + + @@ -247,12 +314,6 @@ The following iterator methods are currently available within the SETUNIT:< - - - - @@ -331,6 +392,130 @@ The following iterator methods are currently available within the SETUNIT:< + +
    ESCORT.EscortName +
    ESCORT.FollowDistance +

    The current follow distance.

    ESCORT.FollowScheduler -

    The id of the _FollowScheduler function.

    +

    The instance of the SCHEDULER class.

    ESCORT:_FollowScheduler(FollowDistance)ESCORT:_FollowScheduler() MISSILETRAINER.ClassName +
    MISSILETRAINER.DBClients +
    MISSILETRAINER.TrackingFrequency +
    MISSILETRAINER.TrackingMissiles +
    MISSILETRAINER:_AddRange(Client, TrainerWeapon) +
    MISSILETRAINER._Alive(Client, self) +
    SET_BASE +
    SET_CLIENT +
    SET_BASE.ClassName -
    SET_BASE.Database -
    SET_BASE:_Find(ObjectName)

    Finds an Base#BASE object based on the object Name.

    +
    + +

    Type SET_CLIENT

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SET_CLIENT:AddClientsByName(AddClientNames) +

    Add CLIENT(s) to SET_CLIENT.

    +
    SET_CLIENT:AddInDatabase(Event) +

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

    +
    SET_CLIENT.ClassName + +
    SET_CLIENT.Clients + +
    SET_CLIENT.Filter + +
    SET_CLIENT:FilterCategories(Categories) +

    Builds a set of clients out of categories.

    +
    SET_CLIENT:FilterCoalitions(Coalitions) +

    Builds a set of clients of coalitions.

    +
    SET_CLIENT:FilterCountries(Countries) +

    Builds a set of clients of defined countries.

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

    Builds a set of clients of defined client prefixes.

    +
    SET_CLIENT:FilterStart() +

    Starts the filtering.

    +
    SET_CLIENT:FilterTypes(Types) +

    Builds a set of clients of defined client types.

    +
    SET_CLIENT:FindClient(ClientName) +

    Finds a Client based on the Client Name.

    +
    SET_CLIENT:FindInDatabase(Event) +

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

    +
    SET_CLIENT:ForEachClient(IteratorFunction, ...) +

    Interate the SET_CLIENT and call an interator function for each alive CLIENT, providing the CLIENT and optional parameters.

    +
    SET_CLIENT:ForEachClientCompletelyInZone(ZoneObject, IteratorFunction, ...) +

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

    +
    SET_CLIENT:ForEachClientNotInZone(ZoneObject, IteratorFunction, ...) +

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

    +
    SET_CLIENT:IsIncludeObject(MClient) + +
    SET_CLIENT:New() +

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

    +
    SET_CLIENT:RemoveClientsByName(RemoveClientNames) +

    Remove CLIENT(s) from SET_CLIENT.

    @@ -448,7 +633,7 @@ The following iterator methods are currently available within the SETUNIT:< SET_GROUP:RemoveGroupsByName(RemoveGroupNames) -

    Remove GROUP(s) to SET_GROUP.

    +

    Remove GROUP(s) from SET_GROUP.

    @@ -459,6 +644,12 @@ The following iterator methods are currently available within the SETUNIT:< SET_UNIT:AddInDatabase(Event)

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

    + + + + SET_UNIT:AddUnitsByName(AddUnitNames) + +

    Add UNIT(s) to SET_UNIT.

    @@ -531,6 +722,18 @@ The following iterator methods are currently available within the SETUNIT:< 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:ForEachUnitCompletelyInZone(ZoneObject, IteratorFunction, ...) + +

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

    + + + + SET_UNIT:ForEachUnitNotInZone(ZoneObject, IteratorFunction, ...) + +

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

    @@ -543,6 +746,12 @@ The following iterator methods are currently available within the SETUNIT:< 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:RemoveUnitsByName(RemoveUnitNames) + +

    Remove UNIT(s) from SET_UNIT.

    @@ -566,6 +775,20 @@ The following iterator methods are currently available within the SETUNIT:< + + +
    +
    + + #SET_CLIENT + +SET_CLIENT + +
    +
    + + +
    @@ -646,20 +869,6 @@ The added BASE Object.

    - -
    -
    -
    - - - -SET_BASE.Database - -
    -
    - - -
    @@ -966,6 +1175,550 @@ self

    Base#BASE: The Object found.

    + +
    + +

    Type SET_CLIENT

    + +

    SET_CLIENT class

    + +

    Field(s)

    +
    +
    + + +SET_CLIENT:AddClientsByName(AddClientNames) + +
    +
    + +

    Add CLIENT(s) to SET_CLIENT.

    + +

    Parameter

    +
      +
    • + +

      #string AddClientNames : +A single name or an array of CLIENT names.

      + +
    • +
    +

    Return value

    + + +

    self

    + +
    +
    +
    +
    + + +SET_CLIENT: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 CLIENT

      + +
    2. +
    3. + +

      #table: +The CLIENT

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

    Builds a set of clients 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_CLIENT: +self

    + +
    +
    +
    +
    + + +SET_CLIENT:FilterCoalitions(Coalitions) + +
    +
    + +

    Builds a set of clients of coalitions.

    + + +

    Possible current coalitions are red, blue and neutral.

    + +

    Parameter

    +
      +
    • + +

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

      + +
    • +
    +

    Return value

    + +

    #SET_CLIENT: +self

    + +
    +
    +
    +
    + + +SET_CLIENT:FilterCountries(Countries) + +
    +
    + +

    Builds a set of clients 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_CLIENT: +self

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

    Builds a set of clients of defined client prefixes.

    + + +

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

    + +

    Parameter

    +
      +
    • + +

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

      + +
    • +
    +

    Return value

    + +

    #SET_CLIENT: +self

    + +
    +
    +
    +
    + + +SET_CLIENT:FilterStart() + +
    +
    + +

    Starts the filtering.

    + +

    Return value

    + +

    #SET_CLIENT: +self

    + +
    +
    +
    +
    + + +SET_CLIENT:FilterTypes(Types) + +
    +
    + +

    Builds a set of clients of defined client 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_CLIENT: +self

    + +
    +
    +
    +
    + + +SET_CLIENT:FindClient(ClientName) + +
    +
    + +

    Finds a Client based on the Client Name.

    + +

    Parameter

    +
      +
    • + +

      #string ClientName :

      + +
    • +
    +

    Return value

    + +

    Client#CLIENT: +The found Client.

    + +
    +
    +
    +
    + + +SET_CLIENT: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 CLIENT

      + +
    2. +
    3. + +

      #table: +The CLIENT

      + +
    4. +
    +
    +
    +
    +
    + + +SET_CLIENT:ForEachClient(IteratorFunction, ...) + +
    +
    + +

    Interate the SET_CLIENT and call an interator function for each alive CLIENT, providing the CLIENT and optional parameters.

    + +

    Parameters

    +
      +
    • + +

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

      + +
    • +
    • + +

      ... :

      + +
    • +
    +

    Return value

    + +

    #SET_CLIENT: +self

    + +
    +
    +
    +
    + + +SET_CLIENT:ForEachClientCompletelyInZone(ZoneObject, IteratorFunction, ...) + +
    +
    + +

    Iterate the SET_CLIENT and call an iterator function for each alive CLIENT presence completely in a Zone, providing the CLIENT 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 CLIENT in the SET_CLIENT. The function needs to accept a CLIENT parameter.

      + +
    • +
    • + +

      ... :

      + +
    • +
    +

    Return value

    + +

    #SET_CLIENT: +self

    + +
    +
    +
    +
    + + +SET_CLIENT:ForEachClientNotInZone(ZoneObject, IteratorFunction, ...) + +
    +
    + +

    Iterate the SET_CLIENT and call an iterator function for each alive CLIENT presence not in a Zone, providing the CLIENT 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 CLIENT in the SET_CLIENT. The function needs to accept a CLIENT parameter.

      + +
    • +
    • + +

      ... :

      + +
    • +
    +

    Return value

    + +

    #SET_CLIENT: +self

    + +
    +
    +
    +
    + + +SET_CLIENT:IsIncludeObject(MClient) + +
    +
    + + + +

    Parameter

    + +

    Return value

    + +

    #SET_CLIENT: +self

    + +
    +
    +
    +
    + + +SET_CLIENT:New() + +
    +
    + +

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

    + +

    Return value

    + +

    #SET_CLIENT:

    + + +

    Usage:

    +
    -- Define a new SET_CLIENT Object. This DBObject will contain a reference to all Clients.
    +DBObject = SET_CLIENT:New()
    + +
    +
    +
    +
    + + +SET_CLIENT:RemoveClientsByName(RemoveClientNames) + +
    +
    + +

    Remove CLIENT(s) from SET_CLIENT.

    + +

    Parameter

    +
      +
    • + +

      Client#CLIENT RemoveClientNames : +A single name or an array of CLIENT names.

      + +
    • +
    +

    Return value

    + + +

    self

    +
    @@ -1488,7 +2241,7 @@ DBObject = SET_GROUP:New()
    -

    Remove GROUP(s) to SET_GROUP.

    +

    Remove GROUP(s) from SET_GROUP.

    Parameter

      @@ -1549,6 +2302,33 @@ The UNIT

      +
    + +
    +
    + + +SET_UNIT:AddUnitsByName(AddUnitNames) + +
    +
    + +

    Add UNIT(s) to SET_UNIT.

    + +

    Parameter

    +
      +
    • + +

      #string AddUnitNames : +A single name or an array of UNIT names.

      + +
    • +
    +

    Return value

    + + +

    self

    +
    @@ -1861,6 +2641,82 @@ self

    + +SET_UNIT:ForEachUnitCompletelyInZone(ZoneObject, IteratorFunction, ...) + +
    +
    + +

    Iterate the SET_UNIT and call an iterator function for each alive UNIT presence completely in a Zone, providing the UNIT 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 UNIT in the SET_UNIT. The function needs to accept a UNIT parameter.

      + +
    • +
    • + +

      ... :

      + +
    • +
    +

    Return value

    + +

    #SET_UNIT: +self

    + +
    +
    +
    +
    + + +SET_UNIT:ForEachUnitNotInZone(ZoneObject, IteratorFunction, ...) + +
    +
    + +

    Iterate the SET_UNIT and call an iterator function for each alive UNIT presence not in a Zone, providing the UNIT 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 UNIT in the SET_UNIT. The function needs to accept a UNIT parameter.

      + +
    • +
    • + +

      ... :

      + +
    • +
    +

    Return value

    + +

    #SET_UNIT: +self

    + +
    +
    +
    +
    + SET_UNIT:IsIncludeObject(MUnit) @@ -1904,6 +2760,33 @@ self

    -- Define a new SET_UNIT Object. This DBObject will contain a reference to all alive Units.
     DBObject = SET_UNIT:New()
    + +
    +
    +
    + + +SET_UNIT:RemoveUnitsByName(RemoveUnitNames) + +
    +
    + +

    Remove UNIT(s) from SET_UNIT.

    + +

    Parameter

    +
      +
    • + +

      Unit#UNIT RemoveUnitNames : +A single name or an array of UNIT names.

      + +
    • +
    +

    Return value

    + + +

    self

    +
    diff --git a/Moose Training/Documentation/Spawn.html b/Moose Training/Documentation/Spawn.html index ef75c88e3..9d9502cc0 100644 --- a/Moose Training/Documentation/Spawn.html +++ b/Moose Training/Documentation/Spawn.html @@ -17,6 +17,7 @@ index
      +
    • AIBalancer
    • Airbase
    • Base
    • CARGO
    • diff --git a/Moose Training/Documentation/Static.html b/Moose Training/Documentation/Static.html index 3d3ee61c2..8a589c0a6 100644 --- a/Moose Training/Documentation/Static.html +++ b/Moose Training/Documentation/Static.html @@ -17,6 +17,7 @@ index
      +
    • AIBalancer
    • Airbase
    • Base
    • CARGO
    • diff --git a/Moose Training/Documentation/StaticObject.html b/Moose Training/Documentation/StaticObject.html index bbf2cba18..53b5c8f56 100644 --- a/Moose Training/Documentation/StaticObject.html +++ b/Moose Training/Documentation/StaticObject.html @@ -17,6 +17,7 @@ index
      +
    • AIBalancer
    • Airbase
    • Base
    • CARGO
    • diff --git a/Moose Training/Documentation/TASK.html b/Moose Training/Documentation/TASK.html index 3855d0f1e..7d531077c 100644 --- a/Moose Training/Documentation/TASK.html +++ b/Moose Training/Documentation/TASK.html @@ -17,6 +17,7 @@ index
      +
    • AIBalancer
    • Airbase
    • Base
    • CARGO
    • diff --git a/Moose Training/Documentation/Unit.html b/Moose Training/Documentation/Unit.html index 8f51b0453..0472aab38 100644 --- a/Moose Training/Documentation/Unit.html +++ b/Moose Training/Documentation/Unit.html @@ -17,6 +17,7 @@ index
      +
    • AIBalancer
    • Airbase
    • Base
    • CARGO
    • diff --git a/Moose Training/Documentation/Zone.html b/Moose Training/Documentation/Zone.html index 490e4449d..260ecb52c 100644 --- a/Moose Training/Documentation/Zone.html +++ b/Moose Training/Documentation/Zone.html @@ -17,6 +17,7 @@ index
      +
    • AIBalancer
    • Airbase
    • Base
    • CARGO
    • diff --git a/Moose Training/Documentation/env.html b/Moose Training/Documentation/env.html index 927b69495..aebd87009 100644 --- a/Moose Training/Documentation/env.html +++ b/Moose Training/Documentation/env.html @@ -17,6 +17,7 @@ index
      +
    • AIBalancer
    • Airbase
    • Base
    • CARGO
    • diff --git a/Moose Training/Documentation/index.html b/Moose Training/Documentation/index.html index 96be59ebe..1f1d181a4 100644 --- a/Moose Training/Documentation/index.html +++ b/Moose Training/Documentation/index.html @@ -17,6 +17,7 @@ index
      +
    • AIBalancer
    • Airbase
    • Base
    • CARGO
    • @@ -71,6 +72,12 @@

      Module

      + + + +
      AIBalancer +

      This module contains the AIBALANCER class.

      +
      Airbase diff --git a/Moose Training/Documentation/land.html b/Moose Training/Documentation/land.html index 2164e74b0..b958ddd17 100644 --- a/Moose Training/Documentation/land.html +++ b/Moose Training/Documentation/land.html @@ -17,6 +17,7 @@ index
        +
      • AIBalancer
      • Airbase
      • Base
      • CARGO
      • diff --git a/Moose Training/Documentation/routines.html b/Moose Training/Documentation/routines.html index 2a4b23fd8..f5422ae60 100644 --- a/Moose Training/Documentation/routines.html +++ b/Moose Training/Documentation/routines.html @@ -17,6 +17,7 @@ index