@jtff/miztemplate-lib 2.0.6 → 2.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jtff/miztemplate-lib",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "JTFF mission template library",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -18,7 +18,8 @@
18
18
  "keywords": [
19
19
  "DCS",
20
20
  "World",
21
- "JTFF"
21
+ "JTFF",
22
+ "DCSWorld"
22
23
  ],
23
24
  "author": "Sebastien LONGO",
24
25
  "license": "GPL-3.0-or-later",
@@ -72,6 +72,12 @@ function injectScripts(jtffci, env_mission) {
72
72
  warning: 'inject_A2A must be yes/y/o/oui or no/n/non',
73
73
  default: 'n'
74
74
  },
75
+ {
76
+ name: 'inject_Logistics',
77
+ validator: /^y\b|n\b|o\b|yes\b|no\b|non\b|oui\b/i,
78
+ warning: 'inject_Logistics must be yes/y/o/oui or no/n/non',
79
+ default: 'n'
80
+ },
75
81
  {
76
82
  name: 'inject_A2G',
77
83
  validator: /^y\b|n\b|o\b|yes\b|no\b|non\b|oui\b/i,
@@ -105,6 +111,7 @@ function injectScripts(jtffci, env_mission) {
105
111
  console.log(' inject_awacs scripts: ' + (/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_awacs));
106
112
  console.log(' inject_atis scripts: ' + (/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_atis));
107
113
  console.log(' inject_A2A scripts: ' + (/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_A2A));
114
+ console.log(' inject_Logistics scripts: ' + (/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_Logistics));
108
115
  console.log(' inject_A2G scripts: ' + (/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_A2G));
109
116
  console.log(' inject_mission specific scripts: ' + (/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_mission));
110
117
  console.log(' inject_radio_presets scripts: ' + (/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_radio_presets));
@@ -433,6 +440,52 @@ function injectScripts(jtffci, env_mission) {
433
440
  missionObject['trigrules'] = tuple.trObject;
434
441
  mapResourceObject = tuple.mrObject;
435
442
  }
443
+ if ((/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_Logistics)) {
444
+ // injection des fichiers son CTLD
445
+ const zip = await jtffci.mizOpen([
446
+ jtffci.config.general.missionFolder,
447
+ "/",
448
+ path.parse(env_mission).name,
449
+ "/",
450
+ path.basename(env_mission)
451
+ ].join(""));
452
+ const rangeSoundFolder = zip.remove('CTLD').folder('CTLD');
453
+ await jtffci.addFilesToZip(rangeSoundFolder, 'resources/sounds/CTLD', fs.readdirSync('resources/sounds/CTLD'));
454
+ const inputZip = await zip.generateAsync({
455
+ type: 'nodebuffer',
456
+ streamFiles: true,
457
+ compression: "DEFLATE",
458
+ compressionOptions: {
459
+ level: 9
460
+ }
461
+ });
462
+ fs.writeFileSync([
463
+ jtffci.config.general.missionFolder,
464
+ "/",
465
+ path.parse(env_mission).name,
466
+ "/",
467
+ path.basename(env_mission)
468
+ ].join(""),
469
+ inputZip);
470
+ settingsArray.push(
471
+ {
472
+ file: "settings-logistics.lua",
473
+ objectName: "CTLDConfig"
474
+ },
475
+ );
476
+ tuple = jtffci.injectScripts(
477
+ missionObject['trig'],
478
+ missionObject['trigrules'],
479
+ mapResourceObject,
480
+ 'Logistics',
481
+ ['180-logistics.lua'],
482
+ 28,
483
+ '0xff0000ff'
484
+ );
485
+ missionObject['trig'] = tuple.tObject;
486
+ missionObject['trigrules'] = tuple.trObject;
487
+ mapResourceObject = tuple.mrObject;
488
+ }
436
489
  if ((/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_A2G)) {
437
490
  // injection des fichiers son Range
438
491
  // const zip = await jtffci.mizOpen([