@jtff/miztemplate-lib 2.2.0 → 3.0.0-rc1

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.
Files changed (65) hide show
  1. package/index.js +4 -3
  2. package/lib/jtff-lib-ci.js +1 -307
  3. package/lib/mizlib.js +336 -0
  4. package/lua/lib/Hercules_Cargo.lua +686 -0
  5. package/lua/lib/Moose_.lua +117314 -0
  6. package/lua/lib/Splash_Damage_2_0.lua +472 -0
  7. package/lua/lib/gemman.lua +1 -0
  8. package/lua/lib/mist_4_5_107.lua +9084 -0
  9. package/lua/lib/skynet-iads-compiled.lua +3864 -0
  10. package/lua/settings/settings-RAT.lua +235 -0
  11. package/lua/settings/settings-airboss.lua +142 -0
  12. package/lua/settings/settings-atis.lua +31 -0
  13. package/lua/settings/settings-awacs.lua +58 -0
  14. package/lua/settings/settings-awacsondemand.lua +26 -0
  15. package/lua/settings/settings-beacons.lua +10 -0
  16. package/lua/settings/settings-capwarzone.lua +164 -0
  17. package/lua/settings/settings-capzone.lua +32 -0
  18. package/lua/settings/settings-fac_ranges.lua +17 -0
  19. package/lua/settings/settings-foxzone.lua +14 -0
  20. package/lua/settings/settings-gemman.lua +6 -0
  21. package/lua/settings/settings-global.lua +31 -0
  22. package/lua/settings/settings-intercept.lua +23 -0
  23. package/lua/settings/settings-logistics.lua +22 -0
  24. package/lua/settings/settings-ondemandawacs.lua +29 -0
  25. package/lua/settings/settings-ondemandtankers.lua +29 -0
  26. package/lua/settings/settings-pedros.lua +11 -0
  27. package/lua/settings/settings-ranges.lua +28 -0
  28. package/lua/settings/settings-reapers.lua +25 -0
  29. package/lua/settings/settings-sams.lua +19 -0
  30. package/lua/settings/settings-skynet.lua +239 -0
  31. package/lua/settings/settings-tankers.lua +32 -0
  32. package/lua/settings/settings-training_ranges.lua +37 -0
  33. package/lua/src/010-root_menus.lua +5 -0
  34. package/lua/src/020-mission_functions.lua +1059 -0
  35. package/lua/src/110-set_clients.lua +61 -0
  36. package/lua/src/120-tankers.lua +589 -0
  37. package/lua/src/130-airboss.lua +621 -0
  38. package/lua/src/135-pedro.lua +21 -0
  39. package/lua/src/140-beacons.lua +19 -0
  40. package/lua/src/150-awacs.lua +599 -0
  41. package/lua/src/160-atis.lua +53 -0
  42. package/lua/src/170-cap_zone_training.lua +127 -0
  43. package/lua/src/172-cap_zone_war.lua +190 -0
  44. package/lua/src/173-fox_zone_training.lua +87 -0
  45. package/lua/src/176-random_air_traffic.lua +73 -0
  46. package/lua/src/178-training-intercept.lua +263 -0
  47. package/lua/src/180-logistics.lua +80 -0
  48. package/lua/src/190-ranges.lua +54 -0
  49. package/lua/src/191-sams.lua +49 -0
  50. package/lua/src/193-training_ranges.lua +191 -0
  51. package/lua/src/195-reaper-ondemand.lua +522 -0
  52. package/lua/src/196-fac_ranges.lua +34 -0
  53. package/lua/src/199-skynet.lua +721 -0
  54. package/lua/src/200-mission.lua +3 -0
  55. package/package.json +4 -3
  56. package/resources/radios/.gitkeep +0 -0
  57. package/resources/sounds/CTLD/beacon.ogg +0 -0
  58. package/resources/sounds/CTLD/beaconsilent.ogg +0 -0
  59. package/resources/sounds/Misc/.gitkeep +0 -0
  60. package/resources/sounds/Misc/2_Bips.ogg +0 -0
  61. package/resources/sounds/Misc/Bip.ogg +0 -0
  62. package/resources/sounds/Misc/crash_wood.ogg +0 -0
  63. package/scripts/build.js +2 -1
  64. package/scripts/inject-scripts.js +127 -230
  65. package/scripts/template-update.js +1 -1
