@jtff/miztemplate-lib 2.0.7 → 2.1.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/lib/jtff-lib-ci.js +22 -0
- package/package.json +1 -1
package/lib/jtff-lib-ci.js
CHANGED
|
@@ -233,6 +233,11 @@ class MizTemplateCI{
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
async mizUpdateRadioPresets(zip, preset_folder) {
|
|
236
|
+
// Create folder Avionics to make sure it exists then delete it to remove any old preset in the template
|
|
237
|
+
// Allows adding presets for A-10C
|
|
238
|
+
zip.folder("Avionics");
|
|
239
|
+
zip.remove("Avionics");
|
|
240
|
+
|
|
236
241
|
const mission_object = await this.getMissionObjectFromZip(zip);
|
|
237
242
|
for (let file of fs.readdirSync(preset_folder).filter(file => file.endsWith(".lua"))) {
|
|
238
243
|
const file_data = fs.readFileSync(preset_folder + '/' + file).toString();
|
|
@@ -260,6 +265,23 @@ class MizTemplateCI{
|
|
|
260
265
|
for (const sub_unit_key in unit) {
|
|
261
266
|
const sub_unit = unit[sub_unit_key];
|
|
262
267
|
if (sub_unit["skill"] != "Client") continue;
|
|
268
|
+
// Aircraft is an A10CII, use A10C mode by creating files in the root with the unit id
|
|
269
|
+
if (radio_descriptor_table["aircraft"] == 'A-10C_2') {
|
|
270
|
+
const unit_id = sub_unit["unitId"];
|
|
271
|
+
["UHF_RADIO", "VHF_AM_RADIO", "VHF_FM_RADIO"].forEach(folder => {
|
|
272
|
+
var zip_folder = zip.folder("Avionics/A-10C_2/" + unit_id + "/" + folder);
|
|
273
|
+
var file = parse("return " + dcs_radio_presets)[folder];
|
|
274
|
+
file = format(file, { singleQuote: false });
|
|
275
|
+
file = file
|
|
276
|
+
.split('\n')
|
|
277
|
+
.slice(1, -1)
|
|
278
|
+
.join('\n')
|
|
279
|
+
.slice(0, -1)
|
|
280
|
+
.replace(/\[\"(\d+)\"\] = /g, "[$1] = ");
|
|
281
|
+
zip_folder.file("SETTINGS.lua", file);
|
|
282
|
+
});
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
263
285
|
if (sub_unit["type"] != radio_descriptor_table["aircraft"]) continue;
|
|
264
286
|
// GROUP FOUND, SET RADIOS
|
|
265
287
|
sub_unit["Radio"] = parse("return " + dcs_radio_presets)
|