diff --git a/Moose Development/Moose/Database.lua b/Moose Development/Moose/Database.lua index 4659a0d3f..c75bafc30 100644 --- a/Moose Development/Moose/Database.lua +++ b/Moose Development/Moose/Database.lua @@ -119,6 +119,8 @@ end function DATABASE:AddUnit( DCSUnitName ) if not self.UNITS[DCSUnitName] then + local UnitRegister = UNIT:Register( DCSUnitName ) + self:E( UnitRegister.UnitName ) self.UNITS[DCSUnitName] = UNIT:Register( DCSUnitName ) end diff --git a/Moose Development/Moose/Detection.lua b/Moose Development/Moose/Detection.lua index 7e1e82b69..83a119a77 100644 --- a/Moose Development/Moose/Detection.lua +++ b/Moose Development/Moose/Detection.lua @@ -52,7 +52,7 @@ -- @field DCSTypes#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target. -- @field #DETECTION_BASE.DetectedSets DetectedSets A list of @{Set#SET_BASE}s containing the objects in each set that were detected within a DetectedZoneRange. -- @field #DETECTION_BASE.DetectedZones DetectedZones A list of @{Zone#ZONE_BASE}s containing the zones of the reference detected objects. --- @extends Set#SET_BASE +-- @extends Base#BASE DETECTION_BASE = { ClassName = "DETECTION_BASE", DetectedSets = {}, @@ -92,8 +92,6 @@ function DETECTION_BASE:New( FACGroup, DetectionRange, DetectionZoneRange ) self:InitDetectIRST( false ) self:InitDetectDLINK( false ) - self.DetectionScheduler = SCHEDULER:New(self, self._DetectionScheduler, { self, "Detection" }, 10, 30, 0.2 ) - return self end @@ -207,6 +205,22 @@ function DETECTION_BASE:CreateDetectionSets() end +--- Schedule the DETECTION construction. +-- @param #DETECTION_BASE self +-- @param #number DelayTime The delay in seconds to wait the reporting. +-- @param #number RepeatInterval The repeat interval in seconds for the reporting to happen repeatedly. +-- @return #DETECTION_BASE self +function DETECTION_BASE:Schedule( DelayTime, RepeatInterval ) + self:F2() + + self.ScheduleDelayTime = DelayTime + self.ScheduleRepeatInterval = RepeatInterval + + self.DetectionScheduler = SCHEDULER:New(self, self._DetectionScheduler, { self, "Detection" }, DelayTime, RepeatInterval ) + return self +end + + --- Form @{Set}s of detected @{Unit#UNIT}s in an array of @{Set#SET_BASE}s. -- @param #DETECTION_BASE self function DETECTION_BASE:_DetectionScheduler( SchedulerName ) @@ -282,37 +296,41 @@ function DETECTION_BASE:_DetectionScheduler( SchedulerName ) end end +--- @type DETECTION_UNITGROUPS.DetectedSets +-- @list +-- + + +--- @type DETECTION_UNITGROUPS.DetectedZones +-- @list +-- --- DETECTION_UNITGROUPS class -- @type DETECTION_UNITGROUPS -- @field #DETECTION_UNITGROUPS.DetectedSets DetectedSets A list of @{Set#SET_UNIT}s containing the units in each set that were detected within a DetectedZoneRange. -- @field #DETECTION_UNITGROUPS.DetectedZones DetectedZones A list of @{Zone#ZONE_UNIT}s containing the zones of the reference detected units. --- @extends Set#SET_BASE +-- @extends Detection#DETECTION_BASE DETECTION_UNITGROUPS = { ClassName = "DETECTION_UNITGROUPS", DetectedZones = {}, } ---- @type DETECTION_UNITGROUPS.DetectedSets --- @list - - ---- @type DETECTION_UNITGROUPS.DetectedZones --- @list --- DETECTION_UNITGROUPS constructor. --- @param #DETECTION_UNITGROUPS self --- @field Group#GROUP FACGroup The GROUP in the Forward Air Controller role. --- @field DCSTypes#Distance DetectionRange The range till which targets are accepted to be detected. --- @field DCSTypes#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target. --- @return #DETECTION_UNITGROUPS self +-- @param Detection#DETECTION_UNITGROUPS self +-- @param Group#GROUP FACGroup The GROUP in the Forward Air Controller role. +-- @param DCSTypes#Distance DetectionRange The range till which targets are accepted to be detected. +-- @param DCSTypes#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target. +-- @return Detection#DETECTION_UNITGROUPS self function DETECTION_UNITGROUPS:New( FACGroup, DetectionRange, DetectionZoneRange ) -- Inherits from DETECTION_BASE local self = BASE:Inherit( self, DETECTION_BASE:New( FACGroup, DetectionRange, DetectionZoneRange ) ) + self:Schedule( 10, 30 ) + return self end @@ -324,13 +342,14 @@ function DETECTION_UNITGROUPS:CreateDetectionSets() self:F2() for DetectedUnitName, DetectedUnitData in pairs( self.DetectedObjects ) do + self:T( DetectedUnitData.Name ) local DetectedUnit = UNIT:FindByName( DetectedUnitData.Name ) -- Unit#UNIT if DetectedUnit and DetectedUnit:IsAlive() then self:T( DetectedUnit:GetName() ) if #self.DetectedSets == 0 then self:T( { "Adding Unit Set #", 1 } ) self.DetectedZones[1] = ZONE_UNIT:New( DetectedUnitName, DetectedUnit, self.DetectionZoneRange ) - self.DetectedSets[1] = SET_BASE:New() + self.DetectedSets[1] = SET_UNIT:New() self.DetectedSets[1]:AddUnit( DetectedUnit ) else local AddedToSet = false @@ -349,7 +368,7 @@ function DETECTION_UNITGROUPS:CreateDetectionSets() local DetectedZoneIndex = #self.DetectedZones + 1 self:T( "Adding new zone #" .. DetectedZoneIndex ) self.DetectedZones[DetectedZoneIndex] = ZONE_UNIT:New( DetectedUnitName, DetectedUnit, self.DetectionZoneRange ) - self.DetectedSets[DetectedZoneIndex] = SET_BASE:New() + self.DetectedSets[DetectedZoneIndex] = SET_UNIT:New() self.DetectedSets[DetectedZoneIndex]:AddUnit( DetectedUnit ) end end diff --git a/Moose Development/Moose/FAC.lua b/Moose Development/Moose/FAC.lua index 1f101f30b..27578c3f7 100644 --- a/Moose Development/Moose/FAC.lua +++ b/Moose Development/Moose/FAC.lua @@ -40,11 +40,11 @@ ---- FAC_BASE class +--- FAC_BASE class. -- @type FAC_BASE -- @field Set#SET_CLIENT ClientSet The clients to which the FAC will report to. -- @field Detection#DETECTION_BASE Detection The DETECTION_BASE object that is used to report the detected objects. --- @extends Set#SET_BASE +-- @extends Base#BASE FAC_BASE = { ClassName = "FAC_BASE", ClientSet = nil, @@ -80,6 +80,20 @@ function FAC_BASE:ReportDetected( DetectedSets ) end +--- Schedule the FAC reporting. +-- @param #FAC_BASE self +-- @param #number DelayTime The delay in seconds to wait the reporting. +-- @param #number RepeatInterval The repeat interval in seconds for the reporting to happen repeatedly. +-- @return #FAC_BASE self +function FAC_BASE:Schedule( DelayTime, RepeatInterval ) + self:F2() + + self.ScheduleDelayTime = DelayTime + self.ScheduleRepeatInterval = RepeatInterval + + self.FacScheduler = SCHEDULER:New(self, self._FacScheduler, { self, "Fac" }, DelayTime, RepeatInterval ) + return self +end --- Report the detected @{Unit#UNIT}s detected within the @{DetectION#DETECTION_BASE} object to the @{Set#SET_CLIENT}s. -- @param #FAC_BASE self @@ -105,11 +119,12 @@ end -- @type FAC_REPORTING -- @field Set#SET_CLIENT ClientSet The clients to which the FAC will report to. -- @field Detection#DETECTION_BASE Detection The DETECTION_BASE object that is used to report the detected objects. --- @extends Set#SET_BASE +-- @extends #FAC_BASE FAC_REPORTING = { ClassName = "FAC_REPORTING", } + --- FAC_REPORTING constructor. -- @param #FAC_REPORTING self -- @param Set#SET_CLIENT ClientSet @@ -118,11 +133,13 @@ FAC_REPORTING = { function FAC_REPORTING:New( ClientSet, Detection ) -- Inherits from FAC_BASE - local self = BASE:Inherit( self, FAC_BASE:New( ClientSet, Detection ) ) + local self = BASE:Inherit( self, FAC_BASE:New( ClientSet, Detection ) ) -- #FAC_REPORTING + self:Schedule( 5, 15 ) return self end + --- Reports the detected items to the @{Set#SET_CLIENT}. -- @param #FAC_REPORTING self -- @param Client#CLIENT Client The @{Client} object to where the report needs to go. @@ -130,7 +147,6 @@ end -- @return #boolean Return true if you want the reporting to continue... false will cancel the reporting loop. function FAC_REPORTING:ReportDetected( Client, DetectedSets ) self:F2( Client ) - DetectedSets:Flush() local DetectedMsg = {} for DetectedUnitSetID, DetectedUnitSet in pairs( DetectedSets ) do diff --git a/Moose Test Missions/Moose_Test_AIBALANCER/Moose_Test_AIBALANCER.miz b/Moose Test Missions/Moose_Test_AIBALANCER/Moose_Test_AIBALANCER.miz index b008a346d..d7d25cb11 100644 Binary files a/Moose Test Missions/Moose_Test_AIBALANCER/Moose_Test_AIBALANCER.miz and b/Moose Test Missions/Moose_Test_AIBALANCER/Moose_Test_AIBALANCER.miz differ diff --git a/Moose Test Missions/Moose_Test_AIRBASEPOLICE/Moose_Test_AIRBASEPOLICE.miz b/Moose Test Missions/Moose_Test_AIRBASEPOLICE/Moose_Test_AIRBASEPOLICE.miz index f411dba3f..6c59f6f1f 100644 Binary files a/Moose Test Missions/Moose_Test_AIRBASEPOLICE/Moose_Test_AIRBASEPOLICE.miz and b/Moose Test Missions/Moose_Test_AIRBASEPOLICE/Moose_Test_AIRBASEPOLICE.miz differ diff --git a/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_with_Moose.miz b/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_with_Moose.miz index cc28de1f3..b50ef932d 100644 Binary files a/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_with_Moose.miz and b/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_with_Moose.miz differ diff --git a/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_without_Moose.miz b/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_without_Moose.miz index 7f0c66487..15ba5dbfa 100644 Binary files a/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_without_Moose.miz and b/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_without_Moose.miz differ diff --git a/Moose Test Missions/Moose_Test_BASE/Moose_Test_BASE.miz b/Moose Test Missions/Moose_Test_BASE/Moose_Test_BASE.miz index 8f7ddb223..7ad834e02 100644 Binary files a/Moose Test Missions/Moose_Test_BASE/Moose_Test_BASE.miz and b/Moose Test Missions/Moose_Test_BASE/Moose_Test_BASE.miz differ 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 b9d016426..47bb18b13 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_DESTROY/MOOSE_Test_DESTROY.miz b/Moose Test Missions/Moose_Test_DESTROY/MOOSE_Test_DESTROY.miz index b8bf574e0..82d99360e 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_DETECTION/Moose_Test_DETECTION.miz b/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION.miz index 71d76205c..5135030a6 100644 Binary files a/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION.miz and b/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION.miz differ diff --git a/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION_Laser.miz b/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION_Laser.miz index ab240b77d..929213520 100644 Binary files a/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION_Laser.miz and b/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION_Laser.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 4851d0358..cc0efee88 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_FAC/Moose_Test_FAC.miz b/Moose Test Missions/Moose_Test_FAC/Moose_Test_FAC.miz index 89b5a40b9..78dd11cd1 100644 Binary files a/Moose Test Missions/Moose_Test_FAC/Moose_Test_FAC.miz and b/Moose Test Missions/Moose_Test_FAC/Moose_Test_FAC.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 3e62c176e..b4c142eb3 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_PATROLZONE/MOOSE_Test_PATROLZONE.miz b/Moose Test Missions/Moose_Test_PATROLZONE/MOOSE_Test_PATROLZONE.miz index f532e0626..90f46503d 100644 Binary files a/Moose Test Missions/Moose_Test_PATROLZONE/MOOSE_Test_PATROLZONE.miz and b/Moose Test Missions/Moose_Test_PATROLZONE/MOOSE_Test_PATROLZONE.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 5300c0b7b..2e3e79def 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_AIRBASE/Moose_Test_SET_AIRBASE.miz b/Moose Test Missions/Moose_Test_SET_AIRBASE/Moose_Test_SET_AIRBASE.miz index 5897e3047..3d9861d6b 100644 Binary files a/Moose Test Missions/Moose_Test_SET_AIRBASE/Moose_Test_SET_AIRBASE.miz and b/Moose Test Missions/Moose_Test_SET_AIRBASE/Moose_Test_SET_AIRBASE.miz differ diff --git a/Moose Test Missions/Moose_Test_SET_CLIENT/Moose_Test_SET_CLIENT.miz b/Moose Test Missions/Moose_Test_SET_CLIENT/Moose_Test_SET_CLIENT.miz index 38968b21d..fa18fdce1 100644 Binary files a/Moose Test Missions/Moose_Test_SET_CLIENT/Moose_Test_SET_CLIENT.miz and b/Moose Test Missions/Moose_Test_SET_CLIENT/Moose_Test_SET_CLIENT.miz differ 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 index e1f8e1ff2..1eaedbe6b 100644 Binary files a/Moose Test Missions/Moose_Test_SET_GROUP/Moose_Test_SET_GROUP.miz 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 780a574e7..5ac1595de 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 e587f90bb..eb53bdf95 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 9f20b9428..04b8ea18a 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 56c11ee4e..2e07736aa 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 3ae131e09..6d027216a 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 95b8bbad3..214eb7de5 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 061a7685f..c016d2679 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 33307bd33..2620b5c3e 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