Skip to content

Commit 4efd71e

Browse files
Merge remote-tracking branch 'origin/master-ng' into develop
2 parents fed9174 + 7e9dd9d commit 4efd71e

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

Moose Development/Moose/Ops/EasyGCICAP.lua

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
-- local mywing = EASYGCICAP:New("Blue CAP Operations",AIRBASE.Caucasus.Kutaisi,"blue","Blue EWR")
136136
--
137137
-- -- Add a CAP patrol point belonging to our airbase, we'll be at 30k ft doing 400 kn, initial direction 90 degrees (East), leg 20NM
138+
-- -- NOTE - Skip this function and do not create CAP Points if you want GCI behaviour only.
138139
-- mywing:AddPatrolPointCAP(AIRBASE.Caucasus.Kutaisi,ZONE:FindByName("Blue Zone 1"):GetCoordinate(),30000,400,90,20)
139140
--
140141
-- -- Add a Squadron with template "Blue Sq1 M2000c", 20 airframes, skill good, Modex starting with 102 and skin "Vendee Jeanne"
@@ -286,7 +287,7 @@ EASYGCICAP = {
286287

287288
--- EASYGCICAP class version.
288289
-- @field #string version
289-
EASYGCICAP.version="0.1.36"
290+
EASYGCICAP.version="0.1.37"
290291

291292
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
292293
--
@@ -754,6 +755,15 @@ end
754755
function EASYGCICAP:_AddAirwing(Airbasename, Alias)
755756
self:T(self.lid.."_AddAirwing "..Airbasename)
756757

758+
-- Gather Some Stats
759+
local function counttable(tbl)
760+
local count = 0
761+
for _,_data in pairs(tbl) do
762+
count = count + 1
763+
end
764+
return count
765+
end
766+
757767
local CapFormation = self.CapFormation
758768
local DespawnAfterLanding = self.DespawnAfterLanding
759769
local DespawnAfterHolding = self.DespawnAfterHolding
@@ -772,7 +782,11 @@ function EASYGCICAP:_AddAirwing(Airbasename, Alias)
772782
CAP_Wing:SetMarker(false)
773783
CAP_Wing:SetAirbase(AIRBASE:FindByName(Airbasename))
774784
CAP_Wing:SetRespawnAfterDestroyed()
775-
CAP_Wing:SetNumberCAP(self.capgrouping)
785+
786+
--- #DONE avoid wings with no CAP points starting CAP anyhow; AirWing uses this to start CAP and creates points when there are none.
787+
if counttable(self.ManagedCP) >0 then
788+
CAP_Wing:SetNumberCAP(self.capgrouping)
789+
end
776790
CAP_Wing:SetCapCloseRaceTrack(true)
777791

778792
if self.showpatrolpointmarks then
@@ -1039,7 +1053,7 @@ function EASYGCICAP:_SetCAPPatrolPoints()
10391053
MESSAGE:New(self.lid.."You are trying to create a CAP point for which there is no wing! "..tostring(data.AirbaseName),30,"CHECK"):ToAllIf(self.debug):ToLog()
10401054
return
10411055
end
1042-
local Wing = self.wings[data.AirbaseName][1] -- Ops.Airwing#AIRWING
1056+
local Wing = self.wings[data.AirbaseName][1] -- Ops.AirWing#AIRWING
10431057
local Coordinate = data.Coordinate
10441058
local Altitude = data.Altitude
10451059
local Speed = data.Speed

0 commit comments

Comments
 (0)