#EASYGCICAP - make conflict zones setup a bit more explicit

This commit is contained in:
Applevangelist 2025-04-15 11:45:22 +02:00
parent 7df7a34c32
commit c9414d98da

View File

@ -62,6 +62,7 @@
-- @field #number repeatsonfailure -- @field #number repeatsonfailure
-- @field Core.Set#SET_ZONE GoZoneSet -- @field Core.Set#SET_ZONE GoZoneSet
-- @field Core.Set#SET_ZONE NoGoZoneSet -- @field Core.Set#SET_ZONE NoGoZoneSet
-- @field Core.Set#SET_ZONE ConflictZoneSet
-- @field #boolean Monitor -- @field #boolean Monitor
-- @field #boolean TankerInvisible -- @field #boolean TankerInvisible
-- @field #number CapFormation -- @field #number CapFormation
@ -102,6 +103,11 @@
-- Next put a late activated template group for your CAP/GCI Squadron on the map. Last, put a zone on the map for the CAP operations, let's name it "Blue Zone 1". Size of the zone plays no role. -- Next put a late activated template group for your CAP/GCI Squadron on the map. Last, put a zone on the map for the CAP operations, let's name it "Blue Zone 1". Size of the zone plays no role.
-- Put an EW radar system on the map and name it aptly, like "Blue EWR". -- Put an EW radar system on the map and name it aptly, like "Blue EWR".
-- --
-- ### Zones
--
-- For our example, you create a RED and a BLUE border, as a closed polygonal zone representing the borderlines. You can also have conflict zone, where - for our example - BLUE will attack
-- RED planes, despite being on RED territory. Think of a no-fly zone or an limited area of engagement. Conflict zones take precedence over borders, i.e. they can overlap all borders.
--
-- ### Code it -- ### Code it
-- --
-- -- Set up a basic system for the blue side, we'll reside on Kutaisi, and use GROUP objects with "Blue EWR" in the name as EW Radar Systems. -- -- Set up a basic system for the blue side, we'll reside on Kutaisi, and use GROUP objects with "Blue EWR" in the name as EW Radar Systems.
@ -114,10 +120,10 @@
-- mywing:AddSquadron("Blue Sq1 M2000c","CAP Kutaisi",AIRBASE.Caucasus.Kutaisi,20,AI.Skill.GOOD,102,"ec1.5_Vendee_Jeanne_clean") -- mywing:AddSquadron("Blue Sq1 M2000c","CAP Kutaisi",AIRBASE.Caucasus.Kutaisi,20,AI.Skill.GOOD,102,"ec1.5_Vendee_Jeanne_clean")
-- --
-- -- Add a couple of zones -- -- Add a couple of zones
-- -- We'll defend our border -- -- We'll defend our own border
-- mywing:AddAcceptZone(ZONE_POLYGON:New( "Blue Border", GROUP:FindByName( "Blue Border" ) )) -- mywing:AddAcceptZone(ZONE_POLYGON:New( "Blue Border", GROUP:FindByName( "Blue Border" ) ))
-- -- We'll attack intruders also here -- -- We'll attack intruders also here - conflictzones can overlap borders(!) - limited zone of engagement
-- mywing:AddAcceptZone(ZONE_POLYGON:New("Red Defense Zone", GROUP:FindByName( "Red Defense Zone" ))) -- mywing:AddConflictZone(ZONE_POLYGON:New("Red Defense Zone", GROUP:FindByName( "Red Defense Zone" )))
-- -- We'll leave the reds alone on their turf -- -- We'll leave the reds alone on their turf
-- mywing:AddRejectZone(ZONE_POLYGON:New( "Red Border", GROUP:FindByName( "Red Border" ) )) -- mywing:AddRejectZone(ZONE_POLYGON:New( "Red Border", GROUP:FindByName( "Red Border" ) ))
-- --
@ -125,10 +131,10 @@
-- -- Set up borders on map -- -- Set up borders on map
-- local BlueBorder = ZONE_POLYGON:New( "Blue Border", GROUP:FindByName( "Blue Border" ) ) -- local BlueBorder = ZONE_POLYGON:New( "Blue Border", GROUP:FindByName( "Blue Border" ) )
-- BlueBorder:DrawZone(-1,{0,0,1},1,FillColor,FillAlpha,1,true) -- BlueBorder:DrawZone(-1,{0,0,1},1,FillColor,FillAlpha,1,true)
-- local BlueNoGoZone = ZONE_POLYGON:New("Red Defense Zone", GROUP:FindByName( "Red Defense Zone" )) -- local ConflictZone = ZONE_POLYGON:New("Red Defense Zone", GROUP:FindByName( "Red Defense Zone" ))
-- BlueNoGoZone:DrawZone(-1,{1,1,0},1,FillColor,FillAlpha,2,true) -- ConflictZone:DrawZone(-1,{1,1,0},1,FillColor,FillAlpha,2,true)
-- local BlueNoGoZone2 = ZONE_POLYGON:New( "Red Border", GROUP:FindByName( "Red Border" ) ) -- local BlueNoGoZone = ZONE_POLYGON:New( "Red Border", GROUP:FindByName( "Red Border" ) )
-- BlueNoGoZone2:DrawZone(-1,{1,0,0},1,FillColor,FillAlpha,4,true) -- BlueNoGoZone:DrawZone(-1,{1,0,0},1,FillColor,FillAlpha,4,true)
-- --
-- ### Add a second airwing with squads and own CAP point (optional) -- ### Add a second airwing with squads and own CAP point (optional)
-- --
@ -210,6 +216,7 @@ EASYGCICAP = {
repeatsonfailure = 3, repeatsonfailure = 3,
GoZoneSet = nil, GoZoneSet = nil,
NoGoZoneSet = nil, NoGoZoneSet = nil,
ConflictZoneSet = nil,
Monitor = false, Monitor = false,
TankerInvisible = true, TankerInvisible = true,
CapFormation = nil, CapFormation = nil,
@ -252,7 +259,7 @@ EASYGCICAP = {
--- EASYGCICAP class version. --- EASYGCICAP class version.
-- @field #string version -- @field #string version
EASYGCICAP.version="0.1.17" EASYGCICAP.version="0.1.18"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list -- TODO list
@ -287,6 +294,7 @@ function EASYGCICAP:New(Alias, AirbaseName, Coalition, EWRName)
self.airbase = AIRBASE:FindByName(self.airbasename) self.airbase = AIRBASE:FindByName(self.airbasename)
self.GoZoneSet = SET_ZONE:New() self.GoZoneSet = SET_ZONE:New()
self.NoGoZoneSet = SET_ZONE:New() self.NoGoZoneSet = SET_ZONE:New()
self.ConflictZoneSet = SET_ZONE:New()
self.resurrection = 900 self.resurrection = 900
self.capspeed = 300 self.capspeed = 300
self.capalt = 25000 self.capalt = 25000
@ -1113,7 +1121,7 @@ end
-- @param Core.Zone#ZONE_BASE Zone -- @param Core.Zone#ZONE_BASE Zone
-- @return #EASYGCICAP self -- @return #EASYGCICAP self
function EASYGCICAP:AddAcceptZone(Zone) function EASYGCICAP:AddAcceptZone(Zone)
self:T(self.lid.."AddAcceptZone0") self:T(self.lid.."AddAcceptZone")
self.GoZoneSet:AddZone(Zone) self.GoZoneSet:AddZone(Zone)
return self return self
end end
@ -1128,6 +1136,18 @@ function EASYGCICAP:AddRejectZone(Zone)
return self return self
end end
--- Add a zone to the conflict zones set.
-- @param #EASYGCICAP self
-- @param Core.Zone#ZONE_BASE Zone
-- @return #EASYGCICAP self
function EASYGCICAP:AddConflictZone(Zone)
self:T(self.lid.."AddConflictZone")
self.ConflictZoneSet:AddZone(Zone)
self.GoZoneSet:AddZone(Zone)
return self
end
--- (Internal) Try to assign the intercept to a FlightGroup already in air and ready. --- (Internal) Try to assign the intercept to a FlightGroup already in air and ready.
-- @param #EASYGCICAP self -- @param #EASYGCICAP self
-- @param #table ReadyFlightGroups ReadyFlightGroups -- @param #table ReadyFlightGroups ReadyFlightGroups
@ -1193,6 +1213,7 @@ function EASYGCICAP:_AssignIntercept(Cluster)
local ctlpts = self.ManagedCP local ctlpts = self.ManagedCP
local MaxAliveMissions = self.MaxAliveMissions --* self.capgrouping local MaxAliveMissions = self.MaxAliveMissions --* self.capgrouping
local nogozoneset = self.NoGoZoneSet local nogozoneset = self.NoGoZoneSet
local conflictzoneset = self.ConflictZoneSet
local ReadyFlightGroups = self.ReadyFlightGroups local ReadyFlightGroups = self.ReadyFlightGroups
-- Aircraft? -- Aircraft?
@ -1271,18 +1292,22 @@ function EASYGCICAP:_AssignIntercept(Cluster)
if nogozoneset:Count() > 0 then if nogozoneset:Count() > 0 then
InterceptAuftrag:AddConditionSuccess( InterceptAuftrag:AddConditionSuccess(
function(group,zoneset) function(group,zoneset,conflictset)
local success = false local success = false
if group and group:IsAlive() then if group and group:IsAlive() then
local coord = group:GetCoordinate() local coord = group:GetCoordinate()
if coord and zoneset:IsCoordinateInZone(coord) then if coord and zoneset:Count() > 0 and zoneset:IsCoordinateInZone(coord) then
success = true success = true
end end
if coord and conflictset:Count() > 0 and conflictset:IsCoordinateInZone(coord) then
success = false
end
end end
return success return success
end, end,
contact.group, contact.group,
nogozoneset nogozoneset,
conflictzoneset
) )
end end
@ -1316,6 +1341,7 @@ function EASYGCICAP:_StartIntel()
BlueIntel:SetForgetTime(300) BlueIntel:SetForgetTime(300)
BlueIntel:SetAcceptZones(self.GoZoneSet) BlueIntel:SetAcceptZones(self.GoZoneSet)
BlueIntel:SetRejectZones(self.NoGoZoneSet) BlueIntel:SetRejectZones(self.NoGoZoneSet)
BlueIntel:SetConflictZones(self.ConflictZoneSet)
BlueIntel:SetVerbosity(0) BlueIntel:SetVerbosity(0)
BlueIntel:Start() BlueIntel:Start()