@jtff/miztemplate-lib 2.1.7 → 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 +3 -1
  2. package/lib/jtff-lib-ci.js +2 -304
  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 +7 -6
  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,522 @@
1
+ -- *****************************************************************************
2
+ -- ** OnDemand AFACs **
3
+ -- *********************************************************
4
+ function triggerOnDemandReaper(type, askedLaserCode, askedDuration, askedFL, askedSpeed, askedAnchorCoord)
5
+ local ReaperGroup = nil
6
+ if (OnDemandReapersConfig) then
7
+ for index, OnDemandReaper in ipairs(OnDemandReapersConfig) do
8
+ if ((OnDemandReaper.type == type) and (OnDemandReaper.enable)) then
9
+ debug_msg(string.format('OnDemandUAV : Found type %s UAV : %s Group!', type, OnDemandReaper.groupName))
10
+ if (askedSpeed and askedSpeed > 0) then
11
+ OnDemandReaper.speed = askedSpeed
12
+ end
13
+ if (askedFL and askedFL > 0) then
14
+ OnDemandReaper.altitude = askedFL * 100
15
+ end
16
+ if (askedLaserCode and askedLaserCode > 0) then
17
+ OnDemandReaper.laserCode = askedLaserCode
18
+ end
19
+ if ( askedDuration == nil or askedDuration == 0 ) then
20
+ askedDuration = 120
21
+ end
22
+ local set_group_reaper = SET_GROUP:New()
23
+ :FilterActive()
24
+ :FilterPrefixes(OnDemandReaper.groupName)
25
+ :FilterCategories("plane")
26
+ :FilterOnce()
27
+ local aliveReapersGroupList = set_group_reaper:GetSetObjects()
28
+
29
+ local is_reaper_spawned = false
30
+ debug_msg(string.format('OnDemandUAV : Looking for a Group corresponding to template %s', string.format("%s-%s", OnDemandReaper.groupName, OnDemandReaper.type)))
31
+ for index, current_group in ipairs(aliveReapersGroupList) do
32
+ if (
33
+ (not(is_reaper_spawned)) and
34
+ (string.find(
35
+ current_group.GroupName,
36
+ string.format("%s-%s", OnDemandReaper.groupName, OnDemandReaper.type),
37
+ 1,
38
+ true
39
+ ) ~= nil)
40
+ ) then
41
+ debug_msg(string.format('OnDemandUAV Found %s corresponding to template %s', current_group.GroupName, string.format("%s-%s", OnDemandReaper.groupName, OnDemandReaper.type)))
42
+ is_reaper_spawned = true
43
+ ReaperGroup = current_group
44
+ end
45
+ end
46
+
47
+ local RTBAirbase = nil
48
+ local ReaperRoute = {}
49
+ if (OnDemandReaper.baseUnit) then
50
+ RTBAirbase = AIRBASE:FindByName(OnDemandReaper.baseUnit)
51
+ else
52
+ RTBAirbase = askedAnchorCoord:GetClosestAirbase2(Airbase.Category.AIRDROME, OnDemandReaper.benefit_coalition)
53
+ end
54
+ if (is_reaper_spawned) then
55
+ debug_msg(string.format('OnDemandUAV already in air : rerouting %s', OnDemandReaper.groupName))
56
+ ReaperGroup:ClearTasks()
57
+ table.insert(
58
+ ReaperRoute,
59
+ askedAnchorCoord
60
+ :SetAltitude(UTILS.FeetToMeters(OnDemandReaper.altitude))
61
+ :WaypointAirTurningPoint(
62
+ nil,
63
+ UTILS.KnotsToKmph(OnDemandReaper.speed),
64
+ {
65
+ --{
66
+ -- id = 'Tanker',
67
+ -- params = {
68
+ -- }
69
+ --},
70
+ {
71
+ id = 'ControlledTask',
72
+ params = {
73
+ task =
74
+ {
75
+ id = 'Orbit',
76
+ params = {
77
+ pattern = AI.Task.OrbitPattern.CIRCLE,
78
+ speed = UTILS.KnotsToMps(OnDemandReaper.speed),
79
+ altitude = UTILS.FeetToMeters(OnDemandReaper.altitude)
80
+ }
81
+ },
82
+ stopCondition = {
83
+ duration = askedDuration * 60
84
+ }
85
+ },
86
+ },
87
+ },
88
+ "Orbit Start"
89
+ )
90
+ )
91
+ table.insert(
92
+ ReaperRoute,
93
+ RTBAirbase
94
+ :GetCoordinate()
95
+ :WaypointAirLanding(
96
+ UTILS.KnotsToKmph(OnDemandReaper.speed),
97
+ RTBAirbase
98
+ )
99
+ )
100
+ else
101
+ debug_msg(string.format('OnDemandUAV Spawning %s', OnDemandReaper.groupName))
102
+ local SpawnReaper = SPAWN:NewWithAlias(
103
+ OnDemandReaper.groupName,
104
+ string.format("%s-%s", OnDemandReaper.groupName, OnDemandReaper.type)
105
+ )
106
+ if (OnDemandReaper.freq) then
107
+ SpawnReaper:InitRadioFrequency(OnDemandReaper.freq)
108
+ SpawnReaper:InitRadioModulation("AM")
109
+ end
110
+ if (OnDemandReaper.modex) then
111
+ SpawnReaper:InitModex(OnDemandReaper.modex)
112
+ end
113
+ if (OnDemandReaper.baseUnit) then
114
+ ReaperGroup = SpawnReaper:SpawnAtAirbase(
115
+ AIRBASE:FindByName(OnDemandReaper.baseUnit),
116
+ SPAWN.Takeoff.Hot,
117
+ nil,
118
+ OnDemandReaper.terminalType
119
+ )
120
+ table.insert(ReaperRoute,
121
+ AIRBASE
122
+ :FindByName(OnDemandReaper.baseUnit)
123
+ :GetCoordinate()
124
+ :WaypointAirTakeOffParkingHot()
125
+ )
126
+ else
127
+ ReaperGroup = SpawnReaper:SpawnFromCoordinate(
128
+ askedAnchorCoord
129
+ :GetRandomCoordinateInRadius(
130
+ UTILS.NMToMeters(5),
131
+ UTILS.NMToMeters(2)
132
+ )
133
+ :SetAltitude(
134
+ UTILS.FeetToMeters(OnDemandReaper.altitude)
135
+ )
136
+ )
137
+ end
138
+ ReaperGroup.customconfig = OnDemandReaper
139
+ ReaperGroup.spawnAbsTime = timer.getAbsTime()
140
+ ReaperGroup.missionmaxduration = askedDuration
141
+ table.insert(ReaperRoute,
142
+ askedAnchorCoord
143
+ :SetAltitude(UTILS.FeetToMeters(OnDemandReaper.altitude))
144
+ :WaypointAirTurningPoint(
145
+ nil,
146
+ UTILS.KnotsToKmph(OnDemandReaper.speed),
147
+ {
148
+ --{
149
+ -- id = 'Tanker',
150
+ -- params = {
151
+ -- }
152
+ --},
153
+ {
154
+ id = 'ControlledTask',
155
+ params = {
156
+ task =
157
+ {
158
+ id = 'Orbit',
159
+ params = {
160
+ pattern = AI.Task.OrbitPattern.CIRCLE,
161
+ speed = UTILS.KnotsToMps(OnDemandReaper.speed),
162
+ altitude = UTILS.FeetToMeters(OnDemandReaper.altitude)
163
+ }
164
+ },
165
+ stopCondition = {
166
+ duration = askedDuration * 60
167
+ }
168
+ },
169
+ },
170
+ },
171
+ "Orbit Start"
172
+ )
173
+ )
174
+ table.insert(ReaperRoute,
175
+ RTBAirbase
176
+ :GetCoordinate()
177
+ :WaypointAirLanding(
178
+ UTILS.KnotsToKmph(OnDemandReaper.speed),
179
+ RTBAirbase,
180
+ {},
181
+ 'RTB'
182
+ )
183
+ )
184
+ end
185
+ ReaperGroup:Route(ReaperRoute)
186
+ ReaperGroup:CommandEPLRS(true, 4)
187
+ if (OnDemandReaper.tacan) then
188
+ ReaperGroup.beacon=BEACON:New(ReaperGroup:GetUnit(1))
189
+ ReaperGroup.beacon:ActivateTACAN(OnDemandReaper.tacan.channel, "Y", OnDemandReaper.tacan.morse, true)
190
+ end
191
+ if (OnDemandReaper.callsign) then
192
+ ReaperGroup:CommandSetCallsign(OnDemandReaper.callsign.name, OnDemandReaper.callsign.number, 2)
193
+ end
194
+ if OnDemandReaper.escortgroupname then
195
+ ReaperGroup.escortSpawnObject = SPAWN:NewWithAlias(OnDemandReaper.escortgroupname,'escort-'.. OnDemandReaper.groupName)
196
+ :InitRepeatOnEngineShutDown()
197
+ :InitSkill("Excellent")
198
+ :OnSpawnGroup(function(SpawnGroup)
199
+ taskGroupEscort({ ReaperGroup, SpawnGroup})
200
+ end)
201
+ ReaperGroup.escortGroupObject = spawnRecoveryTankerEscort(ReaperGroup.escortSpawnObject, OnDemandReaper)
202
+ if OnDemandReaper.missionmaxduration then
203
+ ReaperGroup.escortGroupObject:ScheduleOnce(OnDemandReaper.missionmaxduration*60,
204
+ function(SpawnGroup, airBaseName)
205
+ --trigger.action.outText('RTB schedule trigger Reaper-escort group : '..(SpawnGroup.GroupName)..' airbase'..(airBaseName)..'...', 45)
206
+ SpawnGroup:RouteRTB(AIRBASE:FindByName(airBaseName))
207
+ end,
208
+ ReaperGroup.escortGroupObject,
209
+ OnDemandReaper.baseUnit
210
+ )
211
+ --trigger.action.outText('UAV-escort configured to RTB in : '..(OnDemandReaper.missionmaxduration)..' minutes max...', 45)
212
+ end
213
+ end
214
+ if (map_marker[ReaperGroup:GetName()]) then
215
+ COORDINATE:RemoveMark(map_marker[ReaperGroup:GetName()])
216
+ end
217
+ if(OnDemandReaper.tacan) then
218
+ map_marker[ReaperGroup:GetName()] = askedAnchorCoord:MarkToCoalition(
219
+ string.format(
220
+ 'OnDemandUAV %s - TCN %i\nLaserCode %i\nFL %i at %i knots\nFreq %.2f MHz\nOn station for %i minutes.',
221
+ OnDemandReaper.type,
222
+ OnDemandReaper.tacan.channel,
223
+ OnDemandReaper.laserCode,
224
+ UTILS.Round(OnDemandReaper.altitude / 100 , 0),
225
+ OnDemandReaper.speed,
226
+ OnDemandReaper.freq,
227
+ askedDuration
228
+ ),
229
+ OnDemandReaper.benefit_coalition,
230
+ true,
231
+ 'OnDemand Reaper %s is Activated'
232
+ )
233
+ else
234
+ map_marker[ReaperGroup:GetName()] = askedAnchorCoord:MarkToCoalition(
235
+ string.format(
236
+ 'OnDemandUAV %s\nLaserCode %i\nFL %i at %i knots\nFreq %.2f MHz\nOn station for %i minutes.',
237
+ OnDemandReaper.type,
238
+ OnDemandReaper.laserCode,
239
+ UTILS.Round(OnDemandReaper.altitude / 100 , 0),
240
+ OnDemandReaper.speed,
241
+ OnDemandReaper.freq,
242
+ askedDuration
243
+ ),
244
+ OnDemandReaper.benefit_coalition,
245
+ true,
246
+ 'OnDemand Reaper %s is Activated'
247
+ )
248
+ end
249
+ local reaperInfraIndex = 0
250
+ for infra_index, reaper_object in ipairs(ReapersInfraArray) do
251
+ if (reaper_object.customconfig.type == OnDemandReaper.type) then
252
+ debug_msg(string.format("OnDemandUAV : Found infra %s for UAV %s", reaper_object.customconfig.type, ReaperGroup:GetName()))
253
+ reaperInfraIndex = infra_index
254
+ end
255
+ end
256
+ if (reaperInfraIndex > 0) then
257
+ local currentDesignateObject = nil
258
+ if (not(is_reaper_spawned)) then
259
+ local setGroupReaper = SET_GROUP:New()
260
+ :FilterPrefixes(ReaperGroup:GetName())
261
+ :FilterOnce()
262
+ local detectionReaper = DETECTION_AREAS:New(setGroupReaper, UTILS.NMToMeters(5))
263
+ debug_msg(string.format("OnDemandUAV : Detection Areas created for SET_GROUP %s with %d members", ReapersInfraArray[reaperInfraIndex].customconfig.groupName, setGroupReaper:Count()))
264
+ local reaperCommandCenter = COMMANDCENTER:New( ReapersInfraArray[reaperInfraIndex].HQGroup, OnDemandReaper.hq_template_name )
265
+ debug_msg(string.format("OnDemandUAV : Command Center %s created and operating", reaperCommandCenter:GetName()))
266
+ reaperCommandCenter.FlashStatus=DEBUG_DETECT_MSG and false
267
+ if (OnDemandReaper.benefit_coalition == coalition.side.BLUE) then
268
+ currentDesignateObject = DESIGNATE:New( reaperCommandCenter, detectionReaper, SET_GROUP:New():FilterCoalitions("blue"):FilterStart())
269
+ else
270
+ currentDesignateObject = DESIGNATE:New( reaperCommandCenter, detectionReaper, SET_GROUP:New():FilterCoalitions("red"):FilterStart())
271
+ end
272
+ end
273
+ currentDesignateObject:SetDesignateName(OnDemandReaper.type)
274
+ currentDesignateObject:SetLaserCodes( OnDemandReaper.laserCode )
275
+ currentDesignateObject:SetThreatLevelPrioritization(true)
276
+ currentDesignateObject:SetAutoLase(true)
277
+ currentDesignateObject:SetFlashStatusMenu( DEBUG_DETECT_MSG and false)
278
+ function currentDesignateObject:OnAfterDetect(From, Event, To)
279
+ local DetectedItems = self.Detection:GetDetectedItems()
280
+ debug_msg(string.format("OnDemandUAV : OnAfterDetect"))
281
+ if self.Detection:GetDetectedItemsCount() > 0 then
282
+ local DetectedItem = DetectedItems[1]
283
+ if self.RecceSet:GetFirst():GetUnit(1):IsLasing() then
284
+ debug_msg(string.format("OnDemandUAV : %s Spoting %s Unit", self.RecceSet:GetFirst():GetName(), self.RecceSet:GetFirst():GetUnit(1):GetSpot().TargetName))
285
+ --Spot.createInfraRed(self.RecceSet:GetFirst():GetUnit(1):GetDCSObject(), {x = 0, y = 1, z = 0}, UNIT:FindByName(self.RecceSet:GetFirst():GetUnit(1):GetSpot().TargetName):GetPointVec3():AddY(1):GetVec3())
286
+ end
287
+ end
288
+ end
289
+ ReapersInfraArray[reaperInfraIndex].Designate = currentDesignateObject
290
+ end
291
+ ReaperGroup:HandleEvent(EVENTS.Land)
292
+ ReaperGroup:HandleEvent(EVENTS.Crash)
293
+ ReaperGroup:HandleEvent(EVENTS.Dead)
294
+ function ReaperGroup:OnEventLand(EventData)
295
+ COORDINATE:RemoveMark(map_marker[self:GetName()])
296
+ if self.customconfig.escortgroupname then
297
+ env.info('UAV RTB: '..self.GroupName..'...')
298
+ if self.escortGroupObject:IsAirborne(false) == true then
299
+ env.info('escort RTB : '.. self.escortGroupObject.GroupName..' UAV : '..self.GroupName..'...')
300
+ self.escortGroupObject:RouteRTB()
301
+ else
302
+ --self.escortGroupObject:Destroy(nil, 5)
303
+ end
304
+ end
305
+ end
306
+ function ReaperGroup:OnEventCrash(EventData)
307
+ COORDINATE:RemoveMark(map_marker[self:GetName()])
308
+ if self.customconfig.escortgroupname then
309
+ env.info('UAV RTB: '..self.GroupName..'...')
310
+ if self.escortGroupObject:IsAirborne(false) == true then
311
+ env.info('escort RTB : '.. self.escortGroupObject.GroupName..' UAV : '..self.GroupName..'...')
312
+ self.escortGroupObject:RouteRTB()
313
+ else
314
+ --self.escortGroupObject:Destroy(nil, 5)
315
+ end
316
+ end
317
+ end
318
+ function ReaperGroup:OnEventDead(EventData)
319
+ COORDINATE:RemoveMark(map_marker[self:GetName()])
320
+ if self.customconfig.escortgroupname then
321
+ env.info('UAV RTB: '..self.GroupName..'...')
322
+ if self.escortGroupObject:IsAirborne(false) == true then
323
+ env.info('escort RTB : '.. self.escortGroupObject.GroupName..' UAV : '..self.GroupName..'...')
324
+ self.escortGroupObject:RouteRTB()
325
+ else
326
+ --self.escortGroupObject:Destroy(nil, 5)
327
+ end
328
+ end
329
+ end
330
+ end
331
+ end
332
+ end
333
+ return ReaperGroup;
334
+ end
335
+
336
+ --local RestrToCoal = nil
337
+ reapersOnDemandArray = {}
338
+ local ReaperMarkHandler = {}
339
+ local CmdSymbol = "-"
340
+
341
+ function ReaperMarkHandler:onEvent(event)
342
+
343
+ if event.id == 25 then
344
+ --trigger.action.outText(" ", 0, true)
345
+ elseif (event.id == 27 and string.find(event.text, CmdSymbol)) then
346
+ --if (event.coalition == RestrToCoal or RestrToCoal == nil) then
347
+ local full = nil
348
+ local remString = nil
349
+ local cmd = nil
350
+ local param1 = nil
351
+ local param1Start = nil
352
+ local param2 = nil
353
+ local param2Start = nil
354
+ local param3 = nil
355
+ local param3Start = nil
356
+ local param4 = nil
357
+ local param4Start = nil
358
+ local param5 = nil
359
+ local param5Start = nil
360
+ local param6 = nil
361
+ local param6Start = nil
362
+ local mcoord = COORDINATE:New(event.pos.x, event.pos.y, event.pos.z)
363
+ local mvec3 = event.pos
364
+
365
+ full = string.sub(event.text, 2)
366
+
367
+ if (string.find(full, CmdSymbol)) then
368
+ param1Start = string.find(full, CmdSymbol)
369
+ cmd = string.sub(full, 0, param1Start-1)
370
+ remString = string.sub(full, param1Start+1)
371
+ if (string.find(remString, CmdSymbol)) then
372
+ param2Start = string.find(remString, CmdSymbol)
373
+ param1 = string.sub(remString, 0, param2Start-1)
374
+ remString = string.sub(remString, param2Start+1)
375
+ if string.find(remString, CmdSymbol) then
376
+ param3Start = string.find(remString, CmdSymbol)
377
+ param2 = string.sub(remString, 0, param3Start-1)
378
+ remString = string.sub(remString, param3Start+1)
379
+ if string.find(remString, CmdSymbol) then
380
+ param4Start = string.find(remString, CmdSymbol)
381
+ param3 = string.sub(remString, 0, param4Start-1)
382
+ remString = string.sub(remString, param4Start+1)
383
+ if string.find(remString, CmdSymbol) then
384
+ param5Start = string.find(remString, CmdSymbol)
385
+ param4 = string.sub(remString, 0, param5Start-1)
386
+ remString = string.sub(remString, param5Start+1)
387
+ if string.find(remString, CmdSymbol) then
388
+ param6Start = string.find(remString, CmdSymbol)
389
+ param5 = string.sub(remString, 0, param6Start-1)
390
+ param6 = string.sub(remString, param6Start+1)
391
+ else
392
+ param5 = remString
393
+ end
394
+ else
395
+ param4 = remString
396
+ end
397
+ else
398
+ param3 = remString
399
+ end
400
+ else
401
+ param2 = remString
402
+ end
403
+ else
404
+ param1 = remString
405
+ end
406
+ else
407
+ cmd = full
408
+ end
409
+ if DEBUG_MSG == true then
410
+ trigger.action.outText("Full Text = " .. full, 10)
411
+ trigger.action.outText("Command = " .. cmd, 10)
412
+ if param1 ~= nil then trigger.action.outText("type = " .. param1, 10) end
413
+ if param2 ~= nil then trigger.action.outText("LaserCode = " .. param2, 10) end
414
+ if param3 ~= nil then trigger.action.outText("Duration = " .. param3, 10) end
415
+ if param4 ~= nil then trigger.action.outText("FlightLevel = " .. param4, 10) end
416
+ if param5 ~= nil then trigger.action.outText("Speed = " .. param5, 10) end
417
+ end
418
+
419
+ if string.find(cmd, "uav") then
420
+ if DEBUG_MSG == true then
421
+ trigger.action.outText("DEBUG: On UAV Started!", 10)
422
+ end
423
+ reapersOnDemandArray[#reapersOnDemandArray+1] = triggerOnDemandReaper(
424
+ param1,
425
+ tonumber(param2),
426
+ tonumber(param3),
427
+ tonumber(param4),
428
+ tonumber(param5),
429
+ mcoord
430
+ )
431
+ end
432
+ --end
433
+ end
434
+
435
+ end
436
+
437
+ world.addEventHandler(ReaperMarkHandler)
438
+
439
+ function SpawnReaperHQDelay(param)
440
+ --parameters :
441
+ -- 1 : parent Radio Menu
442
+ -- 2 : reaper Object
443
+ -- 3 : delay in s before HQ spawns
444
+ -- 4 : function calling me (No Idea why we need that)
445
+ -- 5 : boolean for sound warning play
446
+ -- 6 : boolean for message warning
447
+ local reaperObject = param[2]
448
+ local delay = param[3] or spawnStandardDelay
449
+ local myfunc = param[4]
450
+ local sound_warning = true
451
+ if (type(param[5]) ~= nil) then
452
+ sound_warning = param[5]
453
+ end
454
+ local message_warning = true
455
+ if (type(param[6]) ~= nil) then
456
+ message_warning = param[6]
457
+ end
458
+ if ( sound_warning ) then
459
+ sound2Bip:ToAll()
460
+ end
461
+ if ( message_warning ) then
462
+ MESSAGE:NewType(string.format("Warning, Uav HQ Units %s will spawn in %d sec", reaperObject.customconfig.type, delay), MESSAGE.Type.Update):ToAll()
463
+ end
464
+ TIMER:New(SpawnReaperHQ, param):Start(delay)
465
+ end
466
+
467
+ function SpawnReaperHQ(param)
468
+ --parameters :
469
+ -- 1 : parent Radio Menu
470
+ -- 2 : reaper Object
471
+
472
+ local radioCommandReaper = param[1]
473
+ local reaperObject = param[2]
474
+ local reaperName = reaperObject.customconfig.type
475
+ local reaperHQName = reaperObject.customconfig.hq_template_name
476
+
477
+ debug_msg(string.format("OnDemandUAV : Reaper %s - HQ %s", reaperName, reaperHQName))
478
+ if (GROUP:FindByName(reaperHQName) ~= nil) then
479
+ reaperObject.HQSpawn = SPAWN:New(reaperHQName)
480
+ debug_msg(string.format("SPAWN %s", reaperHQName))
481
+ reaperObject.HQGroup = reaperObject.HQSpawn:Spawn()
482
+ else
483
+ debug_msg(string.format("GROUP to spawn %s not found in mission", reaperHQName))
484
+ end
485
+ MESSAGE:NewType(string.format("HQ group %s for %s UAV in place", reaperHQName, reaperName), MESSAGE.Type.Information)
486
+ :ToCoalition(reaperObject.customconfig.benefit_coalition)
487
+ --local coordinate = reaperObject.HQGroup:GetCoordinate()
488
+ --map_marker[reaperObject.HQGroup:GetName()] = coordinate:MarkToCoalition(string.format("Reaper %s : HQ=%s", reaperName, reaperObject.HQGroup:GetName()), reaperObject.customconfig.benefit_coalition)
489
+ end
490
+
491
+ -- *****************************************************************************
492
+ -- ** AFACS Infra **
493
+ -- *********************************************************
494
+
495
+ ReapersInfraArray = {}
496
+ local compteur = 0
497
+ --mainRadioMenuForReapersBlue = MENU_COALITION:New( coalition.side.BLUE , "AFACs", MenuCoalitionBlue )
498
+ --mainRadioMenuForReapersRed = MENU_COALITION:New( coalition.side.RED , "AFACs", MenuCoalitionRed )
499
+ for index, reapersconfig in ipairs(OnDemandReapersConfig) do
500
+ if reapersconfig.enable == true then
501
+ compteur = compteur + 1
502
+ debug_msg(string.format("OnDemandUAV : %s creation HQ : %s", reapersconfig.type, reapersconfig.hq_template_name))
503
+ ReapersInfraArray[compteur] = {
504
+ customconfig = reapersconfig,
505
+ ReaperRootMenu = {},
506
+ HQGroup = {},
507
+ HQSpawn = {},
508
+ Designate = {}
509
+ }
510
+ if (reapersconfig.benefit_coalition == coalition.side.BLUE) then
511
+ --ReapersInfraArray[compteur].ReaperRootMenu = MENU_COALITION:New( coalition.side.BLUE, reapersconfig.type , mainRadioMenuForReapersBlue)
512
+ else
513
+ --ReapersInfraArray[compteur].ReaperRootMenu = MENU_COALITION:New( coalition.side.RED, reapersconfig.type , mainRadioMenuForReapersRed)
514
+ end
515
+ SpawnReaperHQ({ ReapersInfraArray[compteur].ReaperRootMenu, ReapersInfraArray[compteur]})
516
+ end
517
+ end
518
+
519
+ if compteur == 0 then
520
+ --mainRadioMenuForReapersBlue:Remove()
521
+ --mainRadioMenuForReapersRed:Remove()
522
+ end
@@ -0,0 +1,34 @@
1
+ -- *****************************************************************************
2
+ -- ** FAC RANGES **
3
+ -- *********************************************************
4
+ FACRangeArray = {}
5
+ compteur = 0
6
+ mainRadioMenuForFacRangesBlue = MENU_COALITION:New( coalition.side.BLUE , "FAC", MenuCoalitionBlue )
7
+ mainRadioMenuForFacRangesRed = MENU_COALITION:New( coalition.side.RED , "FAC", MenuCoalitionRed )
8
+ for index, facrangeconfig in ipairs(FACRangeConfig) do
9
+ if facrangeconfig.enable == true then
10
+ compteur = compteur + 1
11
+ env.info('creation of FAC : ' .. facrangeconfig.name .. '...')
12
+ FACRangeArray[compteur] = {
13
+ customconfig = facrangeconfig
14
+ }
15
+ if (facrangeconfig.benefit_coalition == coalition.side.BLUE) then
16
+ local radioMenuForFACRange = MENU_COALITION:New( facrangeconfig.benefit_coalition, facrangeconfig.name , mainRadioMenuForFacRangesBlue)
17
+ for index, facSubRangeConfig in ipairs(facrangeconfig.subRange) do
18
+ local radioMenuFacSubRange = MENU_COALITION:New(facrangeconfig.benefit_coalition, facSubRangeConfig.name, radioMenuForFACRange)
19
+ AddFacFunction(radioMenuFacSubRange, facrangeconfig, facSubRangeConfig)
20
+ end
21
+ else
22
+ local radioMenuForFACRange = MENU_COALITION:New( facrangeconfig.benefit_coalition, facrangeconfig.name , mainRadioMenuForFacRangesRed)
23
+ for index, facSubRangeConfig in ipairs(facrangeconfig.subRange) do
24
+ local radioMenuFacSubRange = MENU_COALITION:New(facrangeconfig.benefit_coalition, facSubRangeConfig.name, radioMenuForFACRange)
25
+ AddFacFunction(radioMenuFacSubRange, facrangeconfig, facSubRangeConfig)
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ if compteur == 0 then
32
+ mainRadioMenuForFacRangesBlue:Remove()
33
+ mainRadioMenuForFacRangesRed:Remove()
34
+ end