@jtff/miztemplate-lib 3.9.2 → 3.10.1
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 +70 -0
- package/package.json +4 -4
- package/resources/config/View/Server.lua +165 -0
- package/resources/config/View/SnapViews.lua +4421 -0
- package/resources/config/View/SnapViewsDefault.lua +1519 -0
- package/resources/config/View/View.lua +145 -0
- package/scripts/inject-scripts.js +9 -0
package/lib/mizlib.js
CHANGED
|
@@ -151,6 +151,7 @@ class Mizlib {
|
|
|
151
151
|
await this.injectKneeboardsFromFolderIntoZipObject(zipObject, 'resources/kneeboards/' + mizSettingSubFolder);
|
|
152
152
|
this.injectSettingsLuaFilesFromFolderIntoZipObject(zipObject, mizSettingSubFolder.length > 0 ? mizSettingSubFolder : '');
|
|
153
153
|
await this.injectSoundFoldersIntoZipObject(zipObject);
|
|
154
|
+
await this.injectConfigFoldersIntoZipObject(zipObject);
|
|
154
155
|
const inputZip = await zipObject.generateAsync({
|
|
155
156
|
type: 'nodebuffer',
|
|
156
157
|
streamFiles: true,
|
|
@@ -356,6 +357,18 @@ class Mizlib {
|
|
|
356
357
|
}
|
|
357
358
|
}
|
|
358
359
|
|
|
360
|
+
async injectConfigFoldersIntoZipObject(zip) {
|
|
361
|
+
if (fs.existsSync('resources/config') && fs.lstatSync('resources/config').isDirectory()) {
|
|
362
|
+
await this.injectSingleConfigFolderIntoZipObject(zip, '.', 'resources/config', false);
|
|
363
|
+
}
|
|
364
|
+
if (fs.existsSync('.workspace/resources/config') && fs.lstatSync('.workspace/resources/config').isDirectory()) {
|
|
365
|
+
const folderArray = fs.readdirSync('.workspace/resources/config');
|
|
366
|
+
for (const folder of folderArray) {
|
|
367
|
+
await this.injectSingleConfigFolderIntoZipObject(zip, '.', folder, true);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
359
372
|
copyRecursiveSync(src, dest) {
|
|
360
373
|
let self = this;
|
|
361
374
|
let exists = fs.existsSync(src);
|
|
@@ -415,6 +428,48 @@ class Mizlib {
|
|
|
415
428
|
}
|
|
416
429
|
}
|
|
417
430
|
|
|
431
|
+
async updateWorkspaceWithSingleConfigFolder(workspacePath, folderString) {
|
|
432
|
+
if (
|
|
433
|
+
fs.existsSync(
|
|
434
|
+
[
|
|
435
|
+
workspacePath,
|
|
436
|
+
"/.workspace/resources/config/",
|
|
437
|
+
folderString
|
|
438
|
+
].join("")
|
|
439
|
+
) &&
|
|
440
|
+
fs.lstatSync([
|
|
441
|
+
workspacePath,
|
|
442
|
+
"/.workspace/resources/config/",
|
|
443
|
+
folderString
|
|
444
|
+
].join("")).isDirectory()
|
|
445
|
+
) {
|
|
446
|
+
fs.rmSync([
|
|
447
|
+
workspacePath,
|
|
448
|
+
"/.workspace/resources/config/",
|
|
449
|
+
folderString
|
|
450
|
+
].join(""), {recursive: true});
|
|
451
|
+
}
|
|
452
|
+
if (
|
|
453
|
+
fs.existsSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/config/' + folderString) &&
|
|
454
|
+
fs.lstatSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/config/' + folderString).isDirectory()) {
|
|
455
|
+
fs.mkdirSync([
|
|
456
|
+
workspacePath,
|
|
457
|
+
"/.workspace/resources/config/",
|
|
458
|
+
folderString
|
|
459
|
+
].join(""), {recursive: true});
|
|
460
|
+
this.copyRecursiveSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/config/' + folderString,[
|
|
461
|
+
workspacePath,
|
|
462
|
+
"/.workspace/resources/config/",
|
|
463
|
+
folderString
|
|
464
|
+
].join(""));
|
|
465
|
+
// fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/config/' + folderString,[
|
|
466
|
+
// workspacePath,
|
|
467
|
+
// "/.workspace/resources/config/",
|
|
468
|
+
// folderString
|
|
469
|
+
// ].join(""), {recursive: true});
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
418
473
|
async injectSingleSoundFolderIntoZipObject(zip, workspacePath, folder, fromLibrary = true) {
|
|
419
474
|
if (
|
|
420
475
|
fs.existsSync([workspacePath,fromLibrary? '/.workspace/resources/sounds/'+folder : '/resources/sounds'].join('')) &&
|
|
@@ -430,6 +485,21 @@ class Mizlib {
|
|
|
430
485
|
}
|
|
431
486
|
}
|
|
432
487
|
|
|
488
|
+
async injectSingleConfigFolderIntoZipObject(zip, workspacePath, folder, fromLibrary = true) {
|
|
489
|
+
if (
|
|
490
|
+
fs.existsSync([workspacePath,fromLibrary? '/.workspace/resources/config/'+folder : '/resources/config'].join('')) &&
|
|
491
|
+
fs.lstatSync([workspacePath,fromLibrary? '/.workspace/resources/config/'+folder : '/resources/config'].join('')).isDirectory()) {
|
|
492
|
+
console.log(['adding config files from ',workspacePath,fromLibrary? '/.workspace/resources/config/'+folder : '/resources/config',' folder...'].join(''));
|
|
493
|
+
if (fromLibrary) {
|
|
494
|
+
zip = zip.remove('Config/' + folder).folder('Config/' + folder);
|
|
495
|
+
}
|
|
496
|
+
await this.addFilesToZip(
|
|
497
|
+
zip,
|
|
498
|
+
[workspacePath,fromLibrary? '/.workspace/resources/config/'+folder : '/resources/config'].join(''),
|
|
499
|
+
fs.readdirSync([workspacePath,fromLibrary? '/.workspace/resources/config/'+folder : '/resources/config'].join('')));
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
433
503
|
async addFilesToZip(zip, directoryPath, filesToInclude) {
|
|
434
504
|
const promiseArr = await filesToInclude.map(async file => {
|
|
435
505
|
const filePath = path.join(directoryPath, file)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jtff/miztemplate-lib",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.1",
|
|
4
4
|
"description": "JTFF mission template library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "https://gitlab.com/
|
|
19
|
+
"url": "https://gitlab.platform.klanik.com/open-source/jtff/miztemplate-lib.git"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [
|
|
22
22
|
"DCS",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"author": "Sebastien LONGO",
|
|
28
28
|
"license": "GPL-3.0-or-later",
|
|
29
29
|
"bugs": {
|
|
30
|
-
"url": "https://gitlab.com/
|
|
30
|
+
"url": "https://gitlab.platform.klanik.com/open-source/jtff/miztemplate-lib/-/issues"
|
|
31
31
|
},
|
|
32
|
-
"homepage": "https://gitlab.com/
|
|
32
|
+
"homepage": "https://gitlab.platform.klanik.com/open-source/jtff/miztemplate-lib",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"ftp": "^0.3.10",
|
|
35
35
|
"get-installed-path": "^4.0.8",
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
-- View scripts
|
|
2
|
+
-- Copyright (C) 2004, Eagle Dynamics.
|
|
3
|
+
DisableCombatViews = false -- F5 & Ctrl-F5
|
|
4
|
+
ExternalObjectsLockDistance = 10000.0
|
|
5
|
+
ShowTargetInfo = false
|
|
6
|
+
CameraTerrainRestriction = false
|
|
7
|
+
hAngleRearDefault = 180
|
|
8
|
+
vAngleRearDefault = -8.0
|
|
9
|
+
vAngleRearMin = -90 -- -8.0
|
|
10
|
+
vAngleRearMax = 90.0
|
|
11
|
+
|
|
12
|
+
--reformatted per-unit data to be mod system friendly
|
|
13
|
+
--this file is no longer should be edited for adding new flyable aircraft , DCS automatically check core database (i.e. where you define your aircraft in aircraft table just define ViewSettings and SnapViews tables)
|
|
14
|
+
|
|
15
|
+
function default_fighter_player(t)
|
|
16
|
+
local res = {
|
|
17
|
+
CameraViewAngleLimits = {20.000000,140.000000},
|
|
18
|
+
CameraAngleRestriction = {false ,90.000000,0.500000},
|
|
19
|
+
EyePoint = {0.05 ,0.000000 ,0.000000},
|
|
20
|
+
limits_6DOF = {x = {-0.050000,0.4500000},y ={-0.300000,0.100000},z = {-0.220000,0.220000},roll = 90.000000},
|
|
21
|
+
Allow360rotation = false,
|
|
22
|
+
CameraAngleLimits = {200,-80.000000,110.000000},
|
|
23
|
+
ShoulderSize = 0.2, -- move body when azimuth value more then 90 degrees
|
|
24
|
+
}
|
|
25
|
+
if t then
|
|
26
|
+
for i,o in pairs(t) do
|
|
27
|
+
res[i] = o
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
return res
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
function fulcrum()
|
|
34
|
+
return {
|
|
35
|
+
Cockpit = {
|
|
36
|
+
default_fighter_player({CockpitLocalPoint = {4.71,1.28,0.000000}})
|
|
37
|
+
},
|
|
38
|
+
Chase = {
|
|
39
|
+
LocalPoint = {1.220000,3.750000,0.000000},
|
|
40
|
+
AnglesDefault = {180.000000,-8.000000},
|
|
41
|
+
}, -- Chase
|
|
42
|
+
Arcade = {
|
|
43
|
+
LocalPoint = {-15.080000,6.350000,0.000000},
|
|
44
|
+
AnglesDefault = {0.000000,-8.000000},
|
|
45
|
+
}, -- Arcade
|
|
46
|
+
}
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
ViewSettings = {}
|
|
50
|
+
ViewSettings["A-10A"] = {
|
|
51
|
+
Cockpit = {
|
|
52
|
+
[1] = default_fighter_player({CockpitLocalPoint = {4.300000,1.282000,0.000000},
|
|
53
|
+
EyePoint = {0.000000,0.000000,0.000000},
|
|
54
|
+
limits_6DOF = {x = {-0.050000,0.600000},
|
|
55
|
+
y = {-0.300000,0.100000},
|
|
56
|
+
z = {-0.250000,0.250000},
|
|
57
|
+
roll = 90.000000}}),
|
|
58
|
+
}, -- Cockpit
|
|
59
|
+
Chase = {
|
|
60
|
+
LocalPoint = {0.600000,3.682000,0.000000},
|
|
61
|
+
AnglesDefault = {180.000000,-8.000000},
|
|
62
|
+
}, -- Chase
|
|
63
|
+
Arcade = {
|
|
64
|
+
LocalPoint = {-27.000000,12.000000,0.000000},
|
|
65
|
+
AnglesDefault = {0.000000,-12.000000},
|
|
66
|
+
}, -- Arcade
|
|
67
|
+
}
|
|
68
|
+
ViewSettings["F-15C"] = {
|
|
69
|
+
Cockpit = {
|
|
70
|
+
[1] = default_fighter_player({CockpitLocalPoint = {6.210000,1.204000,0.000000}})-- player slot 1
|
|
71
|
+
}, -- Cockpit
|
|
72
|
+
Chase = {
|
|
73
|
+
LocalPoint = {2.510000,3.604000,0.000000},
|
|
74
|
+
AnglesDefault = {180.000000,-8.000000},
|
|
75
|
+
}, -- Chase
|
|
76
|
+
Arcade = {
|
|
77
|
+
LocalPoint = {-13.790000,6.204000,0.000000},
|
|
78
|
+
AnglesDefault = {0.000000,-8.000000},
|
|
79
|
+
}, -- Arcade
|
|
80
|
+
}
|
|
81
|
+
ViewSettings["Ka-50"] = {
|
|
82
|
+
Cockpit = {
|
|
83
|
+
[1] = {-- player slot 1
|
|
84
|
+
CockpitLocalPoint = {3.188000,0.390000,0.000000},
|
|
85
|
+
CameraViewAngleLimits = {20.000000,120.000000},
|
|
86
|
+
CameraAngleRestriction = {false,60.000000,0.400000},
|
|
87
|
+
CameraAngleLimits = {140.000000,-65.000000,90.000000},
|
|
88
|
+
EyePoint = {0.090000,0.000000,0.000000},
|
|
89
|
+
limits_6DOF = {x = {-0.020000,0.350000},y ={-0.150000,0.165000},z = {-0.170000,0.170000},roll = 90.000000},
|
|
90
|
+
},
|
|
91
|
+
}, -- Cockpit
|
|
92
|
+
Chase = {
|
|
93
|
+
LocalPoint = {-0.512000,2.790000,0.000000},
|
|
94
|
+
AnglesDefault = {180.000000,-8.000000},
|
|
95
|
+
}, -- Chase
|
|
96
|
+
Arcade = {
|
|
97
|
+
LocalPoint = {-16.812000,5.390000,0.000000},
|
|
98
|
+
AnglesDefault = {0.000000,-8.000000},
|
|
99
|
+
}, -- Arcade
|
|
100
|
+
}
|
|
101
|
+
ViewSettings["MiG-29A"] = fulcrum()
|
|
102
|
+
ViewSettings["MiG-29G"] = fulcrum()
|
|
103
|
+
ViewSettings["MiG-29S"] = fulcrum()
|
|
104
|
+
|
|
105
|
+
ViewSettings["Su-25"] = {
|
|
106
|
+
Cockpit = {
|
|
107
|
+
[1] = default_fighter_player({CockpitLocalPoint = {3.352000,0.506000,0.000000}}),-- player slot 1
|
|
108
|
+
}, -- Cockpit
|
|
109
|
+
Chase = {
|
|
110
|
+
LocalPoint = {-0.348000,2.906000,0.000000},
|
|
111
|
+
AnglesDefault = {180.000000,-8.000000},
|
|
112
|
+
}, -- Chase
|
|
113
|
+
Arcade = {
|
|
114
|
+
LocalPoint = {-16.648001,5.506000,0.000000},
|
|
115
|
+
AnglesDefault = {0.000000,-8.000000},
|
|
116
|
+
}, -- Arcade
|
|
117
|
+
}
|
|
118
|
+
ViewSettings["Su-25T"] = {
|
|
119
|
+
Cockpit = {
|
|
120
|
+
[1] = default_fighter_player({CockpitLocalPoint = {3.406000,0.466000,0.000000}}),-- player slot 1
|
|
121
|
+
}, -- Cockpit
|
|
122
|
+
Chase = {
|
|
123
|
+
LocalPoint = {-0.294000,2.866000,0.000000},
|
|
124
|
+
AnglesDefault = {180.000000,-8.000000},
|
|
125
|
+
}, -- Chase
|
|
126
|
+
Arcade = {
|
|
127
|
+
LocalPoint = {-16.594000,5.466000,0.000000},
|
|
128
|
+
AnglesDefault = {0.000000,-8.000000},
|
|
129
|
+
}, -- Arcade
|
|
130
|
+
}
|
|
131
|
+
ViewSettings["Su-25TM"] = {
|
|
132
|
+
Cockpit = {
|
|
133
|
+
[1] = {-- player slot 1
|
|
134
|
+
CockpitLocalPoint = {4.000000,1.000000,0.000000},
|
|
135
|
+
CameraViewAngleLimits = {20.000000,140.000000},
|
|
136
|
+
CameraAngleRestriction = {true,90.000000,0.400000},
|
|
137
|
+
CameraAngleLimits = {160.000000,-70.000000,90.000000},
|
|
138
|
+
EyePoint = {0.000000,0.000000,0.000000},
|
|
139
|
+
limits_6DOF = {x = {-0.200000,0.200000},y ={-0.200000,0.200000},z = {-0.200000,0.200000},roll = 60.000000},
|
|
140
|
+
},
|
|
141
|
+
}, -- Cockpit
|
|
142
|
+
Chase = {
|
|
143
|
+
LocalPoint = {4.000000,2.000000,0.000000},
|
|
144
|
+
AnglesDefault = {180.000000,-8.000000},
|
|
145
|
+
}, -- Chase
|
|
146
|
+
Arcade = {
|
|
147
|
+
LocalPoint = {4.000000,2.000000,0.000000},
|
|
148
|
+
AnglesDefault = {0.000000,-8.000000},
|
|
149
|
+
}, -- Arcade
|
|
150
|
+
}
|
|
151
|
+
ViewSettings["Su-27"] = {
|
|
152
|
+
Cockpit = {
|
|
153
|
+
[1] = default_fighter_player({CockpitLocalPoint = {7.959000,1.419000,0.000000}})-- player slot 1
|
|
154
|
+
}, -- Cockpit
|
|
155
|
+
Chase = {
|
|
156
|
+
LocalPoint = {4.259000,3.819000,0.000000},
|
|
157
|
+
AnglesDefault = {180.000000,-8.000000},
|
|
158
|
+
}, -- Chase
|
|
159
|
+
Arcade = {
|
|
160
|
+
LocalPoint = {-12.041000,6.419000,0.000000},
|
|
161
|
+
AnglesDefault = {0.000000,-8.000000},
|
|
162
|
+
}, -- Arcade
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
ViewSettings["Su-33"] = ViewSettings["Su-27"]
|