@@ -0,0 +1,599 @@
1
+ -- *****************************************************************************
2
+ -- ** Awacs **
3
+ -- *********************************************************
4
+ AwacsArray = {}
5
+ compteur = 0
6
+ MenuCoalitionAwacsBlue = MENU_COALITION:New(coalition.side.BLUE, "Awacs", MenuCoalitionBlue)
7
+ MenuCoalitionAwacsRed = MENU_COALITION:New(coalition.side.RED, "Awacs", MenuCoalitionRed)
8
+ for index, awacsconfig in ipairs(AwacsConfig) do
9
+ if awacsconfig.enable == true then
10
+ compteur = compteur + 1
11
+ env.info('creation AWACS : '.. awacsconfig.groupName..'...')
12
+ local objAwacs = RECOVERYTANKER:New(UNIT:FindByName(awacsconfig.patternUnit), awacsconfig.groupName)
13
+ :SetAWACS(true, true)
14
+ :SetRespawnOnOff(awacsconfig.autorespawn)
15
+ :SetLowFuelThreshold(awacsconfig.fuelwarninglevel)
16
+ :SetAltitude(awacsconfig.altitude)
17
+ :SetSpeed(awacsconfig.speed)
18
+ :SetHomeBase(AIRBASE:FindByName(awacsconfig.baseUnit),awacsconfig.terminalType)
19
+ :SetCallsign(awacsconfig.callsign.name, awacsconfig.callsign.number)
20
+ :SetRecoveryAirboss(awacsconfig.airboss_recovery)
21
+ :SetRadio(awacsconfig.freq)
22
+ :SetModex(awacsconfig.modex)
23
+ :SetRacetrackDistances(awacsconfig.racetrack.front, awacsconfig.racetrack.back)
24
+ if (awacsconfig.airspawn) then
25
+ objAwacs:SetTakeoffAir()
26
+ else
27
+ objAwacs:SetTakeoffCold()
28
+
29
+ end
30
+ if (awacsconfig.tacan) then
31
+ objAwacs:SetTACAN(awacsconfig.tacan.channel , awacsconfig.tacan.morse)
32
+ end
33
+ objAwacs.customconfig = awacsconfig
34
+ function objAwacs:OnAfterStart(from, event, to)
35
+ env.info('popup AWACS : '..self.tanker.GroupName)
36
+ if self.customconfig.escortgroupname then
37
+ self.escortSpawnObject = SPAWN:NewWithAlias(self.customconfig.escortgroupname,'escort-'.. self.customconfig.groupName)
38
+ :InitRepeatOnEngineShutDown()
39
+ :InitSkill("Excellent")
40
+ :OnSpawnGroup(function(SpawnGroup)
41
+ taskTankerEscort({self, SpawnGroup})
42
+ end)
43
+ self.escortGroupObject = spawnRecoveryTankerEscort(self.escortSpawnObject,self.customconfig)
44
+ if self.customconfig.missionmaxduration then
45
+ self.escortGroupObject:ScheduleOnce(self.customconfig.missionmaxduration*60,
46
+ function(SpawnGroup, airBaseName)
47
+ --trigger.action.outText('RTB schedule trigger Tanker-escort group : '..(SpawnGroup.GroupName)..' airbase'..(airBaseName)..'...', 45)
48
+ SpawnGroup:RouteRTB(AIRBASE:FindByName(airBaseName))
49
+ end,
50
+ self.escortGroupObject,
51
+ self.customconfig.baseUnit
52
+ )
53
+ --trigger.action.outText('Tanker-escort configured to RTB in : '..(self.customconfig.missionmaxduration)..' minutes max...', 45)
54
+ end
55
+ end
56
+ if self.customconfig.missionmaxduration then
57
+ (self.tanker):ScheduleOnce(self.customconfig.missionmaxduration*60,
58
+ function(tankerObject, airBaseName)
59
+ --trigger.action.outText('RTB schedule trigger AWACS group : '..(tankerObject.tanker.GroupName)..' airbase'..(tankerObject.customconfig.baseUnit)..'...', 45)
60
+ tankerObject:RTB(AIRBASE:FindByName(tankerObject.customconfig.baseUnit))
61
+ end,
62
+ self
63
+ )
64
+ --trigger.action.outText('AWACS configured to RTB in : '..(self.customconfig.missionmaxduration)..' minutes max...', 45)
65
+ end
66
+ if (self.customconfig.benefit_coalition == coalition.side.RED) then
67
+ self.menureset = MENU_COALITION_COMMAND:New(
68
+ coalition.side.RED,
69
+ "Reset AWACS "..self.customconfig.callsign.alias..'-'..self.customconfig.callsign.number..'-1',
70
+ MenuCoalitionAwacsRed,
71
+ resetRecoveryTanker,
72
+ self
73
+ )
74
+ else
75
+ self.menureset = MENU_COALITION_COMMAND:New(
76
+ coalition.side.BLUE,
77
+ "Reset AWACS "..self.customconfig.callsign.alias..'-'..self.customconfig.callsign.number..'-1',
78
+ MenuCoalitionAwacsBlue,
79
+ resetRecoveryTanker,
80
+ self
81
+ )
82
+ end
83
+ end
84
+ function objAwacs:OnAfterRTB(from, event, to, airbase)
85
+ if self.customconfig.escortgroupname then
86
+ env.info('Tanker RTB: '..self.tanker.GroupName..'...')
87
+ if self.escortGroupObject:IsAirborne(false) == true then
88
+ env.info('escort RTB : '.. self.escortGroupObject.GroupName..' Tanker : '..self.tanker.GroupName..'...')
89
+ self.escortGroupObject:RouteRTB(airbase)
90
+ else
91
+ --self.escortGroupObject:Destroy(nil, 5)
92
+ end
93
+ end
94
+ end
95
+ function objAwacs:OnEventKill(event)
96
+ if self.customconfig.escortgroupname then
97
+ env.info(event.target' Killed !! Sending escort Home')
98
+ self.escortGroupObject:RouteRTB(AIRBASE:FindByName(self.customconfig.baseUnit))
99
+ end
100
+ end
101
+ function objAwacs:OnAfterStatus(from, event, to)
102
+ if ((self.customconfig.escortgroupname) and (self.escortGroupObject)) then
103
+ if not(GROUP:FindByName(self.escortGroupObject.GroupName)) then
104
+ env.info('Respawning escort Group '..self.escortGroupObject.GroupName)
105
+ self.escortGroupObject = self.escortSpawnObject
106
+ :SpawnAtAirbase(AIRBASE:FindByName(self.customconfig.baseUnit),SPAWN.Takeoff.Cold, self.customconfig.altitude)
107
+ end
108
+ end
109
+ end
110
+ AwacsArray[compteur] = objAwacs
111
+ AwacsArray[compteur]:Start()
112
+ end
113
+ end
114
+
115
+ if compteur == 0 and #OnDemandAwacsConfig ==0 then
116
+ MenuCoalitionAwacsBlue:Remove()
117
+ MenuCoalitionAwacsRed:Remove()
118
+ end
119
+
120
+ -- *****************************************************************************
121
+ -- ** OnDemand Awacs **
122
+ -- *********************************************************
123
+ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnchorCoord, askedOrbitHeading, askedOrbitLeg)
124
+ local AwacsGroup = nil
125
+ if (OnDemandAwacsConfig) then
126
+ for index, OnDemandAwacs in ipairs(OnDemandAwacsConfig) do
127
+ if ((OnDemandAwacs.type == type) and (OnDemandAwacs.enable)) then
128
+ debug_msg(string.format('OnDemandAwacs : Found type %s Awacs : %s Group!', type, OnDemandAwacs.groupName))
129
+ if (askedSpeed and askedSpeed > 0) then
130
+ OnDemandAwacs.speed = askedSpeed
131
+ end
132
+ if (askedFL and askedFL > 0) then
133
+ OnDemandAwacs.altitude = askedFL * 100
134
+ end
135
+ if ( askedDuration == nil or askedDuration == 0 ) then
136
+ askedDuration = 480
137
+ end
138
+ if (askedOrbitHeading) then
139
+ if (askedOrbitLeg and askedOrbitLeg > 10) then
140
+ --heading et Leg demandés
141
+ OnDemandAwacs.orbit = {
142
+ heading = askedOrbitHeading % 360,
143
+ length = askedOrbitLeg,
144
+ }
145
+ else
146
+ --heading demandé et leg non demandé
147
+ if (OnDemandAwacs.orbit ) then
148
+ if (not(OnDemandAwacs.orbit.length)) then
149
+ OnDemandAwacs.orbit = {
150
+ heading = askedOrbitHeading % 360,
151
+ length = 30,
152
+ }
153
+ else
154
+ OnDemandAwacs.orbit = {
155
+ heading = askedOrbitHeading % 360,
156
+ length = math.max(5, OnDemandAwacs.orbit.length),
157
+ }
158
+ end
159
+ else
160
+ OnDemandAwacs.orbit = {
161
+ heading = askedOrbitHeading % 360,
162
+ length = 30,
163
+ }
164
+ end
165
+ end
166
+ else
167
+ --pas de heading demandé
168
+ if (OnDemandAwacs.orbit ) then
169
+ if (not(OnDemandAwacs.orbit.heading)) then
170
+ OnDemandAwacs.orbit.heading = 90
171
+ end
172
+ if (not(OnDemandAwacs.orbit.length)) then
173
+ OnDemandAwacs.orbit.length = 30
174
+ else
175
+ OnDemandAwacs.orbit.length = math.max(5, OnDemandAwacs.orbit.length)
176
+ end
177
+ else
178
+ OnDemandAwacs.orbit = {
179
+ heading = 90,
180
+ length = 30,
181
+ }
182
+ end
183
+ end
184
+ local set_group_awacs = SET_GROUP:New()
185
+ :FilterActive()
186
+ :FilterPrefixes(OnDemandAwacs.groupName)
187
+ :FilterCategories("plane")
188
+ :FilterOnce()
189
+ local aliveAwacsGroupList = set_group_awacs:GetSetObjects()
190
+
191
+ local is_awacs_spawned = false
192
+ debug_msg(string.format('OnDemandAwacs : Looking for a Group corresponding to template %s', string.format("%s-%s", OnDemandAwacs.groupName, OnDemandAwacs.type)))
193
+ for index, current_group in ipairs(aliveAwacsGroupList) do
194
+ if (
195
+ (not(is_awacs_spawned)) and
196
+ (string.find(
197
+ current_group.GroupName,
198
+ string.format("%s-%s", OnDemandAwacs.groupName, OnDemandAwacs.type),
199
+ 1,
200
+ true
201
+ ) ~= nil)
202
+ ) then
203
+ debug_msg(string.format('OnDemandAwacs Found %s corresponding to template %s', current_group.GroupName, string.format("%s-%s", OnDemandAwacs.groupName, OnDemandAwacs.type)))
204
+ is_awacs_spawned = true
205
+ AwacsGroup = current_group
206
+ end
207
+ end
208
+
209
+ local RTBAirbase = nil
210
+ local AwacsRoute = {}
211
+ if (OnDemandAwacs.baseUnit) then
212
+ RTBAirbase = AIRBASE:FindByName(OnDemandAwacs.baseUnit)
213
+ else
214
+ RTBAirbase = askedAnchorCoord:GetClosestAirbase2(Airbase.Category.AIRDROME, OnDemandAwacs.benefit_coalition)
215
+ end
216
+ if (is_awacs_spawned) then
217
+ debug_msg(string.format('OnDemandAwacs already in air : rerouting %s', OnDemandAwacs.groupName))
218
+ AwacsGroup:ClearTasks()
219
+ table.insert(
220
+ AwacsRoute,
221
+ askedAnchorCoord
222
+ :SetAltitude(UTILS.FeetToMeters(OnDemandAwacs.altitude))
223
+ :WaypointAirTurningPoint(
224
+ nil,
225
+ UTILS.KnotsToKmph(OnDemandAwacs.speed),
226
+ {
227
+ {
228
+ id = 'AWACS',
229
+ params = {
230
+ }
231
+ },
232
+ {
233
+ id = 'ControlledTask',
234
+ params = {
235
+ task =
236
+ {
237
+ id = 'Orbit',
238
+ params = {
239
+ pattern = AI.Task.OrbitPattern.RACE_TRACK,
240
+ speed = UTILS.KnotsToMps(OnDemandAwacs.speed),
241
+ altitude = UTILS.FeetToMeters(OnDemandAwacs.altitude)
242
+ }
243
+ },
244
+ stopCondition = {
245
+ duration = askedDuration * 60
246
+ }
247
+ },
248
+ },
249
+ },
250
+ "Awacs Start"
251
+ )
252
+ )
253
+ table.insert(
254
+ AwacsRoute,
255
+ askedAnchorCoord
256
+ :Translate(UTILS.NMToMeters(OnDemandAwacs.orbit.length), OnDemandAwacs.orbit.heading, true, false)
257
+ :SetAltitude(UTILS.FeetToMeters(OnDemandAwacs.altitude))
258
+ :WaypointAirTurningPoint(
259
+ nil,
260
+ UTILS.KnotsToKmph(OnDemandAwacs.speed),
261
+ {
262
+ {
263
+ id = 'AWACS',
264
+ params = {
265
+ }
266
+ },
267
+ },
268
+ "Orbit End"
269
+ )
270
+ )
271
+ table.insert(
272
+ AwacsRoute,
273
+ RTBAirbase
274
+ :GetCoordinate()
275
+ :WaypointAirLanding(
276
+ UTILS.KnotsToKmph(OnDemandAwacs.speed),
277
+ RTBAirbase
278
+ )
279
+ )
280
+ else
281
+ debug_msg(string.format('OnDemandAwacs Spawning %s', OnDemandAwacs.groupName))
282
+ local SpawnAwacs = SPAWN:NewWithAlias(
283
+ OnDemandAwacs.groupName,
284
+ string.format("%s-%s", OnDemandAwacs.groupName, OnDemandAwacs.type)
285
+ )
286
+ if (OnDemandAwacs.freq) then
287
+ SpawnAwacs:InitRadioFrequency(OnDemandAwacs.freq)
288
+ SpawnAwacs:InitRadioModulation("AM")
289
+ end
290
+ if (OnDemandAwacs.modex) then
291
+ SpawnAwacs:InitModex(OnDemandAwacs.modex)
292
+ end
293
+ if (OnDemandAwacs.baseUnit) then
294
+ AwacsGroup = SpawnAwacs:SpawnAtAirbase(
295
+ AIRBASE:FindByName(OnDemandAwacs.baseUnit),
296
+ SPAWN.Takeoff.Hot,
297
+ nil,
298
+ OnDemandAwacs.terminalType
299
+ )
300
+ table.insert(AwacsRoute,
301
+ AIRBASE
302
+ :FindByName(OnDemandAwacs.baseUnit)
303
+ :GetCoordinate()
304
+ :WaypointAirTakeOffParkingHot()
305
+ )
306
+ else
307
+ AwacsGroup = SpawnAwacs:SpawnFromCoordinate(
308
+ askedAnchorCoord
309
+ :GetRandomCoordinateInRadius(
310
+ UTILS.NMToMeters(30),
311
+ UTILS.NMToMeters(20)
312
+ )
313
+ :SetAltitude(
314
+ UTILS.FeetToMeters(OnDemandAwacs.altitude)
315
+ )
316
+ )
317
+ end
318
+ AwacsGroup.customconfig = OnDemandAwacs
319
+ AwacsGroup.spawnAbsTime = timer.getAbsTime()
320
+ AwacsGroup.missionmaxduration = askedDuration
321
+ table.insert(AwacsRoute,
322
+ askedAnchorCoord
323
+ :SetAltitude(UTILS.FeetToMeters(OnDemandAwacs.altitude))
324
+ :WaypointAirTurningPoint(
325
+ nil,
326
+ UTILS.KnotsToKmph(OnDemandAwacs.speed),
327
+ {
328
+ {
329
+ id = 'AWACS',
330
+ params = {
331
+ }
332
+ },
333
+ {
334
+ id = 'ControlledTask',
335
+ params = {
336
+ task =
337
+ {
338
+ id = 'Orbit',
339
+ params = {
340
+ pattern = AI.Task.OrbitPattern.RACE_TRACK,
341
+ speed = UTILS.KnotsToMps(OnDemandAwacs.speed),
342
+ altitude = UTILS.FeetToMeters(OnDemandAwacs.altitude)
343
+ }
344
+ },
345
+ stopCondition = {
346
+ duration = askedDuration * 60
347
+ }
348
+ },
349
+ },
350
+ },
351
+ "Awacs Start"
352
+ )
353
+ )
354
+ table.insert(AwacsRoute,
355
+ askedAnchorCoord
356
+ :Translate(UTILS.NMToMeters(OnDemandAwacs.orbit.length), OnDemandAwacs.orbit.heading, true, false)
357
+ :SetAltitude(UTILS.FeetToMeters(OnDemandAwacs.altitude))
358
+ :WaypointAirTurningPoint(
359
+ nil,
360
+ UTILS.KnotsToKmph(OnDemandAwacs.speed),
361
+ {
362
+ {
363
+ id = 'AWACS',
364
+ params = {
365
+ }
366
+ }
367
+ },
368
+ "Orbit End"
369
+ )
370
+ )
371
+ table.insert(AwacsRoute,
372
+ RTBAirbase
373
+ :GetCoordinate()
374
+ :WaypointAirLanding(
375
+ UTILS.KnotsToKmph(OnDemandAwacs.speed),
376
+ RTBAirbase,
377
+ {},
378
+ 'RTB'
379
+ )
380
+ )
381
+ end
382
+ AwacsGroup:Route(AwacsRoute)
383
+ AwacsGroup:CommandEPLRS(true, 4)
384
+ if (OnDemandAwacs.tacan) then
385
+ AwacsGroup.beacon=BEACON:New(AwacsGroup:GetUnit(1))
386
+ AwacsGroup.beacon:ActivateTACAN(OnDemandAwacs.tacan.channel, "Y", OnDemandAwacs.tacan.morse, true)
387
+ end
388
+ if (OnDemandAwacs.callsign) then
389
+ AwacsGroup:CommandSetCallsign(OnDemandAwacs.callsign.name, OnDemandAwacs.callsign.number, 2)
390
+ end
391
+ if OnDemandAwacs.escortgroupname then
392
+ AwacsGroup.escortSpawnObject = SPAWN:NewWithAlias(OnDemandAwacs.escortgroupname,'escort-'.. OnDemandAwacs.groupName)
393
+ :InitRepeatOnEngineShutDown()
394
+ :InitSkill("Excellent")
395
+ :OnSpawnGroup(function(SpawnGroup)
396
+ taskGroupEscort({AwacsGroup, SpawnGroup})
397
+ end)
398
+ AwacsGroup.escortGroupObject = spawnRecoveryTankerEscort(AwacsGroup.escortSpawnObject,OnDemandAwacs)
399
+ if OnDemandAwacs.missionmaxduration then
400
+ AwacsGroup.escortGroupObject:ScheduleOnce(OnDemandAwacs.missionmaxduration*60,
401
+ function(SpawnGroup, airBaseName)
402
+ --trigger.action.outText('RTB schedule trigger Tanker-escort group : '..(SpawnGroup.GroupName)..' airbase'..(airBaseName)..'...', 45)
403
+ SpawnGroup:RouteRTB(AIRBASE:FindByName(airBaseName))
404
+ end,
405
+ AwacsGroup.escortGroupObject,
406
+ OnDemandAwacs.baseUnit
407
+ )
408
+ --trigger.action.outText('Tanker-escort configured to RTB in : '..(OnDemandAwacs.missionmaxduration)..' minutes max...', 45)
409
+ end
410
+ end
411
+ if (map_marker[AwacsGroup:GetName()]) then
412
+ COORDINATE:RemoveMark(map_marker[AwacsGroup:GetName()])
413
+ end
414
+ if (OnDemandAwacs.tacan) then
415
+ map_marker[AwacsGroup:GetName()] = askedAnchorCoord:MarkToCoalition(
416
+ string.format(
417
+ 'OnDemand Awacs %s - TCN %i\nFL %i at %i knots\nFreq %.2f MHz\nOn station for %i minutes\nRacetrack : %i ° for %i nm',
418
+ OnDemandAwacs.type,
419
+ OnDemandAwacs.tacan.channel,
420
+ UTILS.Round(OnDemandAwacs.altitude / 100 , 0),
421
+ OnDemandAwacs.speed,
422
+ OnDemandAwacs.freq,
423
+ askedDuration,
424
+ OnDemandAwacs.orbit.heading,
425
+ OnDemandAwacs.orbit.length
426
+ ),
427
+ OnDemandAwacs.benefit_coalition,
428
+ true,
429
+ 'OnDemand Awacs %s is Activated'
430
+ )
431
+ else
432
+ map_marker[AwacsGroup:GetName()] = askedAnchorCoord:MarkToCoalition(
433
+ string.format(
434
+ 'OnDemand Awacs %s\nFL %i at %i knots\nFreq %.2f MHz\nOn station for %i minutes\nRacetrack : %i ° for %i nm',
435
+ OnDemandAwacs.type,
436
+ UTILS.Round(OnDemandAwacs.altitude / 100 , 0),
437
+ OnDemandAwacs.speed,
438
+ OnDemandAwacs.freq,
439
+ askedDuration,
440
+ OnDemandAwacs.orbit.heading,
441
+ OnDemandAwacs.orbit.length
442
+ ),
443
+ OnDemandAwacs.benefit_coalition,
444
+ true,
445
+ 'OnDemand Awacs %s is Activated'
446
+ )
447
+ end
448
+ AwacsGroup:HandleEvent(EVENTS.Land)
449
+ AwacsGroup:HandleEvent(EVENTS.Crash)
450
+ AwacsGroup:HandleEvent(EVENTS.Dead)
451
+ function AwacsGroup:OnEventLand(EventData)
452
+ COORDINATE:RemoveMark(map_marker[self:GetName()])
453
+ if self.custommconfig.escortgroupname then
454
+ env.info('AWACS RTB: '..self.GroupName..'...')
455
+ if self.escortGroupObject:IsAirborne(false) == true then
456
+ env.info('escort RTB : '.. self.escortGroupObject.GroupName..' AWACS : '..self.GroupName..'...')
457
+ self.escortGroupObject:RouteRTB()
458
+ else
459
+ --self.escortGroupObject:Destroy(nil, 5)
460
+ end
461
+ end
462
+ end
463
+ function AwacsGroup:OnEventCrash(EventData)
464
+ COORDINATE:RemoveMark(map_marker[self:GetName()])
465
+ if self.custommconfig.escortgroupname then
466
+ env.info('AWACS RTB: '..self.GroupName..'...')
467
+ if self.escortGroupObject:IsAirborne(false) == true then
468
+ env.info('escort RTB : '.. self.escortGroupObject.GroupName..' AWACS : '..self.GroupName..'...')
469
+ self.escortGroupObject:RouteRTB()
470
+ else
471
+ --self.escortGroupObject:Destroy(nil, 5)
472
+ end
473
+ end
474
+ end
475
+ function AwacsGroup:OnEventDead(EventData)
476
+ COORDINATE:RemoveMark(map_marker[self:GetName()])
477
+ if self.custommconfig.escortgroupname then
478
+ env.info('AWACS RTB: '..self.GroupName..'...')
479
+ if self.escortGroupObject:IsAirborne(false) == true then
480
+ env.info('escort RTB : '.. self.escortGroupObject.GroupName..' AWACS : '..self.GroupName..'...')
481
+ self.escortGroupObject:RouteRTB()
482
+ else
483
+ --self.escortGroupObject:Destroy(nil, 5)
484
+ end
485
+ end
486
+ end
487
+ end
488
+ end
489
+ end
490
+ return AwacsGroup;
491
+ end
492
+
493
+ --local RestrToCoal = nil
494
+ awacsOnDemandArray = {}
495
+ local AwacsMarkHandler = {}
496
+
497
+
498
+ function AwacsMarkHandler:onEvent(event)
499
+ local awacsCmdSymbol = "-"
500
+
501
+ if event.id == 25 then
502
+ --trigger.action.outText(" ", 0, true)
503
+ elseif (event.id == 27 and string.find(event.text, awacsCmdSymbol)) then
504
+ --if (event.coalition == RestrToCoal or RestrToCoal == nil) then
505
+ local full = nil
506
+ local remString = nil
507
+ local cmd = nil
508
+ local param1 = nil
509
+ local param1Start = nil
510
+ local param2 = nil
511
+ local param2Start = nil
512
+ local param3 = nil
513
+ local param3Start = nil
514
+ local param4 = nil
515
+ local param4Start = nil
516
+ local param5 = nil
517
+ local param5Start = nil
518
+ local param6 = nil
519
+ local param6Start = nil
520
+ local mcoord = COORDINATE:New(event.pos.x, event.pos.y, event.pos.z)
521
+ local mvec3 = event.pos
522
+
523
+ full = string.sub(event.text, 2)
524
+
525
+ if (string.find(full, awacsCmdSymbol)) then
526
+ param1Start = string.find(full, awacsCmdSymbol)
527
+ cmd = string.sub(full, 0, param1Start-1)
528
+ remString = string.sub(full, param1Start+1)
529
+ if (string.find(remString, awacsCmdSymbol)) then
530
+ param2Start = string.find(remString, awacsCmdSymbol)
531
+ param1 = string.sub(remString, 0, param2Start-1)
532
+ remString = string.sub(remString, param2Start+1)
533
+ if string.find(remString, awacsCmdSymbol) then
534
+ param3Start = string.find(remString, awacsCmdSymbol)
535
+ param2 = string.sub(remString, 0, param3Start-1)
536
+ remString = string.sub(remString, param3Start+1)
537
+ if string.find(remString, awacsCmdSymbol) then
538
+ param4Start = string.find(remString, awacsCmdSymbol)
539
+ param3 = string.sub(remString, 0, param4Start-1)
540
+ remString = string.sub(remString, param4Start+1)
541
+
542
+ if string.find(remString, awacsCmdSymbol) then
543
+ param5Start = string.find(remString, awacsCmdSymbol)
544
+ param4 = string.sub(remString, 0, param5Start-1)
545
+ remString = string.sub(remString, param5Start+1)
546
+
547
+ if string.find(remString, awacsCmdSymbol) then
548
+ param6Start = string.find(remString, awacsCmdSymbol)
549
+ param5 = string.sub(remString, 0, param6Start-1)
550
+ param6 = string.sub(remString, param6Start+1)
551
+ else
552
+ param5 = remString
553
+ end
554
+ else
555
+ param4 = remString
556
+ end
557
+ else
558
+ param3 = remString
559
+ end
560
+ else
561
+ param2 = remString
562
+ end
563
+ else
564
+ param1 = remString
565
+ end
566
+ else
567
+ cmd = full
568
+ end
569
+ if DEBUG_MSG == true then
570
+ trigger.action.outText("Full Text = " .. full, 10)
571
+ trigger.action.outText("Command = " .. cmd, 10)
572
+ if param1 ~= nil then trigger.action.outText("type = " .. param1, 10) end
573
+ if param2 ~= nil then trigger.action.outText("Duration = " .. param2, 10) end
574
+ if param3 ~= nil then trigger.action.outText("FlightLevel = " .. param3, 10) end
575
+ if param4 ~= nil then trigger.action.outText("Speed = " .. param4, 10) end
576
+ if param5 ~= nil then trigger.action.outText("OrbitHeading = " .. param5, 10) end
577
+ if param6 ~= nil then trigger.action.outText("OrbitLeg = " .. param6, 10) end
578
+ end
579
+
580
+ if string.find(cmd, "awacs") then
581
+ if DEBUG_MSG == true then
582
+ trigger.action.outText("DEBUG: On Demand Awacs Started!", 10)
583
+ end
584
+ awacsOnDemandArray[#awacsOnDemandArray+1] = triggerOnDemandAwacs(
585
+ param1,
586
+ tonumber(param2),
587
+ tonumber(param3),
588
+ tonumber(param4),
589
+ mcoord,
590
+ tonumber(param5),
591
+ tonumber(param6)
592
+ )
593
+ end
594
+ --end
595
+ end
596
+
597
+ end
598
+
599
+ world.addEventHandler(AwacsMarkHandler)
@@ -0,0 +1,53 @@
1
+ -- *****************************************************************************
2
+ -- ** ATIS **
3
+ -- *********************************************************
4
+ ATISArray = {}
5
+ compteur = 0
6
+ for index, atisconfig in ipairs(AtisConfig) do
7
+ if atisconfig.enable == true then
8
+ compteur = compteur + 1
9
+ env.info('creation ATIS : '.. atisconfig.airfield..'...')
10
+ local objAtis = ATIS:New(atisconfig.airfield, atisconfig.radio.freq, atisconfig.radio.modulation)
11
+ :SetImperialUnits()
12
+ :SetSoundfilesPath(soundFilesPrefix .. 'ATIS/ATIS Soundfiles/')
13
+ :SetSubtitleDuration(0)
14
+ :SetMapMarks(true)
15
+ if (atisconfig.radio.relayunit) then
16
+ objAtis:SetRadioRelayUnitName(atisconfig.radio.relayunit)
17
+ else
18
+ if (atisconfig.radio.power) then
19
+ objAtis:SetRadioPower(atisconfig.radio.power)
20
+ end
21
+ end
22
+ if (atisconfig.radio.tower) then
23
+ objAtis:SetTowerFrequencies(atisconfig.radio.tower);
24
+ end
25
+ if (atisconfig.active.side) then
26
+ if (atisconfig.active.number) then
27
+ objAtis:SetActiveRunway(atisconfig.active.number..atisconfig.active.side)
28
+ else
29
+ objAtis:SetActiveRunway(atisconfig.active.side)
30
+ end
31
+ else
32
+ if (atisconfig.active.number) then
33
+ objAtis:SetActiveRunway(atisconfig.active.number)
34
+ end
35
+ end
36
+ if (atisconfig.tacan) then
37
+ objAtis:SetTACAN(atisconfig.tacan.channel)
38
+ end
39
+ if (atisconfig.ils) then
40
+ if (atisconfig.ils.runway) then
41
+ objAtis:AddILS(atisconfig.ils.freq, atisconfig.ils.runway)
42
+ else
43
+ objAtis:AddILS(atisconfig.ils.freq)
44
+ end
45
+ end
46
+ if (atisconfig.srs) then
47
+ objAtis:SetSRS(atisconfig.srs.path, "male", "en-US")
48
+ end
49
+ objAtis.customconfig = atisconfig
50
+ ATISArray[compteur] = objAtis
51
+ ATISArray[compteur]:Start()
52
+ end
53
+ end