@jtff/miztemplate-lib 3.10.4 → 3.10.6

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.
@@ -43,41 +43,41 @@ for index, awacsconfig in ipairs(AwacsConfig) do
43
43
  self.escortGroupObject = spawnRecoveryTankerEscort(self.escortSpawnObject,self.customconfig)
44
44
  if self.customconfig.missionmaxduration then
45
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
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
52
  )
53
53
  --trigger.action.outText('Tanker-escort configured to RTB in : '..(self.customconfig.missionmaxduration)..' minutes max...', 45)
54
54
  end
55
55
  end
56
56
  if self.customconfig.missionmaxduration then
57
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
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
63
  )
64
64
  --trigger.action.outText('AWACS configured to RTB in : '..(self.customconfig.missionmaxduration)..' minutes max...', 45)
65
65
  end
66
66
  if (self.customconfig.benefit_coalition == coalition.side.RED) then
67
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
68
+ coalition.side.RED,
69
+ "Reset AWACS "..self.customconfig.callsign.alias..'-'..self.customconfig.callsign.number..'-1',
70
+ MenuCoalitionAwacsRed,
71
+ resetRecoveryTanker,
72
+ self
73
73
  )
74
74
  else
75
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
76
+ coalition.side.BLUE,
77
+ "Reset AWACS "..self.customconfig.callsign.alias..'-'..self.customconfig.callsign.number..'-1',
78
+ MenuCoalitionAwacsBlue,
79
+ resetRecoveryTanker,
80
+ self
81
81
  )
82
82
  end
83
83
  end
@@ -121,7 +121,7 @@ end
121
121
  -- ** OnDemand Awacs **
122
122
  -- *********************************************************
123
123
  function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnchorCoord, askedOrbitHeading, askedOrbitLeg)
124
- local AwacsGroup = nil
124
+ local AwacsGroup
125
125
  if (OnDemandAwacsConfig) then
126
126
  for index, OnDemandAwacs in ipairs(OnDemandAwacsConfig) do
127
127
  if ((OnDemandAwacs.type == type) and (OnDemandAwacs.enable)) then
@@ -190,15 +190,15 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
190
190
 
191
191
  local is_awacs_spawned = false
192
192
  jtff_log.debug(string.format('Looking for a Group corresponding to template %s', string.format("%s-%s", OnDemandAwacs.groupName, OnDemandAwacs.type)),"AWACS")
193
- for index, current_group in ipairs(aliveAwacsGroupList) do
193
+ for current_index, current_group in ipairs(aliveAwacsGroupList) do
194
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)
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
202
  ) then
203
203
  jtff_log.info(string.format('Found %s corresponding to template %s', current_group.GroupName, string.format("%s-%s", OnDemandAwacs.groupName, OnDemandAwacs.type)),"AWACS")
204
204
  is_awacs_spawned = true
@@ -206,7 +206,7 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
206
206
  end
207
207
  end
208
208
 
209
- local RTBAirbase = nil
209
+ local RTBAirbase
210
210
  local AwacsRoute = {}
211
211
  if (OnDemandAwacs.baseUnit) then
212
212
  RTBAirbase = AIRBASE:FindByName(OnDemandAwacs.baseUnit)
@@ -217,71 +217,71 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
217
217
  jtff_log.info(string.format('OnDemandAwacs already in air : rerouting %s', OnDemandAwacs.groupName),"AWACS")
218
218
  AwacsGroup:ClearTasks()
219
219
  table.insert(
220
- AwacsRoute,
221
- askedAnchorCoord
222
- :SetAltitude(UTILS.FeetToMeters(OnDemandAwacs.altitude))
223
- :WaypointAirTurningPoint(
224
- nil,
225
- UTILS.KnotsToKmph(OnDemandAwacs.speed),
226
- {
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 =
227
236
  {
228
- id = 'AWACS',
237
+ id = 'Orbit',
229
238
  params = {
239
+ pattern = AI.Task.OrbitPattern.RACE_TRACK,
240
+ speed = UTILS.KnotsToMps(OnDemandAwacs.speed),
241
+ altitude = UTILS.FeetToMeters(OnDemandAwacs.altitude)
230
242
  }
231
243
  },
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
- },
244
+ stopCondition = {
245
+ duration = askedDuration * 60
246
+ }
249
247
  },
250
- "Awacs Start"
251
- )
248
+ },
249
+ },
250
+ "Awacs Start"
251
+ )
252
252
  )
253
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
- )
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
270
  )
