From c1bee3a9b00ba9cfbb510bbc8c49324afc7d7836 Mon Sep 17 00:00:00 2001
From: FlightControl
Date: Wed, 12 Jul 2017 20:42:06 +0200
Subject: [PATCH] Fixed #614 - Implemented an implementation with or without
{}....
See documentation of SetBorderZone.
---
.../Moose/AI/AI_A2A_Dispatcher.lua | 14 +++-
Moose Development/Moose/Core/Base.lua | 21 ++---
.../Moose/Functional/Detection.lua | 22 ++++--
docs/Documentation/AI_A2A.html | 1 +
docs/Documentation/AI_A2A_Dispatcher.html | 14 +++-
docs/Documentation/AI_Patrol.html | 3 +
docs/Documentation/Base.html | 18 +----
docs/Documentation/Detection.html | 8 +-
docs/Documentation/Event.html | 77 +++++++------------
docs/Documentation/Movement.html | 4 -
docs/Documentation/Set.html | 30 ++++++++
docs/Documentation/Settings.html | 2 +-
docs/Documentation/Spawn.html | 10 +--
docs/Documentation/Spot.html | 4 +
docs/Documentation/Task_Cargo.html | 3 +-
15 files changed, 133 insertions(+), 98 deletions(-)
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 @@
-
+ #number
AI_A2A.IdleCount
diff --git a/docs/Documentation/AI_A2A_Dispatcher.html b/docs/Documentation/AI_A2A_Dispatcher.html
index a18b241d8..9d4ab8887 100644
--- a/docs/Documentation/AI_A2A_Dispatcher.html
+++ b/docs/Documentation/AI_A2A_Dispatcher.html
@@ -1047,7 +1047,7 @@ But you can also define other zone types instead, like moving zones.
-- 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.
@@ -2523,7 +2523,7 @@ If a hot war is chosen then no borders actually need to be defi
Core.Zone#ZONE_BASE BorderZone :
-An object derived from ZONE_BASE, that defines a zone between
+An object derived from ZONEBASE, or a list of objects derived from ZONEBASE.
@@ -2534,9 +2534,17 @@ An object derived from ZONE_BASE, that defines a zone between
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 } )
+
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.
+
diff --git a/docs/Documentation/Base.html b/docs/Documentation/Base.html
index 032f52796..01653547f 100644
--- a/docs/Documentation/Base.html
+++ b/docs/Documentation/Base.html
@@ -260,7 +260,7 @@
- | BASE.IsInstanceOf(ClassName, self, className) |
+ BASE:IsInstanceOf(ClassName) |
This is the worker method to check if an object is an (sub)instance of a class.
|
@@ -1232,7 +1232,7 @@ Child
-
-BASE.IsInstanceOf(ClassName, self, className)
+BASE:IsInstanceOf(ClassName)
-
@@ -1252,22 +1252,12 @@ Child
-
Parameters
+ Parameter
diff --git a/docs/Documentation/Detection.html b/docs/Documentation/Detection.html
index d18ec397a..829d377e1 100644
--- a/docs/Documentation/Detection.html
+++ b/docs/Documentation/Detection.html
@@ -2393,6 +2393,7 @@ The index of the DetectedItem.
-
+ #number
DETECTION_BASE.DetectedItemCount
@@ -2406,6 +2407,7 @@ The index of the DetectedItem.
-
+ #number
DETECTION_BASE.DetectedItemMax
@@ -2563,7 +2565,7 @@ The index of the DetectedItem.
-
-
+ #number
DETECTION_BASE.DetectionInterval
@@ -3964,7 +3966,7 @@ self
-
- | EVENT.EventsDead |
-
-
|
@@ -417,18 +411,18 @@ Example code snippet:
| EVENT:OnTakeOffForTemplate(EventTemplate, EventFunction, EventClass) |
- |
-
-
- | EVENT:Remove(EventClass, EventID) |
-
- Removes a subscription
|
| EVENT:RemoveAll(EventObject) |
Clears all event subscriptions for a Base#BASE derived object.
+ |
+
+
+ | EVENT:RemoveEvent(EventClass, EventID) |
+
+ Removes a subscription
|
@@ -1033,19 +1027,6 @@ The Cargo created.
-
-
-
--
-
-
-EVENT.EventsDead
-
-
--
-
-
-
@@ -1498,8 +1479,29 @@ The self instance of the class for which the event is captured. When the event h
-
-
-EVENT:Remove(EventClass, EventID)
+
+EVENT:RemoveAll(EventObject)
+
+
+-
+
+
Clears all event subscriptions for a Base#BASE derived object.
+
+ Parameter
+
+
+
+
+-
+
+
+EVENT:RemoveEvent(EventClass, EventID)
-
@@ -1530,27 +1532,6 @@ The self instance of the class for which the event is.
-
-
-EVENT:RemoveAll(EventObject)
-
-
--
-
-
Clears all event subscriptions for a Base#BASE derived object.
-
- Parameter
-
-
-
-
--
-
EVENT:Reset(EventClass, EventID, EventObject)
diff --git a/docs/Documentation/Movement.html b/docs/Documentation/Movement.html
index be5ce073c..4307c3aaa 100644
--- a/docs/Documentation/Movement.html
+++ b/docs/Documentation/Movement.html
@@ -227,7 +227,6 @@ on defined intervals (currently every minute).
-
- #number
MOVEMENT.AliveUnits
@@ -236,9 +235,6 @@ on defined intervals (currently every minute).
-
-
Contains the counter how many units are currently alive
-
diff --git a/docs/Documentation/Set.html b/docs/Documentation/Set.html
index e0ef0a7bc..ce59ab37f 100644
--- a/docs/Documentation/Set.html
+++ b/docs/Documentation/Set.html
@@ -907,6 +907,12 @@ mission designer to add a dedicated method
| SET_GROUP:RemoveGroupsByName(RemoveGroupNames) |
Remove GROUP(s) from SET_GROUP.
+ |
+
+
+ | SET_GROUP:_EventOnDeadOrCrash(Event) |
+
+ Handles the OnDead or OnCrash event for alive groups set.
|
@@ -4428,6 +4434,30 @@ A single name or an array of GROUP names.
self
+
+
+
+-
+
+
+SET_GROUP:_EventOnDeadOrCrash(Event)
+
+
+-
+
+
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.
+
+ Parameter
+
diff --git a/docs/Documentation/Settings.html b/docs/Documentation/Settings.html
index b101bcee0..b0d412cb3 100644
--- a/docs/Documentation/Settings.html
+++ b/docs/Documentation/Settings.html
@@ -1082,7 +1082,7 @@ true if metric.
-
- #boolean
+
SETTINGS.Metric
diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html
index 6c440cb38..24a270866 100644
--- a/docs/Documentation/Spawn.html
+++ b/docs/Documentation/Spawn.html
@@ -2194,9 +2194,6 @@ The group that was spawned. You can use this group for further actions.
-
-
Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.
-
@@ -2746,6 +2743,9 @@ when nothing was spawned.
+
+ By default, no InitLimit
+
@@ -2781,7 +2781,7 @@ when nothing was spawned.
-
-
+ #number
SPAWN.SpawnMaxGroups
@@ -2798,7 +2798,7 @@ when nothing was spawned.
-
-
+ #number
SPAWN.SpawnMaxUnitsAlive
diff --git a/docs/Documentation/Spot.html b/docs/Documentation/Spot.html
index ead3792db..5fdc3b305 100644
--- a/docs/Documentation/Spot.html
+++ b/docs/Documentation/Spot.html
@@ -765,6 +765,7 @@ true if it is lasing
-
+
SPOT.ScheduleID
@@ -778,6 +779,7 @@ true if it is lasing
-
+
SPOT.SpotIR
@@ -791,6 +793,7 @@ true if it is lasing
-
+
SPOT.SpotLaser
@@ -804,6 +807,7 @@ true if it is lasing
-
+
SPOT.Target
diff --git a/docs/Documentation/Task_Cargo.html b/docs/Documentation/Task_Cargo.html
index cf19dab00..bb3b9bca1 100644
--- a/docs/Documentation/Task_Cargo.html
+++ b/docs/Documentation/Task_Cargo.html
@@ -552,7 +552,7 @@ based on the tasking capabilities defined in Task#TA
-
- Core.Cargo#CARGO_GROUP
+ Core.Cargo#CARGO
FSM_PROCESS.Cargo
@@ -566,6 +566,7 @@ based on the tasking capabilities defined in Task#TA
-
+
FSM_PROCESS.DeployZone