mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Fixed DETECTION_AREAS, working again and complete with test missions.
This commit is contained in:
parent
8d73df48ce
commit
25bd0f8049
@ -404,8 +404,9 @@ end
|
||||
--- Bounds the zone with tires.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param #number Points (optional) The amount of points in the circle.
|
||||
-- @param #boolean UnBound If true the tyres will be destroyed.
|
||||
-- @return #ZONE_RADIUS self
|
||||
function ZONE_RADIUS:BoundZone( Points )
|
||||
function ZONE_RADIUS:BoundZone( Points, UnBound )
|
||||
|
||||
local Point = {}
|
||||
local Vec2 = self:GetVec2()
|
||||
@ -434,7 +435,10 @@ function ZONE_RADIUS:BoundZone( Points )
|
||||
["heading"] = 0,
|
||||
} -- end of ["group"]
|
||||
|
||||
coalition.addStaticObject( country.id.USA, Tire )
|
||||
local Group = coalition.addStaticObject( country.id.USA, Tire )
|
||||
if UnBound and UnBound == true then
|
||||
Group:destroy()
|
||||
end
|
||||
end
|
||||
|
||||
return self
|
||||
@ -867,8 +871,9 @@ end
|
||||
|
||||
--- Smokes the zone boundaries in a color.
|
||||
-- @param #ZONE_POLYGON_BASE self
|
||||
-- @param #boolean UnBound If true, the tyres will be destroyed.
|
||||
-- @return #ZONE_POLYGON_BASE self
|
||||
function ZONE_POLYGON_BASE:BoundZone( )
|
||||
function ZONE_POLYGON_BASE:BoundZone( UnBound )
|
||||
|
||||
local i
|
||||
local j
|
||||
@ -897,8 +902,11 @@ function ZONE_POLYGON_BASE:BoundZone( )
|
||||
["name"] = string.format( "%s-Tire #%0d", self:GetName(), ((i - 1) * Segments) + Segment ),
|
||||
["heading"] = 0,
|
||||
} -- end of ["group"]
|
||||
|
||||
coalition.addStaticObject( country.id.USA, Tire )
|
||||
|
||||
local Group = coalition.addStaticObject( country.id.USA, Tire )
|
||||
if UnBound and UnBound == true then
|
||||
Group:destroy()
|
||||
end
|
||||
|
||||
end
|
||||
j = i
|
||||
|
||||
@ -934,8 +934,8 @@ do -- DETECTION_BASE
|
||||
-- @param #number DetectedItemIndex The index or position in the DetectedItems list where the item needs to be removed.
|
||||
function DETECTION_BASE:RemoveDetectedItem( DetectedItemIndex )
|
||||
|
||||
self.DetectedItemCount = self.DetectedItemCount + 1
|
||||
self.DetectedItems[self.DetectedItemIndex] = nil
|
||||
self.DetectedItemCount = self.DetectedItemCount - 1
|
||||
self.DetectedItems[DetectedItemIndex] = nil
|
||||
end
|
||||
|
||||
|
||||
@ -1734,21 +1734,26 @@ do -- DETECTION_AREAS
|
||||
function DETECTION_AREAS:CreateDetectionSets()
|
||||
self:F2()
|
||||
|
||||
|
||||
self:T( "Checking Detected Items for new Detected Units ..." )
|
||||
-- First go through all detected sets, and check if there are new detected units, match all existing detected units and identify undetected units.
|
||||
-- Regroup when needed, split groups when needed.
|
||||
for DetectedAreaID, DetectedAreaData in ipairs( self.DetectedItems ) do
|
||||
for DetectedAreaID, DetectedAreaData in pairs( self.DetectedItems ) do
|
||||
|
||||
local DetectedArea = DetectedAreaData -- #DETECTION_AREAS.DetectedArea
|
||||
if DetectedArea then
|
||||
|
||||
self:T( { "Detected Area ID:", DetectedAreaID } )
|
||||
|
||||
|
||||
local DetectedSet = DetectedArea.Set
|
||||
|
||||
local AreaExists = false -- This flag will determine of the detected area is still existing.
|
||||
|
||||
-- First test if the center unit is detected in the detection area.
|
||||
self:T3( DetectedArea.Zone.ZoneUNIT.UnitName )
|
||||
self:T3( { "Zone Center Unit:", DetectedArea.Zone.ZoneUNIT.UnitName } )
|
||||
local DetectedZoneObject = self:GetDetectedObject( DetectedArea.Zone.ZoneUNIT.UnitName )
|
||||
self:T3( { "Detecting Zone Object", DetectedArea.AreaID, DetectedArea.Zone, DetectedZoneObject } )
|
||||
self:T3( { "Detected Zone Object:", DetectedArea.Zone:GetName(), DetectedZoneObject } )
|
||||
|
||||
if DetectedZoneObject then
|
||||
|
||||
@ -1776,6 +1781,8 @@ do -- DETECTION_AREAS
|
||||
self:IdentifyDetectedObject( DetectedObject )
|
||||
AreaExists = true
|
||||
|
||||
DetectedArea.Zone:BoundZone( 30, true)
|
||||
|
||||
-- Assign the Unit as the new center unit of the detected area.
|
||||
DetectedArea.Zone = ZONE_UNIT:New( DetectedUnit:GetName(), DetectedUnit, self.DetectionZoneRange )
|
||||
|
||||
@ -1827,7 +1834,8 @@ do -- DETECTION_AREAS
|
||||
end
|
||||
end
|
||||
else
|
||||
self:RemoveDetectedArea( DetectedAreaID )
|
||||
DetectedArea.Zone:BoundZone( 30, true)
|
||||
self:RemoveDetectedItem( DetectedAreaID )
|
||||
self:AddChangeArea( DetectedArea, "RA" )
|
||||
end
|
||||
end
|
||||
@ -1851,7 +1859,7 @@ do -- DETECTION_AREAS
|
||||
|
||||
local AddedToDetectionArea = false
|
||||
|
||||
for DetectedAreaID, DetectedAreaData in ipairs( self.DetectedItems ) do
|
||||
for DetectedAreaID, DetectedAreaData in pairs( self.DetectedItems ) do
|
||||
|
||||
local DetectedArea = DetectedAreaData -- #DETECTION_AREAS.DetectedArea
|
||||
if DetectedArea then
|
||||
@ -1883,7 +1891,7 @@ do -- DETECTION_AREAS
|
||||
-- Now all the tests should have been build, now make some smoke and flares...
|
||||
-- We also report here the friendlies within the detected areas.
|
||||
|
||||
for DetectedAreaID, DetectedAreaData in ipairs( self.DetectedItems ) do
|
||||
for DetectedAreaID, DetectedAreaData in pairs( self.DetectedItems ) do
|
||||
|
||||
local DetectedArea = DetectedAreaData -- #DETECTION_AREAS.DetectedArea
|
||||
local DetectedSet = DetectedArea.Set
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20170305_1029' )
|
||||
env.info( 'Moose Generation Timestamp: 20170306_1309' )
|
||||
|
||||
local base = _G
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20170305_1029' )
|
||||
env.info( 'Moose Generation Timestamp: 20170306_1309' )
|
||||
|
||||
local base = _G
|
||||
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
---
|
||||
-- Name: DET-255 - Detection AEAS with Destroys
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 06 Mar 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- A small blue vehicle with laser detection methods is detecting targets.
|
||||
-- Targets are grouped within areas. A detection range and zone range is given to group the detected units.
|
||||
-- This demo will group red vehicles in areas. One vehicle is diving from one group to the other.
|
||||
-- After 30 seconds, one vehicle is destroyed in a zone.
|
||||
-- After 60 seconds, a vehicle is destroyed that is a leader of a zone.
|
||||
-- After 90 seconds, all vehicles are destroyed in a zone.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the flaring of the areas formed
|
||||
-- 2. Observe the smoking of the units detected
|
||||
-- 3. Observe the areas being flexibly changed very detection run.
|
||||
-- 4. The truck driving from the one group to the other, will leave the first area, and will join the second.
|
||||
-- 5. While driving in between the areas, it will have a separate area.
|
||||
-- 6. Observe the correct removal or relocation of the ZONEs.
|
||||
|
||||
local FACSetGroup = SET_GROUP:New():FilterPrefixes( "FAC Group" ):FilterStart()
|
||||
|
||||
local FACDetection = DETECTION_AREAS:New( FACSetGroup, 150, 250 ):BoundDetectedZones():SmokeDetectedUnits()
|
||||
|
||||
FACDetection:__Start( 5 )
|
||||
|
||||
SCHEDULER:New( nil,function()
|
||||
local Target = UNIT:FindByName( "Target #004")
|
||||
Target:Destroy()
|
||||
end, {}, 30
|
||||
)
|
||||
|
||||
SCHEDULER:New( nil,function()
|
||||
local Target = UNIT:FindByName( "Target #006")
|
||||
Target:Destroy()
|
||||
end, {}, 60
|
||||
)
|
||||
|
||||
SCHEDULER:New( nil,function()
|
||||
local Target = UNIT:FindByName( "Target #007")
|
||||
Target:Destroy()
|
||||
end, {}, 90
|
||||
)
|
||||
Binary file not shown.
@ -1,4 +1,20 @@
|
||||
|
||||
---
|
||||
-- Name: TAD-100 - A2G Task Dispatching DETECTION_AREAS
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 06 Mar 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- This mission demonstrates the dynamic task dispatching for Air to Ground operations.
|
||||
-- FACA's and FAC's are patrolling around the battle zone, while detecting targets.
|
||||
-- The detection method used is the DETECTION_AREAS method, which groups detected targets into zones.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the FAC(A)'s detecting targets and grouping them.
|
||||
-- For test, each zone will have a circle of tyres, that are visible on the map too.
|
||||
-- 2. Check that the HQ provides menus to engage on a task set by the FACs.
|
||||
--
|
||||
local HQ = GROUP:FindByName( "HQ", "Bravo HQ" )
|
||||
|
||||
local CommandCenter = COMMANDCENTER:New( HQ, "Lima" )
|
||||
Loading…
x
Reference in New Issue
Block a user