271
271
  table.insert(
272
- AwacsRoute,
272
+ AwacsRoute,
273
+ RTBAirbase
274
+ :GetCoordinate()
275
+ :WaypointAirLanding(
276
+ UTILS.KnotsToKmph(OnDemandAwacs.speed),
273
277
  RTBAirbase
274
- :GetCoordinate()
275
- :WaypointAirLanding(
276
- UTILS.KnotsToKmph(OnDemandAwacs.speed),
277
- RTBAirbase
278
- )
278
+ )
279
279
  )
280
280
  else
281
281
  jtff_log.info(string.format('OnDemandAwacs Spawning %s', OnDemandAwacs.groupName),"AWACS")
282
282
  local SpawnAwacs = SPAWN:NewWithAlias(
283
- OnDemandAwacs.groupName,
284
- string.format("%s-%s", OnDemandAwacs.groupName, OnDemandAwacs.type)
283
+ OnDemandAwacs.groupName,
284
+ string.format("%s-%s", OnDemandAwacs.groupName, OnDemandAwacs.type)
285
285
  )
286
286
  if (OnDemandAwacs.freq) then
287
287
  SpawnAwacs:InitRadioFrequency(OnDemandAwacs.freq)
@@ -292,91 +292,91 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
292
292
  end
293
293
  if (OnDemandAwacs.baseUnit) then
294
294
  AwacsGroup = SpawnAwacs:SpawnAtAirbase(
295
- AIRBASE:FindByName(OnDemandAwacs.baseUnit),
296
- SPAWN.Takeoff.Hot,
297
- nil,
298
- OnDemandAwacs.terminalType
295
+ AIRBASE:FindByName(OnDemandAwacs.baseUnit),
296
+ SPAWN.Takeoff.Hot,
297
+ nil,
298
+ OnDemandAwacs.terminalType
299
299
  )
300
300
  table.insert(AwacsRoute,
301
- AIRBASE
302
- :FindByName(OnDemandAwacs.baseUnit)
303
- :GetCoordinate()
304
- :WaypointAirTakeOffParkingHot()
301
+ AIRBASE
302
+ :FindByName(OnDemandAwacs.baseUnit)
303
+ :GetCoordinate()
304
+ :WaypointAirTakeOffParkingHot()
305
305
  )
306
306
  else
307
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
- )
308
+ askedAnchorCoord
309
+ :GetRandomCoordinateInRadius(
310
+ UTILS.NMToMeters(30),
311
+ UTILS.NMToMeters(20)
312
+ )
313
+ :SetAltitude(
314
+ UTILS.FeetToMeters(OnDemandAwacs.altitude)
315
+ )
316
316
  )
317
317
  end
318
318
  AwacsGroup.customconfig = OnDemandAwacs
319
319
  AwacsGroup.spawnAbsTime = timer.getAbsTime()
320
320
  AwacsGroup.missionmaxduration = askedDuration
321
321
  table.insert(AwacsRoute,
322
- askedAnchorCoord
323
- :SetAltitude(UTILS.FeetToMeters(OnDemandAwacs.altitude))
324
- :WaypointAirTurningPoint(
325
- nil,
326
- UTILS.KnotsToKmph(OnDemandAwacs.speed),
327
- {
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 =
328
337
  {
329
- id = 'AWACS',
338
+ id = 'Orbit',
330
339
  params = {
340
+ pattern = AI.Task.OrbitPattern.RACE_TRACK,
341
+ speed = UTILS.KnotsToMps(OnDemandAwacs.speed),
342
+ altitude = UTILS.FeetToMeters(OnDemandAwacs.altitude)
331
343
  }
332
344
  },
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
- },
345
+ stopCondition = {
346
+ duration = askedDuration * 60
347
+ }
350
348
  },
351
- "Awacs Start"
352
- )
349
+ },
350
+ },
351
+ "Awacs Start"
352
+ )
353
353
  )
354
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
- )
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
370
  )
371
371
  table.insert(AwacsRoute,
372
- RTBAirbase
373
- :GetCoordinate()
374
- :WaypointAirLanding(
375
- UTILS.KnotsToKmph(OnDemandAwacs.speed),
376
- RTBAirbase,
377
- {},
378
- 'RTB'
379
- )
372
+ RTBAirbase
373
+ :GetCoordinate()
374
+ :WaypointAirLanding(
375
+ UTILS.KnotsToKmph(OnDemandAwacs.speed),
376
+ RTBAirbase,
377
+ {},
378
+ 'RTB'
379
+ )
380
380
  )
