@jtff/miztemplate-lib 3.0.0-rc8 → 3.0.0
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/ci/build.js +6 -0
- package/ci/clean.js +4 -0
- package/ci/ftpupload.js +6 -0
- package/ci/gdrive-upload.js +6 -0
- package/ci/get-mizfiles.js +6 -0
- package/ci/getset-version.js +10 -0
- package/ci/inject-scripts.js +5 -0
- package/ci/prepare-nextversion.js +5 -0
- package/ci/release.js +5 -0
- package/ci/template-update.js +5 -0
- package/lib/jtff-lib-ci.js +72 -1
- package/lib/mizlib.js +157 -41
- package/lua/src/199-skynet.lua +1 -1
- package/package.json +5 -2
- package/resources/radios/Caucasus/354th-caucasus.lua +124 -0
- package/resources/radios/Caucasus/494th-caucasus.lua +91 -0
- package/resources/radios/Caucasus/79th-SUFA-caucasus.lua +65 -0
- package/resources/radios/Caucasus/79th-caucasus.lua +65 -0
- package/resources/radios/Caucasus/ec25-D-caucasus.lua +65 -0
- package/resources/radios/Caucasus/ec25-caucasus.lua +65 -0
- package/resources/radios/Caucasus/vf84-a-caucasus.lua +75 -0
- package/resources/radios/Caucasus/vf84-b-caucasus.lua +75 -0
- package/resources/radios/Caucasus/vfa-131-caucasus.lua +65 -0
- package/resources/radios/Caucasus/vmfa-314-caucasus.lua +65 -0
- package/resources/radios/Mariana/354th-marianas.lua +124 -0
- package/resources/radios/Mariana/494th-marianas.lua +91 -0
- package/resources/radios/Mariana/79th-marianas.lua +65 -0
- package/resources/radios/Mariana/ec25-marianas.lua +65 -0
- package/resources/radios/Mariana/vf84-a-marianas.lua +75 -0
- package/resources/radios/Mariana/vf84-b-marianas.lua +75 -0
- package/resources/radios/Mariana/vfa-131-marianas.lua +65 -0
- package/resources/radios/Mariana/vmfa-314-marianas.lua +65 -0
- package/resources/radios/NTTR/354th-nttr.lua +124 -0
- package/resources/radios/NTTR/494th-nttr.lua +91 -0
- package/resources/radios/NTTR/79th-nttr.lua +65 -0
- package/resources/radios/NTTR/ec25-nttr.lua +65 -0
- package/resources/radios/NTTR/vf84-a-nttr.lua +75 -0
- package/resources/radios/NTTR/vf84-b-nttr.lua +75 -0
- package/resources/radios/NTTR/vfa-131-nttr.lua +65 -0
- package/resources/radios/NTTR/vmfa-314-nttr.lua +65 -0
- package/resources/radios/PersianGulf/354th-persian.lua +124 -0
- package/resources/radios/PersianGulf/3_30-persian.lua +65 -0
- package/resources/radios/PersianGulf/494th-persian.lua +91 -0
- package/resources/radios/PersianGulf/79th-persian.lua +65 -0
- package/resources/radios/PersianGulf/ec25-persian.lua +65 -0
- package/resources/radios/PersianGulf/vf84-a-persian.lua +75 -0
- package/resources/radios/PersianGulf/vf84-b-persian.lua +75 -0
- package/resources/radios/PersianGulf/vfa-131-persian.lua +65 -0
- package/resources/radios/PersianGulf/vmfa-314-persian.lua +65 -0
- package/resources/radios/SinaiMap/354th-sinai.lua +124 -0
- package/resources/radios/SinaiMap/494th-sinai.lua +91 -0
- package/resources/radios/SinaiMap/79th-SUFA-sinai.lua +65 -0
- package/resources/radios/SinaiMap/79th-sinai.lua +65 -0
- package/resources/radios/SinaiMap/ec25-D-sinai.lua +65 -0
- package/resources/radios/SinaiMap/ec25-sinai.lua +65 -0
- package/resources/radios/SinaiMap/vf84-a-sinai.lua +75 -0
- package/resources/radios/SinaiMap/vf84-b-sinai.lua +75 -0
- package/resources/radios/SinaiMap/vfa-131-sinai.lua +65 -0
- package/resources/radios/SinaiMap/vmfa-314-sinai.lua +65 -0
- package/resources/radios/Syria/354th-syria.lua +124 -0
- package/resources/radios/Syria/494th-syria.lua +91 -0
- package/resources/radios/Syria/79th-SUFA-syria.lua +65 -0
- package/resources/radios/Syria/79th-syria.lua +65 -0
- package/resources/radios/Syria/ec25-D-syria.lua +65 -0
- package/resources/radios/Syria/ec25-syria.lua +65 -0
- package/resources/radios/Syria/vf84-a-syria.lua +75 -0
- package/resources/radios/Syria/vf84-b-syria.lua +75 -0
- package/resources/radios/Syria/vfa-131-syria.lua +65 -0
- package/resources/radios/Syria/vmfa-314-syria.lua +65 -0
- package/scripts/build.js +15 -17
- package/scripts/inject-scripts.js +273 -354
- package/scripts/template-update.js +50 -32
- package/resources/radios/.gitkeep +0 -0
package/ci/build.js
ADDED
package/ci/clean.js
ADDED
package/ci/ftpupload.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const templatelib = require('@jtff/miztemplate-lib');
|
|
2
|
+
|
|
3
|
+
const config = require("../../../config.json");
|
|
4
|
+
const jtffci = new templatelib.MizTemplateCI(config);
|
|
5
|
+
|
|
6
|
+
if (process.argv.slice(2).length > 0) {
|
|
7
|
+
templatelib.setVersion(jtffci, process.argv.slice(2)[0], "./config.json");
|
|
8
|
+
} else {
|
|
9
|
+
templatelib.getVersion(jtffci);
|
|
10
|
+
}
|
package/ci/release.js
ADDED
package/lib/jtff-lib-ci.js
CHANGED
|
@@ -5,6 +5,7 @@ const path = require("path");
|
|
|
5
5
|
const { google } = require("googleapis");
|
|
6
6
|
const ftpClient = require('ftp');
|
|
7
7
|
const Mizlib = require("./mizlib");
|
|
8
|
+
const { getInstalledPathSync } = require('get-installed-path')
|
|
8
9
|
|
|
9
10
|
class MizTemplateCI{
|
|
10
11
|
constructor(config) {
|
|
@@ -59,7 +60,7 @@ class MizTemplateCI{
|
|
|
59
60
|
return newVersionObject;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
getDestinationMizFilePathArrayFromConfig() {
|
|
63
64
|
const returnArray = this.config.missionTemplates.map(missionTemplate => {
|
|
64
65
|
return this.config.general.missionFolder + '/'
|
|
65
66
|
+ this.config.general.missionPrefix + '_'
|
|
@@ -70,6 +71,16 @@ class MizTemplateCI{
|
|
|
70
71
|
return returnArray;
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
getDestinationMizFilePathFromConfigMissionTemplate(missionTemplate) {
|
|
75
|
+
const destinationMizPath = [this.config.general.missionFolder + '/',
|
|
76
|
+
this.config.general.missionPrefix + '_',
|
|
77
|
+
missionTemplate.theatre + '_',
|
|
78
|
+
this.config.general.missionSuffix.length > 0 ? this.config.general.missionSuffix + '_' : '',
|
|
79
|
+
this.config.general.missionVersion + '.miz'].join('')
|
|
80
|
+
;
|
|
81
|
+
return destinationMizPath;
|
|
82
|
+
}
|
|
83
|
+
|
|
73
84
|
getGeneratedMizFilePaths() {
|
|
74
85
|
return fs.readdirSync(this.config.general.missionFolder + '/')
|
|
75
86
|
.filter(file => file.endsWith((".miz")))
|
|
@@ -187,6 +198,66 @@ class MizTemplateCI{
|
|
|
187
198
|
}
|
|
188
199
|
});
|
|
189
200
|
}
|
|
201
|
+
|
|
202
|
+
async generateConfigJsonFileFromZipObject(zip,filename) {
|
|
203
|
+
let theatreString = (await this.mizlib.getMissionObjectFromZipObject(zip)).theatre;
|
|
204
|
+
return {
|
|
205
|
+
"general": {
|
|
206
|
+
"missionFolder": "dist",
|
|
207
|
+
"missionPrefix": path.parse(filename).name,
|
|
208
|
+
"missionSuffix": "",
|
|
209
|
+
"missionVersion": "1.0.0-snapshot"
|
|
210
|
+
},
|
|
211
|
+
"google": {
|
|
212
|
+
"scopes": [
|
|
213
|
+
"https://www.googleapis.com/auth/drive"
|
|
214
|
+
],
|
|
215
|
+
"tokenPath": "dist/gtoken.json"
|
|
216
|
+
},
|
|
217
|
+
"missionTemplates": [
|
|
218
|
+
{
|
|
219
|
+
"theatre": theatreString,
|
|
220
|
+
"filename": filename,
|
|
221
|
+
"destFolderId": "1pK_0I2iEzhEiqWicu8hsX7VPZuKGnKoW"
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
async generatePackageJsonFile(missionName) {
|
|
228
|
+
return {
|
|
229
|
+
"name": missionName,
|
|
230
|
+
"version": "1.0.0-snapshot",
|
|
231
|
+
"description": "build jtff-style missions",
|
|
232
|
+
"main": "none",
|
|
233
|
+
"scripts": {
|
|
234
|
+
"build": "node .workspace/src/nodejs/build.js",
|
|
235
|
+
"clean": "node .workspace/src/nodejs/clean.js",
|
|
236
|
+
"template-update": "node .workspace/src/nodejs/template-update.js",
|
|
237
|
+
"nextversion-prepare": "node .workspace/src/nodejs/prepare-nextversion.js",
|
|
238
|
+
"version": "node .workspace/src/nodejs/getset-version.js",
|
|
239
|
+
"release": "node .workspace/src/nodejs/release.js",
|
|
240
|
+
"getmiz": "node .workspace/src/nodejs/get-mizfiles.js",
|
|
241
|
+
"gdrive-upload": "node .workspace/src/nodejs/gdrive-upload.js",
|
|
242
|
+
"ftp-upload": "node .workspace/src/nodejs/ftpupload.js"
|
|
243
|
+
},
|
|
244
|
+
"author": "Sebastien LONGO",
|
|
245
|
+
"license": "GPL-3.0-or-later",
|
|
246
|
+
"dependencies": {
|
|
247
|
+
"@jtff/miztemplate-lib": "latest"
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
async InjectCiScriptsIntoWorkspace(workspacePath) {
|
|
253
|
+
fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/ci',workspacePath + '/.workspace/src/nodejs',{recursive: true});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
async deployCIScriptsFromZipObjectIntoWorkspace(workspacePath, mizObject, mizFilePath) {
|
|
257
|
+
fs.writeFileSync(workspacePath + '/config.json', JSON.stringify(await this.generateConfigJsonFileFromZipObject(mizObject, path.basename(mizFilePath)), null, 4));
|
|
258
|
+
fs.writeFileSync(workspacePath + '/package.json', JSON.stringify(await this.generatePackageJsonFile(path.parse(mizFilePath).name), null, 4));
|
|
259
|
+
await this.InjectCiScriptsIntoWorkspace(workspacePath);
|
|
260
|
+
}
|
|
190
261
|
}
|
|
191
262
|
|
|
192
263
|
|
package/lib/mizlib.js
CHANGED
|
@@ -5,11 +5,61 @@ const path = require("path");
|
|
|
5
5
|
const {format, parse} = require("lua-json");
|
|
6
6
|
const {promisify} = require("util");
|
|
7
7
|
const fs = require("fs");
|
|
8
|
+
const {getInstalledPathSync} = require("get-installed-path");
|
|
8
9
|
const lstat = promisify(fs.lstat);
|
|
9
10
|
|
|
10
11
|
class Mizlib {
|
|
11
12
|
constructor() {
|
|
12
|
-
|
|
13
|
+
// no need for initialization
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async injectLuaScriptIntoZipObjectAndUpdateWorkspace(workspacePath, folderPath, luaScriptsArray, titleString, zipObject, timing, colorString, fromLibrary=true) {
|
|
17
|
+
let missionObject = await this.getMissionObjectFromZipObject(zipObject);
|
|
18
|
+
let mapResourceObject = await this.getMapResourceObjectFromZipObject(zipObject);
|
|
19
|
+
let tuple = this.injectLuaScriptAndUpdateWorkspace(workspacePath, folderPath, luaScriptsArray, titleString, missionObject, mapResourceObject, timing, colorString, fromLibrary);
|
|
20
|
+
for (let luaScript of luaScriptsArray) {
|
|
21
|
+
this.injectFileIntoZipObject(zipObject, [
|
|
22
|
+
workspacePath,
|
|
23
|
+
fromLibrary ? "/.workspace/" : "/",
|
|
24
|
+
folderPath,
|
|
25
|
+
"/",
|
|
26
|
+
path.basename(luaScript)
|
|
27
|
+
].join("")
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return {tuple, zipObject};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
injectLuaScriptAndUpdateWorkspace(workspacePath, folderPath, luaScriptsArray, titleString, missionObject, mapResourceObject, timing, colorString ,fromLibrary=true) {
|
|
34
|
+
let tuple = this.injectLuaScriptsInMissionObject(
|
|
35
|
+
missionObject['trig'],
|
|
36
|
+
missionObject['trigrules'],
|
|
37
|
+
mapResourceObject,
|
|
38
|
+
titleString,
|
|
39
|
+
luaScriptsArray,
|
|
40
|
+
timing,
|
|
41
|
+
colorString
|
|
42
|
+
);
|
|
43
|
+
for (let luaScript of luaScriptsArray) {
|
|
44
|
+
fs.cpSync(
|
|
45
|
+
[
|
|
46
|
+
getInstalledPathSync('@jtff/miztemplate-lib',{local: true}),
|
|
47
|
+
'/lua/',
|
|
48
|
+
folderPath,
|
|
49
|
+
'/',
|
|
50
|
+
luaScript
|
|
51
|
+
].join(""),
|
|
52
|
+
[
|
|
53
|
+
workspacePath,
|
|
54
|
+
fromLibrary ? "/.workspace/" : "/",
|
|
55
|
+
folderPath,
|
|
56
|
+
"/",
|
|
57
|
+
path.basename(luaScript)
|
|
58
|
+
].join(""),
|
|
59
|
+
{force: true}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return tuple;
|
|
13
63
|
}
|
|
14
64
|
|
|
15
65
|
injectLuaScriptsInMissionObject(tObject, trObject, mrObject, strTitle, scriptFilesArray, timingInSeconds, hexColor) {
|
|
@@ -60,19 +110,35 @@ class Mizlib {
|
|
|
60
110
|
return MizFile.loadAsync(mizData);
|
|
61
111
|
}
|
|
62
112
|
|
|
63
|
-
async
|
|
64
|
-
const
|
|
65
|
-
this.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
113
|
+
async buildMizFileFromMizTemplate(mizPath, copyPath, mizSettingSubFolder= '') {
|
|
114
|
+
const zipObject = await this.getZipObjectFromMizPath(mizPath);
|
|
115
|
+
const missionObject = await this.getMissionObjectFromZipObject(zipObject);
|
|
116
|
+
const strTheatreSettings = missionObject.theatre;
|
|
117
|
+
const srcFiles = fs.readdirSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + "/lua/src",{recursive: true})
|
|
118
|
+
.filter(filename => path.extname(filename).toLowerCase()==='.lua' && !(filename.startsWith('200-')));
|
|
119
|
+
const libFiles = fs.readdirSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + "/lua/lib",{recursive: true})
|
|
120
|
+
.filter(filename => path.extname(filename).toLowerCase()==='.lua');
|
|
121
|
+
for (let file of srcFiles) {
|
|
122
|
+
console.log('updating src/' + file + ' from the miztemplate-lib');
|
|
123
|
+
fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/lua/src/' + file,
|
|
124
|
+
'.workspace/src/' + file,
|
|
125
|
+
{force: true}
|
|
126
|
+
);
|
|
72
127
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
128
|
+
for (let file of libFiles) {
|
|
129
|
+
console.log('updating lib/' + file + ' from the miztemplate-lib');
|
|
130
|
+
fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/lua/lib/' + file,
|
|
131
|
+
'.workspace/lib/' + file,
|
|
132
|
+
{force: true}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
this.injectLuaFilesFromFolderIntoZipObject(zipObject, '.workspace/src', mizSettingSubFolder);
|
|
136
|
+
this.injectLuaFilesFromFolderIntoZipObject(zipObject, '.workspace/lib', mizSettingSubFolder);
|
|
137
|
+
this.injectLuaFilesFromFolderIntoZipObject(zipObject, ['src',mizSettingSubFolder.length > 0 ? '/' + mizSettingSubFolder : ''].join(''), mizSettingSubFolder);
|
|
138
|
+
await this.injectRadioPresetsFromFolderIntoZipObject(zipObject, 'resources/radios/' + strTheatreSettings);
|
|
139
|
+
this.injectSettingsLuaFilesFromFolderIntoZipObject(zipObject, mizSettingSubFolder.length > 0 ? mizSettingSubFolder : '');
|
|
140
|
+
await this.injectSoundFoldersIntoZipObject(zipObject);
|
|
141
|
+
const inputZip = await zipObject.generateAsync({
|
|
76
142
|
type: 'nodebuffer',
|
|
77
143
|
streamFiles: true,
|
|
78
144
|
compression: "DEFLATE",
|
|
@@ -83,9 +149,8 @@ class Mizlib {
|
|
|
83
149
|
fs.writeFileSync(copyPath ? copyPath : mizPath, inputZip);
|
|
84
150
|
}
|
|
85
151
|
|
|
86
|
-
async
|
|
87
|
-
const zip = await this.getZipObjectFromMizPath(mizPath);
|
|
88
|
-
this.mizUpdateMissionDataFile(zip, missionObject);
|
|
152
|
+
async injectMissionObjectIntoMizFile(mizPath, missionObject) {
|
|
153
|
+
const zip = this.injectMissionObjectIntoZipObject(await this.getZipObjectFromMizPath(mizPath), missionObject);
|
|
89
154
|
const inputZip = await zip.generateAsync({
|
|
90
155
|
type: 'nodebuffer',
|
|
91
156
|
streamFiles: true,
|
|
@@ -121,9 +186,9 @@ class Mizlib {
|
|
|
121
186
|
}
|
|
122
187
|
|
|
123
188
|
|
|
124
|
-
async
|
|
189
|
+
async injectMapResourceObjectIntoMizFile(mizPath, mapResourceObject) {
|
|
125
190
|
const zip = await this.getZipObjectFromMizPath(mizPath);
|
|
126
|
-
this.
|
|
191
|
+
this.injectMapResourceObjectIntoZipObject(zip, mapResourceObject);
|
|
127
192
|
const inputZip = await zip.generateAsync({
|
|
128
193
|
type: 'nodebuffer',
|
|
129
194
|
streamFiles: true,
|
|
@@ -141,7 +206,7 @@ class Mizlib {
|
|
|
141
206
|
zip.file("l10n/DEFAULT/" + path.basename(filePath), stream);
|
|
142
207
|
}
|
|
143
208
|
|
|
144
|
-
|
|
209
|
+
injectMissionObjectIntoZipObject(zip, missionObject) {
|
|
145
210
|
zip.remove("mission");
|
|
146
211
|
let missionLuaT = format(missionObject, {singleQuote: false})
|
|
147
212
|
missionLuaT = missionLuaT
|
|
@@ -153,7 +218,7 @@ class Mizlib {
|
|
|
153
218
|
zip.file("mission", missionLuaT);
|
|
154
219
|
}
|
|
155
220
|
|
|
156
|
-
|
|
221
|
+
injectMapResourceObjectIntoZipObject(zip, mapResourceObject) {
|
|
157
222
|
zip.remove("l10n/DEFAULT/mapResource");
|
|
158
223
|
let mapResourceLuaT = format(mapResourceObject, {singleQuote: false})
|
|
159
224
|
mapResourceLuaT = mapResourceLuaT
|
|
@@ -173,16 +238,15 @@ class Mizlib {
|
|
|
173
238
|
return zipStream.file("l10n/DEFAULT/mapResource").async("string");
|
|
174
239
|
}
|
|
175
240
|
|
|
176
|
-
injectLuaFilesFromFolderIntoZipObject(zip, folderPath) {
|
|
241
|
+
injectLuaFilesFromFolderIntoZipObject(zip, folderPath, mizSettingSubFolder) {
|
|
177
242
|
for (let file of fs.readdirSync(folderPath).filter(file => file.endsWith(".lua"))) {
|
|
178
|
-
console.log('injecting up2date ' + folderPath + '/' + file + ' file in archive');
|
|
243
|
+
console.log('injecting up2date ' + folderPath + '/' + file + ' file in ' + mizSettingSubFolder + ' archive');
|
|
179
244
|
this.injectFileIntoZipObject(zip, folderPath + "/" + file);
|
|
180
|
-
}
|
|
181
|
-
;
|
|
245
|
+
};
|
|
182
246
|
}
|
|
183
247
|
|
|
184
248
|
|
|
185
|
-
async
|
|
249
|
+
async injectRadioPresetsFromFolderIntoZipObject(zip, preset_folder) {
|
|
186
250
|
// Create folder Avionics to make sure it exists then delete it to remove any old preset in the template
|
|
187
251
|
// Allows adding presets for A-10C
|
|
188
252
|
zip.folder("Avionics");
|
|
@@ -243,31 +307,77 @@ class Mizlib {
|
|
|
243
307
|
}
|
|
244
308
|
}
|
|
245
309
|
};
|
|
246
|
-
this.
|
|
310
|
+
this.injectMissionObjectIntoZipObject(zip, {mission: mission_object});
|
|
247
311
|
}
|
|
248
312
|
|
|
249
|
-
|
|
250
|
-
for (let file of fs.readdirSync('settings/' +
|
|
251
|
-
console.log('updating settings
|
|
252
|
-
this.injectFileIntoZipObject(zip, 'settings
|
|
313
|
+
injectSettingsLuaFilesFromFolderIntoZipObject(zip, settingsSubFolder) {
|
|
314
|
+
for (let file of fs.readdirSync(['settings',settingsSubFolder.length > 0 ? '/' + settingsSubFolder : ''].join('')).filter(file => path.extname(file).toLowerCase()==='.lua')) {
|
|
315
|
+
console.log(['updating settings',settingsSubFolder.length > 0 ? '/' + settingsSubFolder : '','/',file,' file in miz file'].join(''));
|
|
316
|
+
this.injectFileIntoZipObject(zip, ['settings',settingsSubFolder.length > 0 ? '/' + settingsSubFolder : '','/',file].join(''));
|
|
253
317
|
}
|
|
254
|
-
;
|
|
255
318
|
}
|
|
256
319
|
|
|
257
|
-
async
|
|
320
|
+
async injectSoundFoldersIntoZipObject(zip) {
|
|
258
321
|
if (fs.existsSync('resources/sounds') && fs.lstatSync('resources/sounds').isDirectory()) {
|
|
259
|
-
|
|
322
|
+
await this.injectSingleSoundFolderIntoZipObject(zip, '.', 'resources/sounds', false);
|
|
323
|
+
}
|
|
324
|
+
if (fs.existsSync('.workspace/resources/sounds') && fs.lstatSync('.workspace/resources/sounds').isDirectory()) {
|
|
325
|
+
const folderArray = fs.readdirSync('.workspace/resources/sounds');
|
|
260
326
|
for (const folder of folderArray) {
|
|
261
|
-
await this.
|
|
327
|
+
await this.injectSingleSoundFolderIntoZipObject(zip, '.', folder, true);
|
|
262
328
|
}
|
|
263
329
|
}
|
|
264
330
|
}
|
|
265
331
|
|
|
266
|
-
async
|
|
267
|
-
if (
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
332
|
+
async updateWorkspaceWithSingleSoundFolder(workspacePath, folderString) {
|
|
333
|
+
if (
|
|
334
|
+
fs.existsSync(
|
|
335
|
+
[
|
|
336
|
+
workspacePath,
|
|
337
|
+
"/.workspace/resources/sounds/",
|
|
338
|
+
folderString
|
|
339
|
+
].join("")
|
|
340
|
+
) &&
|
|
341
|
+
fs.lstatSync([
|
|
342
|
+
workspacePath,
|
|
343
|
+
"/.workspace/resources/sounds/",
|
|
344
|
+
folderString
|
|
345
|
+
].join("")).isDirectory()
|
|
346
|
+
) {
|
|
347
|
+
fs.rmSync([
|
|
348
|
+
workspacePath,
|
|
349
|
+
"/.workspace/resources/sounds/",
|
|
350
|
+
folderString
|
|
351
|
+
].join(""), {recursive: true});
|
|
352
|
+
}
|
|
353
|
+
if (
|
|
354
|
+
fs.existsSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/sounds/' + folderString) &&
|
|
355
|
+
fs.lstatSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/sounds/' + folderString).isDirectory()) {
|
|
356
|
+
fs.mkdirSync([
|
|
357
|
+
workspacePath,
|
|
358
|
+
"/.workspace/resources/sounds/",
|
|
359
|
+
folderString
|
|
360
|
+
].join(""), {recursive: true});
|
|
361
|
+
fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/sounds/' + folderString,[
|
|
362
|
+
workspacePath,
|
|
363
|
+
"/.workspace/resources/sounds/",
|
|
364
|
+
folderString
|
|
365
|
+
].join(""), {recursive: true});
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
async injectSingleSoundFolderIntoZipObject(zip, workspacePath, folder, fromLibrary = true) {
|
|
370
|
+
if (
|
|
371
|
+
fs.existsSync([workspacePath,fromLibrary? '/.workspace/resources/sounds/'+folder : '/resources/sounds'].join('')) &&
|
|
372
|
+
fs.lstatSync([workspacePath,fromLibrary? '/.workspace/resources/sounds/'+folder : '/resources/sounds'].join('')).isDirectory()) {
|
|
373
|
+
console.log(['adding sound files from ',workspacePath,fromLibrary? '/.workspace/resources/sounds/'+folder : '/resources/sounds',' folder...'].join(''));
|
|
374
|
+
if (fromLibrary) {
|
|
375
|
+
zip = zip.remove(folder).folder(folder);
|
|
376
|
+
}
|
|
377
|
+
await this.addFilesToZip(
|
|
378
|
+
zip,
|
|
379
|
+
[workspacePath,fromLibrary? '/.workspace/resources/sounds/'+folder : '/resources/sounds'].join(''),
|
|
380
|
+
fs.readdirSync([workspacePath,fromLibrary? '/.workspace/resources/sounds/'+folder : '/resources/sounds'].join('')));
|
|
271
381
|
}
|
|
272
382
|
}
|
|
273
383
|
|
|
@@ -314,8 +424,14 @@ class Mizlib {
|
|
|
314
424
|
|
|
315
425
|
async getMapResourceObjectFromZipObject(zip) {
|
|
316
426
|
let luaTable = 'return { \n' + await this.getMapResourceLuaStringFromZipObject(zip) + ' }';
|
|
317
|
-
|
|
427
|
+
let mrObject = parse(luaTable).mapResource;
|
|
428
|
+
if (Array.isArray(mrObject)) {
|
|
429
|
+
if (mrObject.length === 0) {
|
|
430
|
+
mrObject = {};
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return mrObject;
|
|
318
434
|
}
|
|
319
435
|
}
|
|
320
436
|
|
|
321
|
-
module.exports = Mizlib
|
|
437
|
+
module.exports = Mizlib;
|
package/lua/src/199-skynet.lua
CHANGED
|
@@ -568,7 +568,7 @@ function manageIADSNetworkMenu(networkRootMenu, iadsconfig, IADSObjectIndex)
|
|
|
568
568
|
deactivateSkynet,
|
|
569
569
|
{ iadsconfig, IADSObjectIndex, networkRootMenu }
|
|
570
570
|
)
|
|
571
|
-
--TODO: A tweaker pour que les objets skynets
|
|
571
|
+
--TODO: A tweaker pour que les objets skynets soient basés sur la coalition et non sur la mission globale
|
|
572
572
|
if (type(iadsconfig.gci) == "table") then
|
|
573
573
|
local CommandGCIActivate = MENU_MISSION_COMMAND:New(
|
|
574
574
|
"GCI Activation",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jtff/miztemplate-lib",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "JTFF mission template library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"scripts",
|
|
9
9
|
"lib",
|
|
10
10
|
"lua",
|
|
11
|
-
"resources"
|
|
11
|
+
"resources",
|
|
12
|
+
"ci"
|
|
12
13
|
],
|
|
13
14
|
"scripts": {
|
|
14
15
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -31,8 +32,10 @@
|
|
|
31
32
|
"homepage": "https://github.com/JTFF-mission-scripts/miztemplate-lib#readme",
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"ftp": "^0.3.10",
|
|
35
|
+
"get-installed-path": "^4.0.8",
|
|
34
36
|
"googleapis": "^92.0.0",
|
|
35
37
|
"jszip": "^3.10.1",
|
|
38
|
+
"lodash": "^4.17.21",
|
|
36
39
|
"lua-json": "^1.0.1",
|
|
37
40
|
"path": "^0.12.7",
|
|
38
41
|
"prompt": "^1.3.0",
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
descriptor = {
|
|
2
|
+
aircraft = "A-10C_2",
|
|
3
|
+
group_name = "([354])"
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
radio_descriptor_table = {
|
|
7
|
+
[1] = -- ARC-210
|
|
8
|
+
{
|
|
9
|
+
["modulations"] =
|
|
10
|
+
{
|
|
11
|
+
[1] = 0,
|
|
12
|
+
[2] = 0,
|
|
13
|
+
[3] = 0,
|
|
14
|
+
[4] = 0,
|
|
15
|
+
[5] = 0,
|
|
16
|
+
[6] = 0,
|
|
17
|
+
[7] = 0,
|
|
18
|
+
[8] = 0,
|
|
19
|
+
[9] = 0,
|
|
20
|
+
[10] = 0,
|
|
21
|
+
[11] = 0,
|
|
22
|
+
[12] = 0,
|
|
23
|
+
[13] = 0,
|
|
24
|
+
[14] = 0,
|
|
25
|
+
[15] = 0,
|
|
26
|
+
[16] = 0,
|
|
27
|
+
[17] = 0,
|
|
28
|
+
[18] = 0,
|
|
29
|
+
[19] = 0,
|
|
30
|
+
[20] = 0,
|
|
31
|
+
[21] = 1,
|
|
32
|
+
[22] = 1,
|
|
33
|
+
[23] = 1,
|
|
34
|
+
[24] = 1,
|
|
35
|
+
[25] = 1,
|
|
36
|
+
}, -- end of ["modulations"]
|
|
37
|
+
["channels"] =
|
|
38
|
+
{
|
|
39
|
+
[1] = 133.250,
|
|
40
|
+
[2] = 133.500,
|
|
41
|
+
[3] = 133.750,
|
|
42
|
+
[4] = 133.950,
|
|
43
|
+
[5] = 126.600,
|
|
44
|
+
[6] = 134.100,
|
|
45
|
+
[7] = 132.650,
|
|
46
|
+
[8] = 131.250,
|
|
47
|
+
[9] = 131.500,
|
|
48
|
+
[10] = 135.250,
|
|
49
|
+
[11] = 135.500,
|
|
50
|
+
[12] = 139.250,
|
|
51
|
+
[13] = 139.500,
|
|
52
|
+
[14] = 136.250,
|
|
53
|
+
[15] = 136.500,
|
|
54
|
+
[16] = 137.250,
|
|
55
|
+
[17] = 137.500,
|
|
56
|
+
[18] = 125.000,
|
|
57
|
+
[19] = 130.250,
|
|
58
|
+
[20] = 121.500,
|
|
59
|
+
[21] = 54.000,
|
|
60
|
+
[22] = 32.500,
|
|
61
|
+
[23] = 42.000,
|
|
62
|
+
[24] = 37.500,
|
|
63
|
+
[25] = 54.000,
|
|
64
|
+
}, -- end of ["channels"]
|
|
65
|
+
}, -- end of [1]
|
|
66
|
+
[2] = -- ARC-164
|
|
67
|
+
{
|
|
68
|
+
["modulations"] =
|
|
69
|
+
{
|
|
70
|
+
}, -- end of ["modulations"]
|
|
71
|
+
["channels"] =
|
|
72
|
+
{
|
|
73
|
+
[1] = 360.100,
|
|
74
|
+
[2] = 360.200,
|
|
75
|
+
[3] = 360.300,
|
|
76
|
+
[4] = 360.400,
|
|
77
|
+
[5] = 377.800,
|
|
78
|
+
[6] = 265.800,
|
|
79
|
+
[7] = 261.000,
|
|
80
|
+
[8] = 261.500,
|
|
81
|
+
[9] = 276.200,
|
|
82
|
+
[10] = 317.500,
|
|
83
|
+
[11] = 360.200,
|
|
84
|
+
[12] = 251.200,
|
|
85
|
+
[13] = 263.100,
|
|
86
|
+
[14] = 327.100,
|
|
87
|
+
[15] = 250.250,
|
|
88
|
+
[16] = 250.500,
|
|
89
|
+
[17] = 251.750,
|
|
90
|
+
[18] = 309.000,
|
|
91
|
+
[19] = 274.500,
|
|
92
|
+
[20] = 243.000
|
|
93
|
+
}, -- end of ["channels"]
|
|
94
|
+
}, -- end of [2]
|
|
95
|
+
[3] = -- ARC-186
|
|
96
|
+
{
|
|
97
|
+
["modulations"] =
|
|
98
|
+
{
|
|
99
|
+
}, -- end of ["modulations"]
|
|
100
|
+
["channels"] =
|
|
101
|
+
{
|
|
102
|
+
[1] = 35.400,
|
|
103
|
+
[2] = 35.450,
|
|
104
|
+
[3] = 35.500,
|
|
105
|
+
[4] = 35.550,
|
|
106
|
+
[5] = 35.500,
|
|
107
|
+
[6] = 31.501,
|
|
108
|
+
[7] = 31.502,
|
|
109
|
+
[8] = 31.503,
|
|
110
|
+
[9] = 31.504,
|
|
111
|
+
[10] = 31.505,
|
|
112
|
+
[11] = 31.506,
|
|
113
|
+
[12] = 31.507,
|
|
114
|
+
[13] = 31.508,
|
|
115
|
+
[14] = 31.509,
|
|
116
|
+
[15] = 31.510,
|
|
117
|
+
[16] = 31.511,
|
|
118
|
+
[17] = 31.512,
|
|
119
|
+
[18] = 31.513,
|
|
120
|
+
[19] = 31.514,
|
|
121
|
+
[20] = 87.500
|
|
122
|
+
}, -- end of ["channels"]
|
|
123
|
+
}, -- end of [3]
|
|
124
|
+
} -- end of ["Radio"]
|