@jtff/miztemplate-lib 3.1.2 → 3.1.3
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/index.js +3 -1
- package/package.json +1 -1
- package/scripts/inject-scripts.js +368 -359
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const ftpupload = require("./scripts/ftpupload.js");
|
|
|
6
6
|
const gdriveupload = require("./scripts/gdrive-upload.js");
|
|
7
7
|
const getmizfiles = require("./scripts/get-mizfiles.js");
|
|
8
8
|
const {setVersion, getVersion} = require("./scripts/getset-version.js");
|
|
9
|
-
const injectScripts = require("./scripts/inject-scripts.js");
|
|
9
|
+
const {injectScripts, createSkel, doInject} = require("./scripts/inject-scripts.js");
|
|
10
10
|
const nextversionPrepare = require("./scripts/prepare-nextversion.js");
|
|
11
11
|
const release = require("./scripts/release.js");
|
|
12
12
|
const templateUpdate = require("./scripts/template-update.js");
|
|
@@ -22,6 +22,8 @@ module.exports = {
|
|
|
22
22
|
getVersion:getVersion,
|
|
23
23
|
setVersion:setVersion,
|
|
24
24
|
injectScripts:injectScripts,
|
|
25
|
+
createSkel: createSkel,
|
|
26
|
+
doInject: doInject,
|
|
25
27
|
nextversionPrepare:nextversionPrepare,
|
|
26
28
|
release:release,
|
|
27
29
|
templateUpdate:templateUpdate,
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ const prompt = require('prompt');
|
|
|
4
4
|
let _ = require('lodash');
|
|
5
5
|
const {getInstalledPathSync} = require("get-installed-path");
|
|
6
6
|
|
|
7
|
-
function
|
|
7
|
+
function createSkel(jtffci, env_mission) {
|
|
8
8
|
const workspacePath = [
|
|
9
9
|
jtffci.config.general.missionFolder,
|
|
10
10
|
"/",
|
|
@@ -67,6 +67,11 @@ function injectScripts(jtffci, env_mission) {
|
|
|
67
67
|
].join(""),
|
|
68
68
|
{ recursive: true }
|
|
69
69
|
);
|
|
70
|
+
return {workspacePath, destinationMizFilePath};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function injectScripts(jtffci, env_mission) {
|
|
74
|
+
const {workspacePath,destinationMizFilePath} = createSkel(jtffci, env_mission);
|
|
70
75
|
const prompt_properties = [
|
|
71
76
|
{
|
|
72
77
|
name: 'inject_tankers',
|
|
@@ -147,386 +152,390 @@ function injectScripts(jtffci, env_mission) {
|
|
|
147
152
|
console.log(' inject_A2G scripts: ' + (/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_A2G));
|
|
148
153
|
console.log(' inject_mission specific scripts: ' + (/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_mission));
|
|
149
154
|
console.log(' inject_radio_presets scripts: ' + (/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_radio_presets));
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
155
|
+
return await doInject(jtffci, env_mission, workspacePath, destinationMizFilePath, prompt_result);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async function doInject(ciObject, sourceMizFileName, workspacePath,destinationMizFilePath, promptResult) {
|
|
160
|
+
// open the miz input file for reading
|
|
161
|
+
const originalMizObject = await ciObject.mizlib.getZipObjectFromMizPath(sourceMizFileName);
|
|
162
|
+
// copie de l'objet pour modification
|
|
163
|
+
let mizObject = originalMizObject;
|
|
164
|
+
// Open the mission Object and mapResource Object for modification
|
|
165
|
+
const missionObject = await ciObject.mizlib.getMissionObjectFromZipObject(mizObject);
|
|
166
|
+
let mapResourceObject = await ciObject.mizlib.getMapResourceObjectFromZipObject(mizObject);
|
|
167
|
+
// prepare settings array
|
|
168
|
+
let settingsArray = [];
|
|
169
|
+
let scriptsArray = [];
|
|
170
|
+
let libsArray = [];
|
|
171
|
+
// insertion des librairies externes dans la file d'attente
|
|
172
|
+
libsArray.push({
|
|
173
|
+
folder: 'lib',
|
|
174
|
+
scriptTitle: 'SplashDamage 2.0',
|
|
175
|
+
scripts: ['Splash_Damage_2_0.lua'],
|
|
176
|
+
timing: 9,
|
|
177
|
+
color: '0x008000ff'
|
|
178
|
+
});
|
|
179
|
+
libsArray.push({
|
|
180
|
+
folder: 'lib',
|
|
181
|
+
scriptTitle: 'Moose',
|
|
182
|
+
scripts: ['Moose_.lua'],
|
|
183
|
+
timing: 10,
|
|
184
|
+
color: '0x008000ff'
|
|
185
|
+
});
|
|
186
|
+
libsArray.push({
|
|
187
|
+
folder: 'lib',
|
|
188
|
+
scriptTitle: 'Mist',
|
|
189
|
+
scripts: ['mist_4_5_107.lua'],
|
|
190
|
+
timing: 12,
|
|
191
|
+
color: '0x008000ff'
|
|
192
|
+
});
|
|
193
|
+
libsArray.push({
|
|
194
|
+
folder: 'lib',
|
|
195
|
+
scriptTitle: 'Hercules',
|
|
196
|
+
scripts: ['Hercules_Cargo.lua'],
|
|
197
|
+
timing: 14,
|
|
198
|
+
color: '0x008000ff'
|
|
199
|
+
});
|
|
200
|
+
libsArray.push({
|
|
201
|
+
folder: 'lib',
|
|
202
|
+
scriptTitle: 'Skynet',
|
|
203
|
+
scripts: ['skynet-iads-compiled.lua'],
|
|
204
|
+
timing: 15,
|
|
205
|
+
color: '0x008000ff'
|
|
206
|
+
});
|
|
207
|
+
// injection des fichiers son Généraux si repertoire resources/sounds/General present
|
|
208
|
+
await ciObject.mizlib.updateWorkspaceWithSingleSoundFolder(workspacePath, 'General');
|
|
209
|
+
await ciObject.mizlib.injectSingleSoundFolderIntoZipObject(mizObject,workspacePath, 'General', true);
|
|
210
|
+
// injection des fichiers son Misc si repertoire resources/sounds/Misc present
|
|
211
|
+
await ciObject.mizlib.updateWorkspaceWithSingleSoundFolder(workspacePath, 'Misc');
|
|
212
|
+
await ciObject.mizlib.injectSingleSoundFolderIntoZipObject(mizObject,workspacePath, 'Misc', true);
|
|
213
|
+
// insertion des Librairies JTFF dans la file d'attente
|
|
214
|
+
settingsArray.push(
|
|
215
|
+
{
|
|
216
|
+
file: "settings-gemman.lua",
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
file: "settings-global.lua",
|
|
220
|
+
},
|
|
221
|
+
);
|
|
222
|
+
libsArray.push({
|
|
223
|
+
folder: 'lib',
|
|
224
|
+
scriptTitle: 'GemMan',
|
|
225
|
+
scripts: ['gemman.lua'],
|
|
226
|
+
timing: 17,
|
|
227
|
+
color: '0xffff00ff'
|
|
228
|
+
});
|
|
229
|
+
libsArray.push({
|
|
230
|
+
folder: 'src',
|
|
231
|
+
scriptTitle: 'JTFF Libraries',
|
|
232
|
+
scripts: ['010-root_menus.lua', '020-mission_functions.lua'],
|
|
233
|
+
timing: 18,
|
|
234
|
+
color: '0xffff00ff'
|
|
235
|
+
});
|
|
236
|
+
// traitement de la file d'attente des librairies (injection des triggers et des fichiers lua)
|
|
237
|
+
for ( libscript of libsArray) {
|
|
238
|
+
console.log(['adding library',libscript.scripts.join(' and '),'from',workspacePath + '/.workspace/' + libscript.folder, 'folder...'].join(' '));
|
|
239
|
+
let {tuple, zipObject} = await ciObject.mizlib.injectLuaScriptIntoZipObjectAndUpdateWorkspace(
|
|
240
|
+
workspacePath,
|
|
241
|
+
libscript.folder,
|
|
242
|
+
libscript.scripts,
|
|
243
|
+
libscript.scriptTitle + ' Load',
|
|
244
|
+
mizObject,
|
|
245
|
+
libscript.timing,
|
|
246
|
+
libscript.color,
|
|
247
|
+
true
|
|
248
|
+
);
|
|
249
|
+
missionObject['trig'] = tuple.tObject;
|
|
250
|
+
missionObject['trigrules'] = tuple.trObject;
|
|
251
|
+
mapResourceObject = _.merge(mapResourceObject,tuple.mrObject);
|
|
252
|
+
mizObject = zipObject;
|
|
253
|
+
}
|
|
254
|
+
// injection de la gestion des Set_Clients dans la file d'attente
|
|
255
|
+
scriptsArray.push({
|
|
256
|
+
folder: 'src',
|
|
257
|
+
scriptTitle: 'Set clients',
|
|
258
|
+
scripts: ['110-set_clients.lua'],
|
|
259
|
+
timing: 21,
|
|
260
|
+
color: '0xff0000ff',
|
|
261
|
+
fromLibrary: true
|
|
262
|
+
});
|
|
263
|
+
// injection des Tankers et OndemandTankers dans la file d'attente
|
|
264
|
+
if ((/^y\b|o\b|yes\b|oui\b/i).test(promptResult.inject_tankers)) {
|
|
265
|
+
settingsArray.push(
|
|
266
|
+
{
|
|
267
|
+
file: "settings-tankers.lua",
|
|
268
|
+
objectName: "TankersConfig"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
file: "settings-ondemandtankers.lua",
|
|
272
|
+
objectName: "OnDemandTankersConfig"
|
|
273
|
+
},
|
|
274
|
+
);
|
|
275
|
+
scriptsArray.push({
|
|
276
|
+
folder: 'src',
|
|
277
|
+
scriptTitle: 'Tankers',
|
|
278
|
+
scripts: ['120-tankers.lua'],
|
|
279
|
+
timing: 22,
|
|
280
|
+
color: '0xff0000ff',
|
|
281
|
+
fromLibrary: true
|
|
168
282
|
});
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
283
|
+
}
|
|
284
|
+
// injection des Airboss et Pedros dans la file d'attente
|
|
285
|
+
if ((/^y\b|o\b|yes\b|oui\b/i).test(promptResult.inject_airboss)) {
|
|
286
|
+
// injection des fichiers son Airboss
|
|
287
|
+
await ciObject.mizlib.updateWorkspaceWithSingleSoundFolder(workspacePath, 'AIRBOSS');
|
|
288
|
+
await ciObject.mizlib.injectSingleSoundFolderIntoZipObject(mizObject,workspacePath, 'AIRBOSS', true);
|
|
289
|
+
settingsArray.push(
|
|
290
|
+
{
|
|
291
|
+
file: "settings-airboss.lua",
|
|
292
|
+
objectName: "AirBossConfig"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
file: "settings-pedros.lua",
|
|
296
|
+
objectName: "PedrosConfig"
|
|
297
|
+
},
|
|
298
|
+
);
|
|
299
|
+
scriptsArray.push({
|
|
300
|
+
folder: 'src',
|
|
301
|
+
scriptTitle: 'Airboss',
|
|
302
|
+
scripts: ['130-airboss.lua', '135-pedro.lua'],
|
|
303
|
+
timing: 23,
|
|
304
|
+
color: '0xff0000ff',
|
|
305
|
+
fromLibrary: true
|
|
175
306
|
});
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
307
|
+
}
|
|
308
|
+
// injection des Beacons dans la file d'attente
|
|
309
|
+
if ((/^y\b|o\b|yes\b|oui\b/i).test(promptResult.inject_beacons)) {
|
|
310
|
+
settingsArray.push(
|
|
311
|
+
{
|
|
312
|
+
file: "settings-beacons.lua",
|
|
313
|
+
objectName: "BeaconsConfig"
|
|
314
|
+
},
|
|
315
|
+
);
|
|
316
|
+
scriptsArray.push({
|
|
317
|
+
folder: 'src',
|
|
318
|
+
scriptTitle: 'Beacons',
|
|
319
|
+
scripts: ['140-beacons.lua'],
|
|
320
|
+
timing: 24,
|
|
321
|
+
color: '0xff0000ff',
|
|
322
|
+
fromLibrary: true
|
|
182
323
|
});
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
324
|
+
}
|
|
325
|
+
// injection des AWACS et OnDemandAwacs dans la file d'attente
|
|
326
|
+
if ((/^y\b|o\b|yes\b|oui\b/i).test(promptResult.inject_awacs)) {
|
|
327
|
+
settingsArray.push(
|
|
328
|
+
{
|
|
329
|
+
file: "settings-awacs.lua",
|
|
330
|
+
objectName: "AwacsConfig"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
file: "settings-awacsondemand.lua",
|
|
334
|
+
objectName: "AwacsOnDemandConfig"
|
|
335
|
+
},
|
|
336
|
+
);
|
|
337
|
+
scriptsArray.push({
|
|
338
|
+
folder: 'src',
|
|
339
|
+
scriptTitle: 'Awacs',
|
|
340
|
+
scripts: ['150-awacs.lua'],
|
|
341
|
+
timing: 25,
|
|
342
|
+
color: '0xff0000ff',
|
|
343
|
+
fromLibrary: true
|
|
189
344
|
});
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
345
|
+
}
|
|
346
|
+
// injection des ATIS dans la file d'attente
|
|
347
|
+
if ((/^y\b|o\b|yes\b|oui\b/i).test(promptResult.inject_atis)) {
|
|
348
|
+
// injection des fichiers son ATIS
|
|
349
|
+
await ciObject.mizlib.updateWorkspaceWithSingleSoundFolder(workspacePath, 'ATIS');
|
|
350
|
+
await ciObject.mizlib.injectSingleSoundFolderIntoZipObject(mizObject,workspacePath, 'ATIS', true);
|
|
351
|
+
settingsArray.push(
|
|
352
|
+
{
|
|
353
|
+
file: "settings-atis.lua",
|
|
354
|
+
objectName: "AtisConfig"
|
|
355
|
+
},
|
|
356
|
+
);
|
|
357
|
+
scriptsArray.push({
|
|
358
|
+
folder: 'src',
|
|
359
|
+
scriptTitle: 'ATIS',
|
|
360
|
+
scripts: ['160-atis.lua'],
|
|
361
|
+
timing: 26,
|
|
362
|
+
color: '0xff0000ff',
|
|
363
|
+
fromLibrary: true
|
|
196
364
|
});
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
// injection des fichiers son Misc si repertoire resources/sounds/Misc present
|
|
201
|
-
await jtffci.mizlib.updateWorkspaceWithSingleSoundFolder(workspacePath, 'Misc');
|
|
202
|
-
await jtffci.mizlib.injectSingleSoundFolderIntoZipObject(mizObject,workspacePath, 'Misc', true);
|
|
203
|
-
// insertion des Librairies JTFF dans la file d'attente
|
|
365
|
+
}
|
|
366
|
+
// injection des scripts A2A dans la file d'attente
|
|
367
|
+
if ((/^y\b|o\b|yes\b|oui\b/i).test(promptResult.inject_A2A)) {
|
|
204
368
|
settingsArray.push(
|
|
205
369
|
{
|
|
206
|
-
file: "settings-
|
|
370
|
+
file: "settings-capzone.lua",
|
|
371
|
+
objectName: "TrainingCAPConfig"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
file: "settings-capwarzone.lua",
|
|
375
|
+
objectName: "WarCAPConfig"
|
|
207
376
|
},
|
|
208
377
|
{
|
|
209
|
-
file: "settings-
|
|
378
|
+
file: "settings-foxzone.lua",
|
|
379
|
+
objectName: "FoxRangesConfig"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
file: "settings-RAT.lua",
|
|
383
|
+
objectName: "RATConfig"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
file: "settings-intercept.lua",
|
|
387
|
+
objectName: "InterceptConfig"
|
|
210
388
|
},
|
|
211
389
|
);
|
|
212
|
-
|
|
213
|
-
folder: '
|
|
214
|
-
scriptTitle: '
|
|
215
|
-
scripts: ['
|
|
216
|
-
timing:
|
|
217
|
-
color: '
|
|
390
|
+
scriptsArray.push({
|
|
391
|
+
folder: 'src',
|
|
392
|
+
scriptTitle: 'Air To Air',
|
|
393
|
+
scripts: ['170-cap_zone_training.lua', '172-cap_zone_war.lua', '173-fox_zone_training.lua', '176-random_air_traffic.lua', '178-training-intercept.lua'],
|
|
394
|
+
timing: 27,
|
|
395
|
+
color: '0xff0000ff',
|
|
396
|
+
fromLibrary: true
|
|
218
397
|
});
|
|
219
|
-
|
|
398
|
+
}
|
|
399
|
+
// injection des CTLD dans la file d'attente
|
|
400
|
+
if ((/^y\b|o\b|yes\b|oui\b/i).test(promptResult.inject_Logistics)) {
|
|
401
|
+
// injection des fichiers son CTLD
|
|
402
|
+
await ciObject.mizlib.updateWorkspaceWithSingleSoundFolder(workspacePath, 'CTLD');
|
|
403
|
+
await ciObject.mizlib.injectSingleSoundFolderIntoZipObject(mizObject,workspacePath, 'CTLD', true);
|
|
404
|
+
settingsArray.push(
|
|
405
|
+
{
|
|
406
|
+
file: "settings-logistics.lua",
|
|
407
|
+
objectName: "CTLDConfig"
|
|
408
|
+
},
|
|
409
|
+
);
|
|
410
|
+
scriptsArray.push({
|
|
220
411
|
folder: 'src',
|
|
221
|
-
scriptTitle: '
|
|
222
|
-
scripts: ['
|
|
223
|
-
timing:
|
|
224
|
-
color: '
|
|
412
|
+
scriptTitle: 'Logistics',
|
|
413
|
+
scripts: ['180-logistics.lua'],
|
|
414
|
+
timing: 28,
|
|
415
|
+
color: '0xff0000ff',
|
|
416
|
+
fromLibrary: true
|
|
225
417
|
});
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
418
|
+
}
|
|
419
|
+
// injection des scripts A2G dans la file d'attente
|
|
420
|
+
if ((/^y\b|o\b|yes\b|oui\b/i).test(promptResult.inject_A2G)) {
|
|
421
|
+
// injection des fichiers son Range
|
|
422
|
+
await ciObject.mizlib.updateWorkspaceWithSingleSoundFolder(workspacePath, 'RANGE');
|
|
423
|
+
await ciObject.mizlib.injectSingleSoundFolderIntoZipObject(mizObject,workspacePath, 'RANGE', true);
|
|
424
|
+
settingsArray.push(
|
|
425
|
+
{
|
|
426
|
+
file: "settings-ranges.lua",
|
|
427
|
+
objectName: "RangeConfig"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
file: "settings-sams.lua",
|
|
431
|
+
objectName: "SamsConfig"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
file: "settings-training_ranges.lua",
|
|
435
|
+
objectName: "TrainingRangeConfig"
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
file: "settings-reapers.lua",
|
|
439
|
+
objectName: "OnDemandReapersConfig"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
file: "settings-fac_ranges.lua",
|
|
443
|
+
objectName: "FACRangeConfig"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
file: "settings-skynet.lua",
|
|
447
|
+
objectName: "SkynetConfig"
|
|
448
|
+
},
|
|
449
|
+
);
|
|
245
450
|
scriptsArray.push({
|
|
246
451
|
folder: 'src',
|
|
247
|
-
scriptTitle: '
|
|
248
|
-
scripts: ['
|
|
249
|
-
timing:
|
|
452
|
+
scriptTitle: 'Air To Ground',
|
|
453
|
+
scripts: ['190-ranges.lua', '191-sams.lua', '193-training_ranges.lua', '195-reaper-ondemand.lua', '196-fac_ranges.lua', '199-skynet.lua'],
|
|
454
|
+
timing: 29,
|
|
250
455
|
color: '0xff0000ff',
|
|
251
456
|
fromLibrary: true
|
|
252
457
|
});
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
// injection des Airboss et Pedros dans la file d'attente
|
|
275
|
-
if ((/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_airboss)) {
|
|
276
|
-
// injection des fichiers son Airboss
|
|
277
|
-
await jtffci.mizlib.updateWorkspaceWithSingleSoundFolder(workspacePath, 'AIRBOSS');
|
|
278
|
-
await jtffci.mizlib.injectSingleSoundFolderIntoZipObject(mizObject,workspacePath, 'AIRBOSS', true);
|
|
279
|
-
settingsArray.push(
|
|
280
|
-
{
|
|
281
|
-
file: "settings-airboss.lua",
|
|
282
|
-
objectName: "AirBossConfig"
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
file: "settings-pedros.lua",
|
|
286
|
-
objectName: "PedrosConfig"
|
|
287
|
-
},
|
|
288
|
-
);
|
|
289
|
-
scriptsArray.push({
|
|
290
|
-
folder: 'src',
|
|
291
|
-
scriptTitle: 'Airboss',
|
|
292
|
-
scripts: ['130-airboss.lua', '135-pedro.lua'],
|
|
293
|
-
timing: 23,
|
|
294
|
-
color: '0xff0000ff',
|
|
295
|
-
fromLibrary: true
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
// injection des Beacons dans la file d'attente
|
|
299
|
-
if ((/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_beacons)) {
|
|
300
|
-
settingsArray.push(
|
|
301
|
-
{
|
|
302
|
-
file: "settings-beacons.lua",
|
|
303
|
-
objectName: "BeaconsConfig"
|
|
304
|
-
},
|
|
305
|
-
);
|
|
306
|
-
scriptsArray.push({
|
|
307
|
-
folder: 'src',
|
|
308
|
-
scriptTitle: 'Beacons',
|
|
309
|
-
scripts: ['140-beacons.lua'],
|
|
310
|
-
timing: 24,
|
|
311
|
-
color: '0xff0000ff',
|
|
312
|
-
fromLibrary: true
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
// injection des AWACS et OnDemandAwacs dans la file d'attente
|
|
316
|
-
if ((/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_awacs)) {
|
|
317
|
-
settingsArray.push(
|
|
318
|
-
{
|
|
319
|
-
file: "settings-awacs.lua",
|
|
320
|
-
objectName: "AwacsConfig"
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
file: "settings-awacsondemand.lua",
|
|
324
|
-
objectName: "AwacsOnDemandConfig"
|
|
325
|
-
},
|
|
326
|
-
);
|
|
327
|
-
scriptsArray.push({
|
|
328
|
-
folder: 'src',
|
|
329
|
-
scriptTitle: 'Awacs',
|
|
330
|
-
scripts: ['150-awacs.lua'],
|
|
331
|
-
timing: 25,
|
|
332
|
-
color: '0xff0000ff',
|
|
333
|
-
fromLibrary: true
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
// injection des ATIS dans la file d'attente
|
|
337
|
-
if ((/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_atis)) {
|
|
338
|
-
// injection des fichiers son ATIS
|
|
339
|
-
await jtffci.mizlib.updateWorkspaceWithSingleSoundFolder(workspacePath, 'ATIS');
|
|
340
|
-
await jtffci.mizlib.injectSingleSoundFolderIntoZipObject(mizObject,workspacePath, 'ATIS', true);
|
|
341
|
-
settingsArray.push(
|
|
342
|
-
{
|
|
343
|
-
file: "settings-atis.lua",
|
|
344
|
-
objectName: "AtisConfig"
|
|
345
|
-
},
|
|
346
|
-
);
|
|
347
|
-
scriptsArray.push({
|
|
348
|
-
folder: 'src',
|
|
349
|
-
scriptTitle: 'ATIS',
|
|
350
|
-
scripts: ['160-atis.lua'],
|
|
351
|
-
timing: 26,
|
|
352
|
-
color: '0xff0000ff',
|
|
353
|
-
fromLibrary: true
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
// injection des scripts A2A dans la file d'attente
|
|
357
|
-
if ((/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_A2A)) {
|
|
358
|
-
settingsArray.push(
|
|
359
|
-
{
|
|
360
|
-
file: "settings-capzone.lua",
|
|
361
|
-
objectName: "TrainingCAPConfig"
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
file: "settings-capwarzone.lua",
|
|
365
|
-
objectName: "WarCAPConfig"
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
file: "settings-foxzone.lua",
|
|
369
|
-
objectName: "FoxRangesConfig"
|
|
370
|
-
},
|
|
371
|
-
{
|
|
372
|
-
file: "settings-RAT.lua",
|
|
373
|
-
objectName: "RATConfig"
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
file: "settings-intercept.lua",
|
|
377
|
-
objectName: "InterceptConfig"
|
|
378
|
-
},
|
|
379
|
-
);
|
|
380
|
-
scriptsArray.push({
|
|
381
|
-
folder: 'src',
|
|
382
|
-
scriptTitle: 'Air To Air',
|
|
383
|
-
scripts: ['170-cap_zone_training.lua', '172-cap_zone_war.lua', '173-fox_zone_training.lua', '176-random_air_traffic.lua', '178-training-intercept.lua'],
|
|
384
|
-
timing: 27,
|
|
385
|
-
color: '0xff0000ff',
|
|
386
|
-
fromLibrary: true
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
// injection des CTLD dans la file d'attente
|
|
390
|
-
if ((/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_Logistics)) {
|
|
391
|
-
// injection des fichiers son CTLD
|
|
392
|
-
await jtffci.mizlib.updateWorkspaceWithSingleSoundFolder(workspacePath, 'CTLD');
|
|
393
|
-
await jtffci.mizlib.injectSingleSoundFolderIntoZipObject(mizObject,workspacePath, 'CTLD', true);
|
|
394
|
-
settingsArray.push(
|
|
395
|
-
{
|
|
396
|
-
file: "settings-logistics.lua",
|
|
397
|
-
objectName: "CTLDConfig"
|
|
398
|
-
},
|
|
399
|
-
);
|
|
400
|
-
scriptsArray.push({
|
|
401
|
-
folder: 'src',
|
|
402
|
-
scriptTitle: 'Logistics',
|
|
403
|
-
scripts: ['180-logistics.lua'],
|
|
404
|
-
timing: 28,
|
|
405
|
-
color: '0xff0000ff',
|
|
406
|
-
fromLibrary: true
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
// injection des scripts A2G dans la file d'attente
|
|
410
|
-
if ((/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_A2G)) {
|
|
411
|
-
// injection des fichiers son Range
|
|
412
|
-
await jtffci.mizlib.updateWorkspaceWithSingleSoundFolder(workspacePath, 'RANGE');
|
|
413
|
-
await jtffci.mizlib.injectSingleSoundFolderIntoZipObject(mizObject,workspacePath, 'RANGE', true);
|
|
414
|
-
settingsArray.push(
|
|
415
|
-
{
|
|
416
|
-
file: "settings-ranges.lua",
|
|
417
|
-
objectName: "RangeConfig"
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
file: "settings-sams.lua",
|
|
421
|
-
objectName: "SamsConfig"
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
file: "settings-training_ranges.lua",
|
|
425
|
-
objectName: "TrainingRangeConfig"
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
file: "settings-reapers.lua",
|
|
429
|
-
objectName: "OnDemandReapersConfig"
|
|
430
|
-
},
|
|
431
|
-
{
|
|
432
|
-
file: "settings-fac_ranges.lua",
|
|
433
|
-
objectName: "FACRangeConfig"
|
|
434
|
-
},
|
|
435
|
-
{
|
|
436
|
-
file: "settings-skynet.lua",
|
|
437
|
-
objectName: "SkynetConfig"
|
|
438
|
-
},
|
|
439
|
-
);
|
|
440
|
-
scriptsArray.push({
|
|
441
|
-
folder: 'src',
|
|
442
|
-
scriptTitle: 'Air To Ground',
|
|
443
|
-
scripts: ['190-ranges.lua', '191-sams.lua', '193-training_ranges.lua', '195-reaper-ondemand.lua', '196-fac_ranges.lua', '199-skynet.lua'],
|
|
444
|
-
timing: 29,
|
|
445
|
-
color: '0xff0000ff',
|
|
446
|
-
fromLibrary: true
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
// injection du script spécifique de mission dans la file d'attente
|
|
450
|
-
if ((/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_mission)) {
|
|
451
|
-
scriptsArray.push({
|
|
452
|
-
folder: 'src',
|
|
453
|
-
scriptTitle: 'Mission specific',
|
|
454
|
-
scripts: ['200-mission.lua'],
|
|
455
|
-
timing: 30,
|
|
456
|
-
color: '0xff0000ff',
|
|
457
|
-
fromLibrary: false
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
// traitement de la file d'attente des scripts (injection des triggers et des fichiers lua)
|
|
461
|
-
for ( script of scriptsArray) {
|
|
462
|
-
console.log(['adding script',script.scripts.join(' and '),'from',workspacePath + '/' + script.folder, 'folder...'].join(' '));
|
|
463
|
-
let {tuple, zipObject} = await jtffci.mizlib.injectLuaScriptIntoZipObjectAndUpdateWorkspace(
|
|
464
|
-
workspacePath,
|
|
465
|
-
script.folder,
|
|
466
|
-
script.scripts,
|
|
467
|
-
script.scriptTitle,
|
|
468
|
-
mizObject,
|
|
469
|
-
script.timing,
|
|
470
|
-
script.color,
|
|
471
|
-
script.fromLibrary
|
|
472
|
-
);
|
|
473
|
-
missionObject['trig'] = tuple.tObject;
|
|
474
|
-
missionObject['trigrules'] = tuple.trObject;
|
|
475
|
-
mapResourceObject = _.merge(mapResourceObject,tuple.mrObject);
|
|
476
|
-
mizObject = zipObject;
|
|
477
|
-
}
|
|
478
|
-
// injection des preset radio dans les avions humains
|
|
479
|
-
if ((/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_radio_presets)) {
|
|
480
|
-
// injection des preset radio
|
|
481
|
-
fs.mkdirSync(workspacePath + '/resources/radios/' + missionObject.theatre,{recursive: true});
|
|
482
|
-
jtffci.mizlib.copyRecursiveSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/radios/' + missionObject.theatre,workspacePath + '/resources/radios/' + missionObject.theatre);
|
|
483
|
-
// fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/radios/' + missionObject.theatre,workspacePath + '/resources/radios/' + missionObject.theatre,{recursive: true})
|
|
484
|
-
console.log(destinationMizFilePath + ": injecting radio presets declared in resources/radios/" + missionObject.theatre);
|
|
485
|
-
await jtffci.mizlib.injectRadioPresetsFromFolderIntoZipObject(mizObject, workspacePath + '/resources/radios/' + missionObject.theatre);
|
|
486
|
-
}
|
|
487
|
-
// traitement de la file d'attente des settings (injection des triggers et des fichiers lua)
|
|
488
|
-
if (settingsArray.length > 0) {
|
|
489
|
-
console.log(['adding settings files',settingsArray.map(a => a.file).join(' and '),'from',workspacePath + '/settings', 'folder...'].join(' '));
|
|
490
|
-
let {tuple, zipObject} = await jtffci.mizlib.injectLuaScriptIntoZipObjectAndUpdateWorkspace(
|
|
491
|
-
workspacePath,
|
|
492
|
-
'settings',
|
|
493
|
-
settingsArray.map(a => a.file),
|
|
494
|
-
'Mission Settings',
|
|
495
|
-
mizObject,
|
|
496
|
-
15,
|
|
497
|
-
'0xffff00ff',
|
|
498
|
-
false
|
|
499
|
-
);
|
|
500
|
-
missionObject['trig'] = tuple.tObject;
|
|
501
|
-
missionObject['trigrules'] = tuple.trObject;
|
|
502
|
-
mapResourceObject = _.merge(mapResourceObject,tuple.mrObject);
|
|
503
|
-
mizObject = zipObject;
|
|
504
|
-
}
|
|
505
|
-
// réintégration du fichier mission dans l'archive
|
|
506
|
-
await jtffci.mizlib.injectMissionObjectIntoZipObject(
|
|
458
|
+
}
|
|
459
|
+
// injection du script spécifique de mission dans la file d'attente
|
|
460
|
+
if ((/^y\b|o\b|yes\b|oui\b/i).test(promptResult.inject_mission)) {
|
|
461
|
+
scriptsArray.push({
|
|
462
|
+
folder: 'src',
|
|
463
|
+
scriptTitle: 'Mission specific',
|
|
464
|
+
scripts: ['200-mission.lua'],
|
|
465
|
+
timing: 30,
|
|
466
|
+
color: '0xff0000ff',
|
|
467
|
+
fromLibrary: false
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
// traitement de la file d'attente des scripts (injection des triggers et des fichiers lua)
|
|
471
|
+
for ( script of scriptsArray) {
|
|
472
|
+
console.log(['adding script',script.scripts.join(' and '),'from',workspacePath + '/' + script.folder, 'folder...'].join(' '));
|
|
473
|
+
let {tuple, zipObject} = await ciObject.mizlib.injectLuaScriptIntoZipObjectAndUpdateWorkspace(
|
|
474
|
+
workspacePath,
|
|
475
|
+
script.folder,
|
|
476
|
+
script.scripts,
|
|
477
|
+
script.scriptTitle,
|
|
507
478
|
mizObject,
|
|
508
|
-
|
|
479
|
+
script.timing,
|
|
480
|
+
script.color,
|
|
481
|
+
script.fromLibrary
|
|
509
482
|
);
|
|
510
|
-
|
|
483
|
+
missionObject['trig'] = tuple.tObject;
|
|
484
|
+
missionObject['trigrules'] = tuple.trObject;
|
|
485
|
+
mapResourceObject = _.merge(mapResourceObject,tuple.mrObject);
|
|
486
|
+
mizObject = zipObject;
|
|
487
|
+
}
|
|
488
|
+
// injection des preset radio dans les avions humains
|
|
489
|
+
if ((/^y\b|o\b|yes\b|oui\b/i).test(promptResult.inject_radio_presets)) {
|
|
490
|
+
// injection des preset radio
|
|
491
|
+
fs.mkdirSync(workspacePath + '/resources/radios/' + missionObject.theatre,{recursive: true});
|
|
492
|
+
ciObject.mizlib.copyRecursiveSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/radios/' + missionObject.theatre,workspacePath + '/resources/radios/' + missionObject.theatre);
|
|
493
|
+
// fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/radios/' + missionObject.theatre,workspacePath + '/resources/radios/' + missionObject.theatre,{recursive: true})
|
|
494
|
+
console.log(destinationMizFilePath + ": injecting radio presets declared in resources/radios/" + missionObject.theatre);
|
|
495
|
+
await ciObject.mizlib.injectRadioPresetsFromFolderIntoZipObject(mizObject, workspacePath + '/resources/radios/' + missionObject.theatre);
|
|
496
|
+
}
|
|
497
|
+
// traitement de la file d'attente des settings (injection des triggers et des fichiers lua)
|
|
498
|
+
if (settingsArray.length > 0) {
|
|
499
|
+
console.log(['adding settings files',settingsArray.map(a => a.file).join(' and '),'from',workspacePath + '/settings', 'folder...'].join(' '));
|
|
500
|
+
let {tuple, zipObject} = await ciObject.mizlib.injectLuaScriptIntoZipObjectAndUpdateWorkspace(
|
|
501
|
+
workspacePath,
|
|
502
|
+
'settings',
|
|
503
|
+
settingsArray.map(a => a.file),
|
|
504
|
+
'Mission Settings',
|
|
511
505
|
mizObject,
|
|
512
|
-
|
|
506
|
+
15,
|
|
507
|
+
'0xffff00ff',
|
|
508
|
+
false
|
|
513
509
|
);
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
510
|
+
missionObject['trig'] = tuple.tObject;
|
|
511
|
+
missionObject['trigrules'] = tuple.trObject;
|
|
512
|
+
mapResourceObject = _.merge(mapResourceObject,tuple.mrObject);
|
|
513
|
+
mizObject = zipObject;
|
|
514
|
+
}
|
|
515
|
+
// réintégration du fichier mission dans l'archive
|
|
516
|
+
await ciObject.mizlib.injectMissionObjectIntoZipObject(
|
|
517
|
+
mizObject,
|
|
518
|
+
{ mission: missionObject }
|
|
519
|
+
);
|
|
520
|
+
await ciObject.mizlib.injectMapResourceObjectIntoZipObject(
|
|
521
|
+
mizObject,
|
|
522
|
+
{ mapResource: mapResourceObject }
|
|
523
|
+
);
|
|
524
|
+
// creation du fichier miz dans l'espace de travail
|
|
525
|
+
// await fs.closeSync(fs.openSync(destinationMizFilePath, 'a'));
|
|
526
|
+
// On fait une sauvegarde dans le folder de destination
|
|
527
|
+
fs.writeFileSync(destinationMizFilePath, await mizObject.generateAsync({
|
|
528
|
+
type: 'nodebuffer',
|
|
529
|
+
streamFiles: true,
|
|
530
|
+
compression: "DEFLATE",
|
|
531
|
+
compressionOptions: {
|
|
532
|
+
level: 9
|
|
533
|
+
}
|
|
534
|
+
}));
|
|
535
|
+
// generation des outils CI JTFF
|
|
536
|
+
await ciObject.deployCIScriptsFromZipObjectIntoWorkspace(workspacePath, mizObject, sourceMizFileName);
|
|
537
|
+
console.log('...Done...');
|
|
538
|
+
return 0;
|
|
530
539
|
}
|
|
531
540
|
|
|
532
|
-
module.exports = injectScripts;
|
|
541
|
+
module.exports = {injectScripts,createSkel, doInject};
|