381
381
  end
382
382
  AwacsGroup:Route(AwacsRoute)
@@ -398,12 +398,12 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
398
398
  AwacsGroup.escortGroupObject = spawnRecoveryTankerEscort(AwacsGroup.escortSpawnObject,OnDemandAwacs)
399
399
  if OnDemandAwacs.missionmaxduration then
400
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
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
407
  )
408
408
  --trigger.action.outText('Tanker-escort configured to RTB in : '..(OnDemandAwacs.missionmaxduration)..' minutes max...', 45)
409
409
  end
@@ -413,36 +413,36 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
413
413
  end
414
414
  if (OnDemandAwacs.tacan) then
415
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'
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
430
  )
431
431
  else
432
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'
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
446
  )
447
447
  end
448
448
  AwacsGroup:HandleEvent(EVENTS.Land)
@@ -502,23 +502,22 @@ function AwacsMarkHandler:onEvent(event)
502
502
  --trigger.action.outText(" ", 0, true)
503
503
  elseif (event.id == 27 and string.find(event.text, awacsCmdSymbol)) then
504
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
505
+ local full
506
+ local remString
507
+ local cmd
508
+ local param1
509
+ local param1Start
510
+ local param2
511
+ local param2Start
512
+ local param3
513
+ local param3Start
514
+ local param4
515
+ local param4Start
516
+ local param5
517
+ local param5Start
518
+ local param6
519
+ local param6Start
520
520
  local mcoord = COORDINATE:New(event.pos.x, event.pos.y, event.pos.z)
521
- local mvec3 = event.pos
522
521
 
523
522
  full = string.sub(event.text, 2)
524
523
 
@@ -582,13 +581,13 @@ function AwacsMarkHandler:onEvent(event)
582
581
  trigger.action.outText("DEBUG: On Demand Awacs Started!", 10)
583
582
  end
584
583
  awacsOnDemandArray[#awacsOnDemandArray+1] = triggerOnDemandAwacs(
585
- param1,
586
- tonumber(param2),
587
- tonumber(param3),
588
- tonumber(param4),
589
- mcoord,
590
- tonumber(param5),
591
- tonumber(param6)
584
+ param1,
585
+ tonumber(param2),
586
+ tonumber(param3),
587
+ tonumber(param4),
588
+ mcoord,
589
+ tonumber(param5),
590
+ tonumber(param6)
592
591
  )
593
592
  end
594
593
  --end
@@ -5,69 +5,71 @@ RATManagerArray = {}
5
5
  compteur = 0
6
6
  for index, ratconfig in ipairs(RATConfig) do
7
7
  if ratconfig.enable == true then
8
- jtff_log.info(string.format("RAT Enable"),"RAT")
8
+ jtff_log.info(string.format("RATManager %s Enable",ratconfig.name),"RAT")
9
9
  compteur = compteur +1
10
- if not (ratconfig.maximum_aircrafts) then
11
- ratconfig.maximum_aircrafts = 10
12
- end
13
- local RATmanager=RATMANAGER:New(ratconfig.maximum_aircrafts)
10
+ local ratManagerName = ratconfig.name or "unknown"
11
+ RATManagerArray[compteur] = RATMANAGER:New(ratconfig.constant_alive_groups or nil)
12
+ RATManagerArray[compteur].RATObjectsArray = {}
14
13
  for index_planegroup, planegroupconfig in ipairs(ratconfig.aircrafts_groupconfigs) do
15
14
  if (type(planegroupconfig.templatename) == "string") then
16
15
  planegroupconfig.templatename = {planegroupconfig.templatename}
17
16
  end
18
17
  if (type(planegroupconfig.templatename) == "table") then
19
- for index, templatename in ipairs(planegroupconfig.templatename) do
20
- jtff_log.debug(string.format("RAT %s", templatename),"RAT")
21
- local RATGroup = RAT:New(templatename)
18
+ for templateindex, templatename in ipairs(planegroupconfig.templatename) do
19
+ jtff_log.debug(string.format("RATManager %s - template %s", ratManagerName ,templatename),"RAT")
20
+ RATManagerArray[compteur].RATObjectsArray[templateindex] = RAT:New(templatename)
22
21
  if (type(planegroupconfig.airbases_names) == "table" ) then
23
- RATGroup:SetTakeoff("cold")
22
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:SetTakeoff("cold")
24
23
  for airstartindex, airstartname in ipairs(planegroupconfig.airbases_names.departure) do
