diff --git a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua index 131fea47f..b94d9bb9f 100644 --- a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua +++ b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua @@ -406,7 +406,7 @@ do -- AI_A2A_DISPATCHER -- -- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. -- -- Any enemy crossing this border will be engaged. -- CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) - -- A2ADispatcher:SetBorderZone( { CCCPBorderZone } ) + -- A2ADispatcher:SetBorderZone( CCCPBorderZone ) -- -- -- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly -- -- without an assignment within 100km radius from a detected target, will engage that target. @@ -798,14 +798,22 @@ do -- AI_A2A_DISPATCHER -- If it’s a cold war then the **borders of red and blue territory** need to be defined using a @{zone} object derived from @{Zone#ZONE_BASE}. This method needs to be used for this. -- If a hot war is chosen then **no borders** actually need to be defined using the helicopter units other than it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are. In a hot war the borders are effectively defined by the ground based radar coverage of a coalition. Set the noborders parameter to 1 -- @param #AI_A2A_DISPATCHER self - -- @param Core.Zone#ZONE_BASE BorderZone An object derived from ZONE_BASE, that defines a zone between + -- @param Core.Zone#ZONE_BASE BorderZone An object derived from ZONE_BASE, or a list of objects derived from ZONE_BASE. -- @return #AI_A2A_DISPATCHER -- @usage -- - -- -- Set a polygon zone as the border for the A2A dispatcher. + -- -- Set one ZONE_POLYGON object as the border for the A2A dispatcher. -- local BorderZone = ZONE_POLYGON( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) -- The GROUP object is a late activate helicopter unit. -- Dispatcher:SetBorderZone( BorderZone ) -- + -- or + -- + -- -- Set two ZONE_POLYGON objects as the border for the A2A dispatcher. + -- local BorderZone1 = ZONE_POLYGON( "CCCP Border1", GROUP:FindByName( "CCCP Border1" ) ) -- The GROUP object is a late activate helicopter unit. + -- local BorderZone2 = ZONE_POLYGON( "CCCP Border2", GROUP:FindByName( "CCCP Border2" ) ) -- The GROUP object is a late activate helicopter unit. + -- Dispatcher:SetBorderZone( { BorderZone1, BorderZone2 } ) + -- + -- function AI_A2A_DISPATCHER:SetBorderZone( BorderZone ) self.Detection:SetAcceptZones( BorderZone ) diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index 72d00d7e6..c263715bd 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -297,25 +297,26 @@ end -- * ZONE:New( 'some zone' ):IsInstanceOf( 'BASE' ) will return true -- -- * ZONE:New( 'some zone' ):IsInstanceOf( 'GROUP' ) will return false --- --- @param ClassName is the name of the class or the class itself to run the check against +-- +-- @param #BASE self +-- @param ClassName is the name of the class or the class itself to run the check against -- @return #boolean -function BASE:IsInstanceOf( className ) +function BASE:IsInstanceOf( ClassName ) -- Is className NOT a string ? - if type( className ) ~= 'string' then + if type( ClassName ) ~= 'string' then -- Is className a Moose class ? - if type( className ) == 'table' and className.ClassName ~= nil then + if type( ClassName ) == 'table' and ClassName.ClassName ~= nil then -- Get the name of the Moose class as a string - className = className.ClassName + ClassName = ClassName.ClassName -- className is neither a string nor a Moose class, throw an error else -- I'm not sure if this should take advantage of MOOSE logging function, or throw an error for pcall - local err_str = 'className parameter should be a string; parameter received: '..type( className ) + local err_str = 'className parameter should be a string; parameter received: '..type( ClassName ) self:E( err_str ) -- error( err_str ) return false @@ -323,9 +324,9 @@ function BASE:IsInstanceOf( className ) end end - className = string.upper( className ) + ClassName = string.upper( ClassName ) - if string.upper( self.ClassName ) == className then + if string.upper( self.ClassName ) == ClassName then return true end @@ -333,7 +334,7 @@ function BASE:IsInstanceOf( className ) while Parent do - if string.upper( Parent.ClassName ) == className then + if string.upper( Parent.ClassName ) == ClassName then return true end diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua index f1cfa525e..c3f978b81 100644 --- a/Moose Development/Moose/Functional/Detection.lua +++ b/Moose Development/Moose/Functional/Detection.lua @@ -956,15 +956,20 @@ do -- DETECTION_BASE --- Accept detections if within the specified zone(s). -- @param #DETECTION_BASE self - -- @param AcceptZones Can be a list or ZONE_BASE objects, or a single ZONE_BASE object. + -- @param Core.Zone#ZONE_BASE AcceptZones Can be a list or ZONE_BASE objects, or a single ZONE_BASE object. -- @return #DETECTION_BASE self function DETECTION_BASE:SetAcceptZones( AcceptZones ) self:F2() if type( AcceptZones ) == "table" then - self.AcceptZones = AcceptZones + if AcceptZones.ClassName and AcceptZones:IsInstanceOf( ZONE_BASE ) then + self.AcceptZones = { AcceptZones } + else + self.AcceptZones = AcceptZones + end else - self.AcceptZones = { AcceptZones } + self:E( { "AcceptZones must be a list of ZONE_BASE derived objects or one ZONE_BASE derived object", AcceptZones } ) + error() end return self @@ -972,15 +977,20 @@ do -- DETECTION_BASE --- Reject detections if within the specified zone(s). -- @param #DETECTION_BASE self - -- @param RejectZones Can be a list or ZONE_BASE objects, or a single ZONE_BASE object. + -- @param Core.Zone#ZONE_BASE RejectZones Can be a list or ZONE_BASE objects, or a single ZONE_BASE object. -- @return #DETECTION_BASE self function DETECTION_BASE:SetRejectZones( RejectZones ) self:F2() if type( RejectZones ) == "table" then - self.RejectZones = RejectZones + if RejectZones.ClassName and RejectZones:IsInstanceOf( ZONE_BASE ) then + self.RejectZones = { RejectZones } + else + self.RejectZones = RejectZones + end else - self.RejectZones = { RejectZones } + self:E( { "RejectZones must be a list of ZONE_BASE derived objects or one ZONE_BASE derived object", RejectZones } ) + error() end return self diff --git a/docs/Documentation/AI_A2A.html b/docs/Documentation/AI_A2A.html index ee2dc9007..2a24504d1 100644 --- a/docs/Documentation/AI_A2A.html +++ b/docs/Documentation/AI_A2A.html @@ -575,6 +575,7 @@
Core.Zone#ZONE_BASE BorderZone :
-An object derived from ZONE_BASE, that defines a zone between
- -- Set a polygon zone as the border for the A2A dispatcher.
+ -- Set one ZONE_POLYGON object as the border for the A2A dispatcher.
local BorderZone = ZONE_POLYGON( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) -- The GROUP object is a late activate helicopter unit.
Dispatcher:SetBorderZone( BorderZone )
+
+ or
+
+ -- Set two ZONE_POLYGON objects as the border for the A2A dispatcher.
+ local BorderZone1 = ZONE_POLYGON( "CCCP Border1", GROUP:FindByName( "CCCP Border1" ) ) -- The GROUP object is a late activate helicopter unit.
+ local BorderZone2 = ZONE_POLYGON( "CCCP Border2", GROUP:FindByName( "CCCP Border2" ) ) -- The GROUP object is a late activate helicopter unit.
+ Dispatcher:SetBorderZone( { BorderZone1, BorderZone2 } )
+
diff --git a/docs/Documentation/AI_Patrol.html b/docs/Documentation/AI_Patrol.html
index 93a9f8ce6..43392b308 100644
--- a/docs/Documentation/AI_Patrol.html
+++ b/docs/Documentation/AI_Patrol.html
@@ -926,6 +926,9 @@ Use the method AIPATROLZONE.M
+
+This table contains the targets detected during patrol.
+This is the worker method to check if an object is an (sub)instance of a class.
ClassName :
-is the name of the class or the class itself to run the check against
self :
className :
AcceptZones :
+
Core.Zone#ZONE_BASE AcceptZones :
Can be a list or ZONEBASE objects, or a single ZONEBASE object.
RejectZones :
+
Core.Zone#ZONE_BASE RejectZones :
Can be a list or ZONEBASE objects, or a single ZONEBASE object.
Removes a subscription
Clears all event subscriptions for a Base#BASE derived object.
+Removes a subscription
Clears all event subscriptions for a Base#BASE derived object.
+ +Core.Base#BASE EventObject :
Clears all event subscriptions for a Base#BASE derived object.
- -Core.Base#BASE EventObject :
Contains the counter how many units are currently alive
-Remove GROUP(s) from SET_GROUP.
+Handles the OnDead or OnCrash event for alive groups set.
self
+ +Handles the OnDead or OnCrash event for alive groups set.
+ + +Note: The GROUP object in the SET_GROUP collection will only be removed if the last unit is destroyed of the GROUP.
+ +Core.Event#EVENTDATA Event :
Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.
-By default, no InitLimit
+