@jtff/miztemplate-lib 3.10.14 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lua/lib/HoundElint.lua +11378 -11415
- package/lua/lib/Moose_.lua +35746 -44020
- package/lua/src/010-root_menus.lua +4 -3
- package/lua/src/020-mission_functions.lua +905 -217
- package/lua/src/110-set_clients.lua +53 -43
- package/lua/src/115-airbases.lua +191 -0
- package/lua/src/120-tankers.lua +590 -461
- package/lua/src/130-airboss.lua +1982 -440
- package/lua/src/150-awacs.lua +551 -445
- package/lua/src/160-atis.lua +136 -73
- package/lua/src/170-cap_zone_training.lua +176 -73
- package/lua/src/172-cap_zone_war.lua +383 -226
- package/lua/src/173-fox_zone_training.lua +142 -67
- package/lua/src/174-qra-scenario.lua +417 -362
- package/lua/src/176-random_air_traffic.lua +101 -12
- package/lua/src/178-training-intercept.lua +312 -261
- package/lua/src/180-logistics.lua +2 -2
- package/lua/src/190-ranges.lua +104 -37
- package/lua/src/191-sams.lua +4 -4
- package/lua/src/193-training_ranges.lua +2 -2
- package/lua/src/195-reaper-ondemand.lua +29 -29
- package/lua/src/196-fac_ranges.lua +2 -2
- package/lua/src/197-elint-ondemand.lua +53 -53
- package/lua/src/199-skynet.lua +55 -55
- package/package.json +1 -1
- package/scripts/inject-scripts.js +3 -31
- package/lua/src/135-pedro.lua +0 -21
- package/lua/src/140-beacons.lua +0 -19
|
@@ -1,281 +1,438 @@
|
|
|
1
1
|
-- *****************************************************************************
|
|
2
2
|
-- ** CAPZone War **
|
|
3
3
|
-- *********************************************************
|
|
4
|
+
|
|
5
|
+
--region CAPZoneWarConfigFunctions
|
|
6
|
+
|
|
7
|
+
-- @type CAPPArameterConfig
|
|
8
|
+
-- @field #number patrolFloor Patrol floor in feet.
|
|
9
|
+
-- @field #number patrolCeiling Patrol ceiling in feet.
|
|
10
|
+
-- @field #number minPatrolSpeed Minimum patrol speed in knots.
|
|
11
|
+
-- @field #number maxPatrolSpeed Maximum patrol speed in knots.
|
|
12
|
+
-- @field #number minEngageSpeed Minimum engage speed in knots.
|
|
13
|
+
-- @field #number maxEngageSpeed Maximum engage speed in knots.
|
|
14
|
+
-- @field #number engageFloor Engage floor in feet.
|
|
15
|
+
-- @field #number engageCeiling Engage ceiling in feet.
|
|
16
|
+
|
|
17
|
+
-- @type GCICAPSquadronConfig
|
|
18
|
+
-- @field #string name Squadron Name
|
|
19
|
+
-- @field #string template Template name
|
|
20
|
+
-- @field #number skill Skill
|
|
21
|
+
-- @field #number nb_aircrafts Number of aircrafts
|
|
22
|
+
-- @field #string role Role of the squadron
|
|
23
|
+
-- @field #RadioConfig radio Radio configuration
|
|
24
|
+
-- @field #TacanConfig tacan TACAN configuration
|
|
25
|
+
-- @field #string modex ModeX configuration
|
|
26
|
+
-- @field #string livery Livery configuration
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
-- @type CAPZoneWarConfig
|
|
30
|
+
-- @field #boolean enable Enable CAP Zone creation.
|
|
31
|
+
-- @field #string name Name of the CAP Zone.
|
|
32
|
+
-- @field #boolean debug Debug mode for the CAP Zone.
|
|
33
|
+
-- @field #string borderZoneName Name of the border zone group.
|
|
34
|
+
-- @field #number detectionGroupingRadius Detection grouping radius in NM.
|
|
35
|
+
-- @field #number engageRadius Engage radius in NM.
|
|
36
|
+
-- @field #number fuelLowThreshold Fuel low threshold
|
|
37
|
+
-- @field #number fuelCriticalThreshold Fuel critical threshold
|
|
38
|
+
-- @field #boolean supportInvisible Support invisible for the CAP Zone.
|
|
39
|
+
-- @field #number maxAliveMissions Maximum number of alive missions
|
|
40
|
+
-- @field #number defaultGrouping Default grouping
|
|
41
|
+
-- @field #number turnoverTime Turnover time
|
|
42
|
+
-- @field #number repairTime Repair time
|
|
43
|
+
-- @field #number numberAlert5Standby Number of alert 5 standby
|
|
44
|
+
-- @field #number overhead Overhead coefficient
|
|
45
|
+
-- @field #string[] ewrPrefixes EWR prefixes to use for the CAP Zone.
|
|
46
|
+
-- @field #CAPZoneWarAirbaseConfig[] capZoneWarAirbases CAPZoneWar Airbases configuration.
|
|
47
|
+
-- @field #CAPPArameterConfig capParameters CAP parameters.
|
|
48
|
+
|
|
49
|
+
-- @type CAPZoneWarAirbaseConfig
|
|
50
|
+
-- @field #string name AirBase Name
|
|
51
|
+
-- @field #boolean enable Enable AirBase for the CAP Zone.
|
|
52
|
+
-- @field #GCICAPSquadronConfig[] squadrons Squadrons configuration.
|
|
53
|
+
-- @field #string patrolZoneName Name of the WRAPPER.GROUP or CORE.ZONE defining the patrol Zone
|
|
54
|
+
|
|
55
|
+
--- Parse CAPWarZone config Object.
|
|
56
|
+
-- @param #JsonObject config Config object to parse
|
|
57
|
+
-- @return #CAPZoneWarConfig capWarZoneConfigJson Parsed CAPZoneWarConfig object
|
|
58
|
+
function ParseCAPWarZoneConfigJson(config)
|
|
59
|
+
local json = require('Scripts/json')
|
|
60
|
+
local parser_name = "CAP_WAR_ZONE"
|
|
61
|
+
-- **************************************************************************
|
|
62
|
+
-- enable
|
|
63
|
+
-- **************************************************************************
|
|
64
|
+
local capWarZoneConfigJson
|
|
65
|
+
if config.enable == true then
|
|
66
|
+
capWarZoneConfigJson = config
|
|
67
|
+
else
|
|
68
|
+
capWarZoneConfigJson = {
|
|
69
|
+
enable = false,
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
Jtff_log.debug(
|
|
73
|
+
string.format(
|
|
74
|
+
"parsed CAP WarZone config for %s Zone, resulting config :\n%s",
|
|
75
|
+
config.type or "",
|
|
76
|
+
json:encode(
|
|
77
|
+
capWarZoneConfigJson,
|
|
78
|
+
{ indent = true }
|
|
79
|
+
)
|
|
80
|
+
),
|
|
81
|
+
parser_name
|
|
82
|
+
)
|
|
83
|
+
return capWarZoneConfigJson
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
-- endregion CAPZoneWarConfigFunctions
|
|
87
|
+
|
|
88
|
+
-- region CAPZoneWarFunctions
|
|
89
|
+
|
|
4
90
|
function toggleDebugCapWarZone(objCapWarZone)
|
|
5
|
-
objCapWarZone.
|
|
91
|
+
objCapWarZone.Monitor = not(objCapWarZone.Monitor)
|
|
6
92
|
end
|
|
7
93
|
|
|
8
|
-
function
|
|
9
|
-
|
|
94
|
+
function WipeCapWarZone(objCapWarZone)
|
|
95
|
+
Jtff_log.info(
|
|
96
|
+
string.format(
|
|
97
|
+
"%s Zone Stopping...",
|
|
98
|
+
objCapWarZone.customconfig.name
|
|
99
|
+
),
|
|
100
|
+
"CAP_WAR_ZONE"
|
|
101
|
+
)
|
|
10
102
|
--TODO: remove all drawings generated by CAPSquadrons
|
|
11
|
-
objCapWarZone.
|
|
12
|
-
objCapWarZone.
|
|
13
|
-
objCapWarZone.
|
|
14
|
-
|
|
15
|
-
|
|
103
|
+
objCapWarZone.Monitor = false
|
|
104
|
+
objCapWarZone.debug = false
|
|
105
|
+
for _airbase, _wing in pairs(objCapWarZone.wings or {}) do
|
|
106
|
+
Jtff_log.debug(
|
|
107
|
+
string.format(
|
|
108
|
+
"%s Airwing Stopping...",
|
|
109
|
+
objCapWarZone.wings[_airbase][1].alias
|
|
110
|
+
),
|
|
111
|
+
"CAP_WAR_ZONE"
|
|
112
|
+
)
|
|
113
|
+
for _indexMission, _mission in pairs(objCapWarZone.wings[_airbase][1].missionqueue or {}) do
|
|
114
|
+
Jtff_log.debug(
|
|
115
|
+
string.format(
|
|
116
|
+
"Airwings %s mission %s cancelling...",
|
|
117
|
+
objCapWarZone.wings[_airbase][1].alias,
|
|
118
|
+
_mission:GetName()
|
|
119
|
+
),
|
|
120
|
+
"CAP_WAR_ZONE"
|
|
121
|
+
)
|
|
122
|
+
for _index,opsGroup in pairs(_mission:GetOpsGroups()) do
|
|
123
|
+
opsGroup:RTB(opsGroup.legion.airbase)
|
|
124
|
+
end
|
|
125
|
+
_mission:Cancel()
|
|
126
|
+
end
|
|
127
|
+
for _indexSquadron, _squadron in pairs(objCapWarZone.wings[_airbase][1].cohorts or {}) do
|
|
128
|
+
Jtff_log.debug(
|
|
129
|
+
string.format(
|
|
130
|
+
"%s Squadron Stopping...",
|
|
131
|
+
_squadron.name
|
|
132
|
+
),
|
|
133
|
+
"CAP_WAR_ZONE"
|
|
134
|
+
)
|
|
135
|
+
_squadron:Stop()
|
|
136
|
+
for _index,v in pairs(_COHORTNAMES) do
|
|
137
|
+
if v == _squadron.name then
|
|
138
|
+
table.remove(_COHORTNAMES, _index)
|
|
139
|
+
break
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
_wing[1]:Stop()
|
|
144
|
+
end
|
|
145
|
+
objCapWarZone:Stop()
|
|
16
146
|
objCapWarZone.objMenu:RemoveSubMenus()
|
|
17
147
|
MENU_MISSION_COMMAND:New(
|
|
18
148
|
"Start ".. objCapWarZone.customconfig.name .. " CAP War Zone",
|
|
19
149
|
objCapWarZone.objMenu,
|
|
20
|
-
|
|
150
|
+
StartCapWarZone,
|
|
21
151
|
objCapWarZone)
|
|
22
152
|
trigger.action.outText('CAP War Zone '..(objCapWarZone.customconfig.name)..' disabled !!', 30)
|
|
23
153
|
end
|
|
24
154
|
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
objCapWarZone.objDispatcher:SetBorderZone(objCapWarZone.objZone)
|
|
33
|
-
objCapWarZone.objDispatcher:SetEngageRadius(UTILS.NMToMeters(objCapWarZone.customconfig.engageRadius or UTILS.MetersToNM(100000)))
|
|
34
|
-
objCapWarZone.objDispatcher:SetGciRadius(UTILS.NMToMeters(objCapWarZone.customconfig.gciRadius or UTILS.MetersToNM(200000)))
|
|
35
|
-
objCapWarZone.objDispatcher:SetDefaultTakeoffFromParkingHot()
|
|
36
|
-
objCapWarZone.objDispatcher:SetDefaultLandingAtRunway()
|
|
37
|
-
objCapWarZone.objDispatcher:SetDefaultFuelThreshold(0.30)
|
|
38
|
-
objCapWarZone.objDispatcher:SetDefaultCapRacetrack(
|
|
39
|
-
UTILS.NMToMeters(20),
|
|
40
|
-
UTILS.NMToMeters(40),
|
|
41
|
-
0,
|
|
42
|
-
180,
|
|
43
|
-
15*60,
|
|
44
|
-
45*60
|
|
155
|
+
function StartCapWarZone(objCapWarZone)
|
|
156
|
+
Jtff_log.info(
|
|
157
|
+
string.format(
|
|
158
|
+
"%s Zone Starting...",
|
|
159
|
+
objCapWarZone.customconfig.name
|
|
160
|
+
),
|
|
161
|
+
"CAP_WAR_ZONE"
|
|
45
162
|
)
|
|
46
|
-
objCapWarZone.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
163
|
+
local capwarzoneconfig = objCapWarZone.customconfig
|
|
164
|
+
local borderZone = objCapWarZone.jtff_borderZone
|
|
165
|
+
local patrolZones = objCapWarZone.jtff_patrolZones
|
|
166
|
+
local objMenu = objCapWarZone.objMenu
|
|
167
|
+
objCapWarZone = EASYGCICAP:New(
|
|
168
|
+
string.format("CAP War Zone %s",capwarzoneconfig.name),
|
|
169
|
+
capwarzoneconfig.capZoneWarAirbases[1].name,
|
|
170
|
+
STATIC:FindByName(capwarzoneconfig.capZoneWarAirbases[1].name):GetCoalitionName(),
|
|
171
|
+
capwarzoneconfig.ewrPrefixes
|
|
172
|
+
)
|
|
173
|
+
objCapWarZone.jtff_borderZone = borderZone
|
|
174
|
+
objCapWarZone.jtff_patrolZones = patrolZones
|
|
175
|
+
objCapWarZone.objMenu = objMenu
|
|
176
|
+
objCapWarZone.customconfig = capwarzoneconfig
|
|
177
|
+
objCapWarZone:SetFuelLow(capwarzoneconfig.fuelLowThreshold or 25)
|
|
178
|
+
objCapWarZone:SetFuelCritical(capwarzoneconfig.fuelCriticalThreshold or 15)
|
|
179
|
+
objCapWarZone:SetCAPFormation(ENUMS.Formation.FixedWing.FingerFour.Group)
|
|
180
|
+
objCapWarZone:SetTankerAndAWACSInvisible(capwarzoneconfig.supportInvisible or false)
|
|
181
|
+
objCapWarZone:SetMaxAliveMissions(capwarzoneconfig.maxAliveMissions or 6)
|
|
182
|
+
objCapWarZone:SetDefaultResurrection(900)
|
|
183
|
+
objCapWarZone:SetDefaultRepeatOnFailure(3)
|
|
184
|
+
objCapWarZone:SetDefaultTakeOffType('hot')
|
|
185
|
+
objCapWarZone:SetDefaultCAPSpeed(math.random(capwarzoneconfig.capParameters.minPatrolSpeed, capwarzoneconfig.capParameters.maxPatrolSpeed))
|
|
186
|
+
objCapWarZone:SetDefaultCAPAlt(math.random(capwarzoneconfig.capParameters.patrolFloor, capwarzoneconfig.capParameters.patrolCeiling))
|
|
187
|
+
objCapWarZone:SetDefaultCAPLeg(20)
|
|
188
|
+
objCapWarZone:SetDefaultCAPGrouping(capwarzoneconfig.defaultGrouping or 2)
|
|
189
|
+
objCapWarZone:SetDefaultMissionRange(120)
|
|
190
|
+
objCapWarZone:SetDefaultDespawnAfterLanding()
|
|
191
|
+
objCapWarZone:SetDefaultTurnoverTime(capwarzoneconfig.turnoverTime or 10, capwarzoneconfig.repairTime or 20)
|
|
192
|
+
objCapWarZone:SetDefaultNumberAlert5Standby(capwarzoneconfig.numberAlert5Standby or 2)
|
|
193
|
+
objCapWarZone:SetDefaultEngageRange(capwarzoneconfig.engageRadius or 50)
|
|
194
|
+
objCapWarZone:SetDefaultOverhead(capwarzoneconfig.overhead or 1)
|
|
195
|
+
objCapWarZone.debug = capwarzoneconfig.debug or false
|
|
196
|
+
objCapWarZone.Monitor = capwarzoneconfig.debug or false
|
|
197
|
+
if type(GROUP:FindByName( capwarzoneconfig.borderZoneName )) ~= 'nil' then
|
|
198
|
+
objCapWarZone:AddAcceptZone(ZONE_POLYGON:FindByName(capwarzoneconfig.borderZoneName))
|
|
199
|
+
elseif type(ZONE:New(capwarzoneconfig.borderZoneName)) ~= 'nil' then
|
|
200
|
+
objCapWarZone:AddAcceptZone(ZONE:FindByName(capwarzoneconfig.borderZoneName))
|
|
201
|
+
end
|
|
202
|
+
for _indexAirbase, _czwAirbaseconfig in ipairs(capwarzoneconfig.capZoneWarAirbases) do
|
|
203
|
+
local airbaseconfig = _czwAirbaseconfig
|
|
204
|
+
if airbaseconfig.enable == true then
|
|
205
|
+
Jtff_log.info(
|
|
206
|
+
string.format(
|
|
207
|
+
'creation Airbase %s: ...',
|
|
208
|
+
airbaseconfig.name
|
|
209
|
+
),
|
|
210
|
+
"CAP_WAR_ZONE"
|
|
211
|
+
)
|
|
212
|
+
if _indexAirbase ~= 1 then
|
|
213
|
+
objCapWarZone:AddAirwing(
|
|
214
|
+
airbaseconfig.name,
|
|
215
|
+
airbaseconfig.name
|
|
216
|
+
)
|
|
217
|
+
end
|
|
218
|
+
local patrolZone = {}
|
|
219
|
+
local patrolZoneVisibility
|
|
220
|
+
if objCapWarZone.debug == true then
|
|
221
|
+
patrolZoneVisibility = -1
|
|
222
|
+
else
|
|
223
|
+
patrolZoneVisibility = objCapWarZone.coalition
|
|
224
|
+
end
|
|
225
|
+
if type(GROUP:FindByName( airbaseconfig.patrolZoneName )) ~= 'nil' then
|
|
226
|
+
patrolZone = ZONE_POLYGON:FindByName(airbaseconfig.patrolZoneName)
|
|
227
|
+
if type(patrolZone) == 'nil' then
|
|
228
|
+
patrolZone = ZONE_POLYGON:New(
|
|
229
|
+
airbaseconfig.patrolZoneName,
|
|
230
|
+
GROUP:FindByName( airbaseconfig.patrolZoneName )
|
|
231
|
+
):DrawZone(
|
|
232
|
+
patrolZoneVisibility,
|
|
233
|
+
{1,0,0},
|
|
234
|
+
1,
|
|
235
|
+
{1,1,0},
|
|
236
|
+
0.10,
|
|
237
|
+
4,
|
|
238
|
+
true,
|
|
239
|
+
nil
|
|
83
240
|
)
|
|
84
241
|
end
|
|
85
|
-
|
|
86
|
-
objCapWarZone.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
end
|
|
117
|
-
if objCapWarZone.customconfig.coalitionCAP == coalition.side.RED then
|
|
118
|
-
if ((objCapWarZone.customconfig.drawzone == true) or false) then
|
|
119
|
-
CapZone:DrawZone(
|
|
120
|
-
coalition.side.BLUE,
|
|
121
|
-
{1,0,1},
|
|
122
|
-
1,
|
|
123
|
-
{1,0,1},
|
|
124
|
-
0.10,
|
|
125
|
-
4,
|
|
126
|
-
true,
|
|
127
|
-
nil
|
|
128
|
-
)
|
|
129
|
-
CapZone:GetCoordinate():TextToAll(
|
|
130
|
-
"CAP Warzone " .. objCapWarZone.customconfig.name,
|
|
131
|
-
coalition.side.BLUE,
|
|
132
|
-
{1,0,0},
|
|
133
|
-
1,
|
|
134
|
-
{1,0,0},
|
|
135
|
-
0,
|
|
136
|
-
20,
|
|
137
|
-
true
|
|
138
|
-
)
|
|
139
|
-
end
|
|
140
|
-
else
|
|
141
|
-
if ((objCapWarZone.customconfig.drawzone == true) or false) then
|
|
142
|
-
CapZone:DrawZone(
|
|
143
|
-
coalition.side.RED,
|
|
144
|
-
{1,0,1},
|
|
145
|
-
1,
|
|
146
|
-
{1,0,1},
|
|
147
|
-
0.10,
|
|
148
|
-
4,
|
|
149
|
-
true,
|
|
150
|
-
nil
|
|
151
|
-
)
|
|
152
|
-
CapZone:GetCoordinate():TextToAll(
|
|
153
|
-
"CAP Warzone " .. objCapWarZone.customconfig.name,
|
|
154
|
-
coalition.side.RED,
|
|
155
|
-
{1,0,0},
|
|
156
|
-
1,
|
|
157
|
-
{1,0,0},
|
|
158
|
-
0,
|
|
159
|
-
20,
|
|
160
|
-
true
|
|
161
|
-
)
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
jtff_log.info(string.format("Assigned Squadron %s to %s patrol Zone...", CAPSquadronName, CapZoneName),"CAP_WAR_ZONE")
|
|
165
|
-
objCapWarZone.objDispatcher:SetSquadronCap(
|
|
166
|
-
CAPSquadronName,
|
|
167
|
-
CapZone,
|
|
168
|
-
UTILS.FeetToMeters(objCapWarZone.customconfig.capParameters.patrolFloor) or UTILS.FeetToMeters(20000),
|
|
169
|
-
UTILS.FeetToMeters(objCapWarZone.customconfig.capParameters.patrolCeiling) or UTILS.FeetToMeters(50000),
|
|
170
|
-
UTILS.KnotsToKmph(objCapWarZone.customconfig.capParameters.minPatrolSpeed) or UTILS.KnotsToKmph(200),
|
|
171
|
-
UTILS.KnotsToKmph(objCapWarZone.customconfig.capParameters.maxPatrolSpeed) or UTILS.KnotsToKmph(400),
|
|
172
|
-
UTILS.KnotsToKmph(objCapWarZone.customconfig.capParameters.minEngageSpeed) or UTILS.KnotsToKmph(200),
|
|
173
|
-
UTILS.KnotsToKmph(objCapWarZone.customconfig.capParameters.maxEngageSpeed) or UTILS.KnotsToKmph(2000),
|
|
174
|
-
"BARO"
|
|
242
|
+
table.insert(
|
|
243
|
+
objCapWarZone.jtff_patrolZones,
|
|
244
|
+
patrolZone
|
|
245
|
+
)
|
|
246
|
+
objCapWarZone:AddConflictZone(ZONE_POLYGON:FindByName(airbaseconfig.patrolZoneName))
|
|
247
|
+
elseif type(ZONE:FindByName(airbaseconfig.patrolZoneName)) ~= 'nil' then
|
|
248
|
+
patrolZone = ZONE:FindByName(airbaseconfig.patrolZoneName):DrawZone(
|
|
249
|
+
patrolZoneVisibility,
|
|
250
|
+
{1,0,0},
|
|
251
|
+
1,
|
|
252
|
+
{1,1,0},
|
|
253
|
+
0.10,
|
|
254
|
+
4,
|
|
255
|
+
true,
|
|
256
|
+
nil
|
|
257
|
+
)
|
|
258
|
+
table.insert(
|
|
259
|
+
objCapWarZone.jtff_patrolZones,
|
|
260
|
+
patrolZone
|
|
261
|
+
)
|
|
262
|
+
objCapWarZone:AddConflictZone(ZONE:FindByName(airbaseconfig.patrolZoneName))
|
|
263
|
+
else
|
|
264
|
+
patrolZone = ZONE:New(airbaseconfig.patrolZoneName):DrawZone(
|
|
265
|
+
patrolZoneVisibility,
|
|
266
|
+
{1,0,0},
|
|
267
|
+
1,
|
|
268
|
+
{1,1,0},
|
|
269
|
+
0.10,
|
|
270
|
+
4,
|
|
271
|
+
true,
|
|
272
|
+
nil
|
|
175
273
|
)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
capsqnconfig.patrolInAirNumber,
|
|
180
|
-
8*60,
|
|
181
|
-
13*60,
|
|
182
|
-
1
|
|
274
|
+
table.insert(
|
|
275
|
+
objCapWarZone.jtff_patrolZones,
|
|
276
|
+
patrolZone
|
|
183
277
|
)
|
|
278
|
+
objCapWarZone:AddConflictZone(ZONE:FindByName(airbaseconfig.patrolZoneName))
|
|
184
279
|
end
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
interceptsqnconfig.groupName,
|
|
196
|
-
interceptsqnconfig.groupNumber * interceptsqnconfig.groupForce
|
|
197
|
-
)
|
|
198
|
-
objCapWarZone.objDispatcher:SetSquadronGrouping(
|
|
199
|
-
interceptSquadronName,
|
|
200
|
-
interceptsqnconfig.groupForce
|
|
280
|
+
for _, _squadronconfig in ipairs(airbaseconfig.squadrons) do
|
|
281
|
+
if _squadronconfig.role == 'fighter' then
|
|
282
|
+
objCapWarZone:AddSquadron(
|
|
283
|
+
_squadronconfig.template,
|
|
284
|
+
_squadronconfig.name,
|
|
285
|
+
airbaseconfig.name,
|
|
286
|
+
_squadronconfig.nb_aircrafts,
|
|
287
|
+
_squadronconfig.skill,
|
|
288
|
+
_squadronconfig.modex or nil,
|
|
289
|
+
_squadronconfig.livery or nil
|
|
201
290
|
)
|
|
202
|
-
|
|
203
|
-
|
|
291
|
+
elseif _squadronconfig.role == 'awacs' then
|
|
292
|
+
objCapWarZone:AddAWACSSquadron(
|
|
293
|
+
_squadronconfig.template,
|
|
294
|
+
_squadronconfig.name,
|
|
295
|
+
airbaseconfig.name,
|
|
296
|
+
_squadronconfig.nb_aircrafts,
|
|
297
|
+
_squadronconfig.skill,
|
|
298
|
+
_squadronconfig.modex or nil,
|
|
299
|
+
_squadronconfig.livery or nil,
|
|
300
|
+
_squadronconfig.radio.frequency or 251.000,
|
|
301
|
+
_squadronconfig.radio.modulation or radio.modulation.AM
|
|
204
302
|
)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
303
|
+
objCapWarZone:AddPatrolPointAwacs(
|
|
304
|
+
airbaseconfig.name,
|
|
305
|
+
objCapWarZone.jtff_borderZone:GetRandomCoordinate(),
|
|
306
|
+
28000,
|
|
307
|
+
320,
|
|
308
|
+
math.random(0, 359),
|
|
309
|
+
20
|
|
212
310
|
)
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
311
|
+
elseif _squadronconfig.role == 'tanker' then
|
|
312
|
+
objCapWarZone:AddTankerSquadron(
|
|
313
|
+
_squadronconfig.template,
|
|
314
|
+
_squadronconfig.name,
|
|
315
|
+
airbaseconfig.name,
|
|
316
|
+
_squadronconfig.nb_aircrafts,
|
|
317
|
+
_squadronconfig.skill,
|
|
318
|
+
_squadronconfig.modex or nil,
|
|
319
|
+
_squadronconfig.livery or nil,
|
|
320
|
+
_squadronconfig.radio.frequency or 251.000,
|
|
321
|
+
_squadronconfig.radio.modulation or radio.modulation.AM,
|
|
322
|
+
_squadronconfig.tacan.channel or nil
|
|
216
323
|
)
|
|
217
|
-
objCapWarZone
|
|
218
|
-
|
|
219
|
-
|
|
324
|
+
objCapWarZone:AddPatrolPointTanker(
|
|
325
|
+
airbaseconfig.name,
|
|
326
|
+
objCapWarZone.jtff_borderZone:GetRandomCoordinate(),
|
|
327
|
+
25000,
|
|
328
|
+
320,
|
|
329
|
+
math.random(0, 359),
|
|
330
|
+
20
|
|
220
331
|
)
|
|
221
332
|
end
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
333
|
+
end
|
|
334
|
+
if airbaseconfig.nbMaxPatrols > 0 then
|
|
335
|
+
for _i = 1,math.max(1,math.random(airbaseconfig.nbMinPatrols, airbaseconfig.nbMaxPatrols)), 1 do
|
|
336
|
+
objCapWarZone:AddPatrolPointCAP(
|
|
337
|
+
airbaseconfig.name,
|
|
338
|
+
ZONE_POLYGON:FindByName(airbaseconfig.patrolZoneName):GetRandomCoordinate() or ZONE:FindByName(airbaseconfig.patrolZoneName):GetRandomCoordinate(),
|
|
339
|
+
math.random(
|
|
340
|
+
capwarzoneconfig.capParameters.patrolFloor,
|
|
341
|
+
capwarzoneconfig.capParameters.patrolCeiling
|
|
342
|
+
),
|
|
343
|
+
math.random(
|
|
344
|
+
capwarzoneconfig.capParameters.minPatrolSpeed,
|
|
345
|
+
capwarzoneconfig.capParameters.maxPatrolSpeed
|
|
346
|
+
),
|
|
347
|
+
math.random(0, 359),
|
|
348
|
+
20
|
|
349
|
+
)
|
|
225
350
|
end
|
|
226
|
-
objCapWarZone.objDispatcher:SetSquadronGci(
|
|
227
|
-
interceptSquadronName,
|
|
228
|
-
UTILS.KnotsToKmph(objCapWarZone.customconfig.capParameters.minEngageSpeed) or UTILS.KnotsToKmph(200),
|
|
229
|
-
UTILS.KnotsToKmph(objCapWarZone.customconfig.capParameters.maxEngageSpeed) or UTILS.KnotsToKmph(5000)
|
|
230
|
-
)
|
|
231
351
|
end
|
|
232
352
|
end
|
|
233
353
|
end
|
|
234
|
-
objCapWarZone.objDispatcher:SetTacticalDisplay(objCapWarZone.customconfig.debug or false)
|
|
235
354
|
objCapWarZone.objMenu:RemoveSubMenus()
|
|
236
355
|
MENU_MISSION_COMMAND:New(
|
|
237
|
-
"Stop "..
|
|
356
|
+
"Stop ".. capwarzoneconfig.name .. " CAP War Zone",
|
|
238
357
|
objCapWarZone.objMenu,
|
|
239
|
-
|
|
358
|
+
WipeCapWarZone,
|
|
240
359
|
objCapWarZone
|
|
241
360
|
)
|
|
242
361
|
MENU_MISSION_COMMAND:New(
|
|
243
|
-
"Toggle Display Status "..
|
|
362
|
+
"Toggle Display Status ".. capwarzoneconfig.name .. " CAP War Zone",
|
|
244
363
|
objCapWarZone.objMenu,
|
|
245
364
|
toggleDebugCapWarZone,
|
|
246
365
|
objCapWarZone
|
|
247
366
|
)
|
|
248
367
|
end
|
|
249
368
|
|
|
369
|
+
-- endregion CAPZoneWarFunctions
|
|
370
|
+
|
|
250
371
|
CAPWarZoneArray = {}
|
|
251
|
-
compteur =
|
|
252
|
-
|
|
253
|
-
|
|
372
|
+
local compteur = #CAPWarZoneArray
|
|
373
|
+
|
|
374
|
+
MenuMissionCAPWarZone = MENU_MISSION:New("CAP War Zones", nil)
|
|
375
|
+
|
|
376
|
+
for _index, currentCAPWarZoneConfigObject in ipairs(CAPWarZoneConfig) do
|
|
377
|
+
local capwarzoneconfig = ParseCAPWarZoneConfigJson(currentCAPWarZoneConfigObject)
|
|
254
378
|
if capwarzoneconfig.enable == true and #(capwarzoneconfig.ewrPrefixes) > 0 then
|
|
255
379
|
compteur = compteur + 1
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
380
|
+
-- region CAPZoneWarSetUp
|
|
381
|
+
Jtff_log.info(
|
|
382
|
+
string.format(
|
|
383
|
+
"%s Zone creation...",
|
|
384
|
+
capwarzoneconfig.name
|
|
385
|
+
),
|
|
386
|
+
"CAP_WAR_ZONE"
|
|
387
|
+
)
|
|
388
|
+
local objCapWarZone = {
|
|
389
|
+
customconfig = capwarzoneconfig,
|
|
390
|
+
jtff_patrolZones = {},
|
|
391
|
+
jtff_borderZone = {},
|
|
392
|
+
objMenu = {},
|
|
393
|
+
}
|
|
394
|
+
if type(GROUP:FindByName( capwarzoneconfig.borderZoneName )) ~= 'nil' then
|
|
395
|
+
if type(ZONE_POLYGON:FindByName(capwarzoneconfig.borderZoneName)) ~= 'nil' then
|
|
396
|
+
objCapWarZone.jtff_borderZone = ZONE_POLYGON:FindByName(capwarzoneconfig.borderZoneName)
|
|
263
397
|
else
|
|
264
|
-
objCapWarZone.
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
398
|
+
objCapWarZone.jtff_borderZone = ZONE_POLYGON:New(
|
|
399
|
+
capwarzoneconfig.borderZoneName,
|
|
400
|
+
GROUP:FindByName( capwarzoneconfig.borderZoneName )
|
|
401
|
+
):DrawZone(
|
|
402
|
+
-1, -- All coalitions
|
|
403
|
+
{1,0,0},
|
|
404
|
+
1,
|
|
405
|
+
{1,0,0},
|
|
406
|
+
0.10,
|
|
407
|
+
3,
|
|
408
|
+
true,
|
|
409
|
+
nil
|
|
268
410
|
)
|
|
269
411
|
end
|
|
412
|
+
elseif type(ZONE:New(capwarzoneconfig.borderZoneName)) ~= 'nil' then
|
|
413
|
+
objCapWarZone.jtff_borderZone = ZONE:FindByName(capwarzoneconfig.borderZoneName):DrawZone(
|
|
414
|
+
-1, -- All coalitions
|
|
415
|
+
{1,0,0},
|
|
416
|
+
1,
|
|
417
|
+
{1,0,0},
|
|
418
|
+
0.10,
|
|
419
|
+
3,
|
|
420
|
+
true,
|
|
421
|
+
nil
|
|
422
|
+
)
|
|
423
|
+
else
|
|
424
|
+
objCapWarZone.jtff_borderZone = nil
|
|
270
425
|
end
|
|
271
|
-
objCapWarZone.
|
|
272
|
-
objCapWarZone.objMenu = MENU_MISSION:New(capwarzoneconfig.name, MenuCoalitionCAPWarZone)
|
|
426
|
+
objCapWarZone.objMenu = MENU_MISSION:New(capwarzoneconfig.name, MenuMissionCAPWarZone)
|
|
273
427
|
objCapWarZone.objMenu:RemoveSubMenus()
|
|
428
|
+
objCapWarZone.customconfig = capwarzoneconfig
|
|
274
429
|
CAPWarZoneArray[compteur] = objCapWarZone
|
|
275
430
|
MENU_MISSION_COMMAND:New(
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
431
|
+
string.format("Start %s CAP War Zone", capwarzoneconfig.name),
|
|
432
|
+
CAPWarZoneArray[compteur].objMenu,
|
|
433
|
+
StartCapWarZone,
|
|
434
|
+
CAPWarZoneArray[compteur]
|
|
435
|
+
)
|
|
436
|
+
-- endregion CAPZoneWarSetUp
|
|
280
437
|
end
|
|
281
438
|
end
|