25
- if not(RATGroup:_AirportExists(airstartname)) then
26
- RATGroup:SetTakeoff("air")
24
+ if not(RATManagerArray[compteur].RATObjectsArray[templateindex]:_AirportExists(airstartname)) then
25
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:SetTakeoff("air")
27
26
  end
28
27
  end
29
28
  for airstopindex, airstopname in ipairs(planegroupconfig.airbases_names.arrival) do
30
- if not(RATGroup:_AirportExists(airstopname)) then
31
- RATGroup:DestinationZone()
29
+ if not(RATManagerArray[compteur].RATObjectsArray[templateindex]:_AirportExists(airstopname)) then
30
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:DestinationZone()
32
31
  end
33
32
  end
34
- RATGroup:SetDeparture(planegroupconfig.airbases_names.departure)
35
- RATGroup:SetDestination(planegroupconfig.airbases_names.arrival)
33
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:SetDeparture(planegroupconfig.airbases_names.departure)
34
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:SetDestination(planegroupconfig.airbases_names.arrival)
36
35
  end
37
36
  if (type(planegroupconfig.inactive_timer) == "number" ) then
38
- RATGroup:TimeDestroyInactive(planegroupconfig.inactive_timer)
37
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:TimeDestroyInactive(planegroupconfig.inactive_timer)
39
38
  end
40
39
  if (type(planegroupconfig.atcmessage_enable) == "boolean" ) then
41
- RATGroup:ATC_Messages(planegroupconfig.atcmessage_enable)
40
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:ATC_Messages(planegroupconfig.atcmessage_enable)
42
41
  else
43
- RATGroup:ATC_Messages(false)
42
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:ATC_Messages(false)
44
43
  end
45
44
  if (type(planegroupconfig.flightlevel) == "number" ) then
46
- RATGroup:SetFLcruise(planegroupconfig.flightlevel)
45
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:SetFLcruise(planegroupconfig.flightlevel)
47
46
  end
48
47
  if (type(planegroupconfig.speed) == "number") then
49
- RATGroup:SetMaxCruiseSpeed(UTILS.KnotsToKmph(planegroupconfig.speed))
48
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:SetMaxCruiseSpeed(UTILS.KnotsToKmph(planegroupconfig.speed))
50
49
  end
51
50
  if (planegroupconfig.liveries) then
52
- RATGroup:Livery(planegroupconfig.liveries)
51
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:Livery(planegroupconfig.liveries)
53
52
  end
54
53
  if (type(planegroupconfig.allow_immortal) == "boolean" and planegroupconfig.allow_immortal == true) then
55
- RATGroup:Immortal()
54
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:Immortal()
56
55
  end
57
56
  if (type(planegroupconfig.allow_invisible) == "boolean" and planegroupconfig.allow_invisible == true) then
58
- RATGroup:Invisible()
57
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:Invisible()
59
58
  end
60
59
  if (type(planegroupconfig.commute) == "boolean" and planegroupconfig.commute == true) then
61
- RATGroup:Commute(true)
60
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:Commute(true)
62
61
  end
63
- RATGroup:SetEPLRS(true)
64
- RATmanager:Add(RATGroup, planegroupconfig.minimun_spawns)
62
+ RATManagerArray[compteur].RATObjectsArray[templateindex]:SetEPLRS(true)
63
+ RATManagerArray[compteur]:Add(RATManagerArray[compteur].RATObjectsArray[templateindex], planegroupconfig.minimun_spawns)
64
+ --RATManagerArray[compteur].RATObjectsArray[templateindex]:SetSpawnInterval(planegroupconfig.inactive_timer)
65
+ --RATManagerArray[compteur].RATObjectsArray[templateindex]:InitRepeat()
66
+ --RATManagerArray[compteur].RATObjectsArray[templateindex]:Spawn()
65
67
  end
66
68
  else
67
69
  jtff_log.error(string.format("RAT error in template name type : %s", planegroupconfig.templatename),"RAT")
68
70
  end
69
71
  end
70
- RATManagerArray[compteur] = RATmanager
72
+ RATManagerArray[compteur].customconfig = ratconfig
71
73
  RATManagerArray[compteur]:Start(spawnStandardDelay)
72
74
  end
73
75
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jtff/miztemplate-lib",
3
- "version": "3.10.4",
3
+ "version": "3.10.6",
4
4
  "description": "JTFF mission template library",
5
5
  "main": "index.js",
6
6
  "files": [