@jtff/miztemplate-lib 3.1.0 → 3.1.2
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/lib/mizlib.js +21 -4
- package/lua/lib/Moose_.lua +1923 -94
- package/package.json +1 -1
- package/scripts/inject-scripts.js +6 -0
package/lib/mizlib.js
CHANGED
|
@@ -126,17 +126,17 @@ class Mizlib {
|
|
|
126
126
|
const zipObject = await this.getZipObjectFromMizPath(mizPath);
|
|
127
127
|
const missionObject = await this.getMissionObjectFromZipObject(zipObject);
|
|
128
128
|
const strTheatreSettings = missionObject.theatre;
|
|
129
|
-
const
|
|
129
|
+
const srcFilesFromMizLib = fs.readdirSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + "/lua/src",{recursive: true})
|
|
130
130
|
.filter(filename => path.extname(filename).toLowerCase()==='.lua' && !(filename.startsWith('200-')));
|
|
131
|
-
const
|
|
131
|
+
const libFilesFromMizLib = fs.readdirSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + "/lua/lib",{recursive: true})
|
|
132
132
|
.filter(filename => path.extname(filename).toLowerCase()==='.lua');
|
|
133
|
-
for (let file of
|
|
133
|
+
for (let file of srcFilesFromMizLib) {
|
|
134
134
|
console.log('updating src/' + file + ' from the miztemplate-lib');
|
|
135
135
|
fs.copyFileSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/lua/src/' + file,
|
|
136
136
|
'.workspace/src/' + file
|
|
137
137
|
);
|
|
138
138
|
}
|
|
139
|
-
for (let file of
|
|
139
|
+
for (let file of libFilesFromMizLib) {
|
|
140
140
|
console.log('updating lib/' + file + ' from the miztemplate-lib');
|
|
141
141
|
fs.copyFileSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/lua/lib/' + file,
|
|
142
142
|
'.workspace/lib/' + file
|
|
@@ -146,6 +146,9 @@ class Mizlib {
|
|
|
146
146
|
this.injectLuaFilesFromFolderIntoZipObject(zipObject, '.workspace/lib', mizSettingSubFolder);
|
|
147
147
|
this.injectLuaFilesFromFolderIntoZipObject(zipObject, ['src',mizSettingSubFolder.length > 0 ? '/' + mizSettingSubFolder : ''].join(''), mizSettingSubFolder);
|
|
148
148
|
await this.injectRadioPresetsFromFolderIntoZipObject(zipObject, 'resources/radios/' + strTheatreSettings);
|
|
149
|
+
zipObject.remove('KNEEBOARD');
|
|
150
|
+
await this.injectKneeboardsFromFolderIntoZipObject(zipObject, 'resources/kneeboards/common');
|
|
151
|
+
await this.injectKneeboardsFromFolderIntoZipObject(zipObject, 'resources/kneeboards/' + mizSettingSubFolder);
|
|
149
152
|
this.injectSettingsLuaFilesFromFolderIntoZipObject(zipObject, mizSettingSubFolder.length > 0 ? mizSettingSubFolder : '');
|
|
150
153
|
await this.injectSoundFoldersIntoZipObject(zipObject);
|
|
151
154
|
const inputZip = await zipObject.generateAsync({
|
|
@@ -320,6 +323,20 @@ class Mizlib {
|
|
|
320
323
|
this.injectMissionObjectIntoZipObject(zip, {mission: mission_object});
|
|
321
324
|
}
|
|
322
325
|
|
|
326
|
+
async injectKneeboardsFromFolderIntoZipObject(zip, kneeboardsFolder){
|
|
327
|
+
console.log('adding kneeboards from folder ' + kneeboardsFolder);
|
|
328
|
+
for (let file of fs.readdirSync(kneeboardsFolder)) {
|
|
329
|
+
const fileStats = await lstat(kneeboardsFolder + '/' + file)
|
|
330
|
+
const isDirectory = fileStats.isDirectory()
|
|
331
|
+
if (isDirectory) {
|
|
332
|
+
await this.addFilesToZip(
|
|
333
|
+
zip.folder(['KNEEBOARD/', file, '/IMAGES/'].join('')),
|
|
334
|
+
[kneeboardsFolder,'/', file].join(''),
|
|
335
|
+
fs.readdirSync([kneeboardsFolder,'/', file].join('')));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
323
340
|
injectSettingsLuaFilesFromFolderIntoZipObject(zip, settingsSubFolder) {
|
|
324
341
|
for (let file of fs.readdirSync(['settings',settingsSubFolder.length > 0 ? '/' + settingsSubFolder : ''].join('')).filter(file => path.extname(file).toLowerCase()==='.lua')) {
|
|
325
342
|
console.log(['updating settings',settingsSubFolder.length > 0 ? '/' + settingsSubFolder : '','/',file,' file in miz file'].join(''));
|