@fboes/aerofly-custom-missions 1.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/.editorconfig +12 -0
- package/.prettierignore +3 -0
- package/CHANGELOG.md +5 -0
- package/LICENSE.txt +9 -0
- package/README.md +144 -0
- package/dist/index.js +418 -0
- package/dist/index.test.js +107 -0
- package/docs/custom_missions_user.tmc +1287 -0
- package/eslint.config.js +31 -0
- package/package.json +35 -0
- package/src/index.test.ts +127 -0
- package/src/index.ts +613 -0
- package/tsconfig.json +19 -0
- package/types/index.d.ts +340 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.test.d.ts +2 -0
- package/types/index.test.d.ts.map +1 -0
package/eslint.config.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import pluginJs from "@eslint/js";
|
|
3
|
+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
4
|
+
import jsdoc from "eslint-plugin-jsdoc";
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
{
|
|
8
|
+
languageOptions: {
|
|
9
|
+
globals: {
|
|
10
|
+
...globals.browser,
|
|
11
|
+
...globals.node,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
pluginJs.configs.recommended,
|
|
16
|
+
eslintPluginPrettierRecommended,
|
|
17
|
+
jsdoc.configs["flat/recommended"],
|
|
18
|
+
{
|
|
19
|
+
files: ["**/*.js"],
|
|
20
|
+
plugins: {
|
|
21
|
+
jsdoc,
|
|
22
|
+
},
|
|
23
|
+
rules: {
|
|
24
|
+
"jsdoc/require-description": 0,
|
|
25
|
+
"jsdoc/require-param-description": 0,
|
|
26
|
+
"jsdoc/require-returns-description": 0,
|
|
27
|
+
"jsdoc/require-param-type": 0,
|
|
28
|
+
"jsdoc/require-returns-type": 0,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
];
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fboes/aerofly-custom-missions",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Builder for Aerofly FS4 Custom Missions Files",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "node ./dist/index.test.js",
|
|
8
|
+
"start": "node ./dist/index.js",
|
|
9
|
+
"prettier": "npx prettier --cache --write .",
|
|
10
|
+
"eslint": "npx eslint **/*.js --fix",
|
|
11
|
+
"tsc": "npx tsc --build",
|
|
12
|
+
"tsc-watch": "npx tsc --watch",
|
|
13
|
+
"build": "npm run eslint && npm run prettier && npm run tsc"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"aerofly-fs4",
|
|
17
|
+
"nodejs",
|
|
18
|
+
"browser"
|
|
19
|
+
],
|
|
20
|
+
"author": "Frank Boës <info@fboes.org> (https://3960.org/)",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@eslint/js": "^9.5.0",
|
|
25
|
+
"@types/node": "^20.14.2",
|
|
26
|
+
"eslint": "^9.5.0",
|
|
27
|
+
"eslint-config-prettier": "^9.1.0",
|
|
28
|
+
"eslint-plugin-jsdoc": "^48.2.12",
|
|
29
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
30
|
+
"globals": "^15.4.0",
|
|
31
|
+
"prettier": "3.3.2",
|
|
32
|
+
"typescript": "^5.4.5"
|
|
33
|
+
},
|
|
34
|
+
"types": "./types/index.d.ts"
|
|
35
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AeroflyMissionsList,
|
|
3
|
+
AeroflyMission,
|
|
4
|
+
AeroflyMissionConditions,
|
|
5
|
+
AeroflyMissionConditionsCloud,
|
|
6
|
+
AeroflyMissionCheckpoint,
|
|
7
|
+
} from "./index.js";
|
|
8
|
+
import { strict as assert } from "node:assert";
|
|
9
|
+
|
|
10
|
+
{
|
|
11
|
+
const mission = new AeroflyMission("Title");
|
|
12
|
+
assert.deepStrictEqual(mission.title, "Title");
|
|
13
|
+
console.log("✅ AeroflyMission test successful");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
{
|
|
17
|
+
const conditions = new AeroflyMissionConditions();
|
|
18
|
+
conditions.visibility = 15_000;
|
|
19
|
+
assert.deepStrictEqual(conditions.visibility, 15_000);
|
|
20
|
+
console.log("✅ AeroflyMissionConditions test successful");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
{
|
|
24
|
+
const cloud = new AeroflyMissionConditionsCloud(0, 0);
|
|
25
|
+
assert.deepStrictEqual(cloud.cover, 0);
|
|
26
|
+
assert.deepStrictEqual(cloud.base, 0);
|
|
27
|
+
console.log("✅ AeroflyMissionConditionsCloud test successful");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
{
|
|
31
|
+
const cloud = new AeroflyMissionConditionsCloud(1, 1000);
|
|
32
|
+
assert.deepStrictEqual(cloud.cover, 1);
|
|
33
|
+
assert.deepStrictEqual(cloud.base, 1000);
|
|
34
|
+
console.log("✅ AeroflyMissionConditionsCloud test successful");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
{
|
|
38
|
+
const conditions = new AeroflyMissionConditions({
|
|
39
|
+
time: new Date(Date.UTC(2024, 5, 14, 13, 15, 38)),
|
|
40
|
+
wind: {
|
|
41
|
+
direction: 190,
|
|
42
|
+
speed: 11,
|
|
43
|
+
gusts: 22,
|
|
44
|
+
},
|
|
45
|
+
turbulenceStrength: 1,
|
|
46
|
+
thermalStrength: 0.31200000000000006,
|
|
47
|
+
visibility: 14484.096000000001,
|
|
48
|
+
clouds: [
|
|
49
|
+
AeroflyMissionConditionsCloud.createInFeet(0.1, 5000),
|
|
50
|
+
AeroflyMissionConditionsCloud.createInFeet(0.2, 7500),
|
|
51
|
+
],
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const checkpoints = [
|
|
55
|
+
new AeroflyMissionCheckpoint("KCCR", "origin", -122.057, 37.9897, {
|
|
56
|
+
altitude: 8,
|
|
57
|
+
}),
|
|
58
|
+
new AeroflyMissionCheckpoint("19L", "departure_runway", -122.05504061196366, 37.993168229891225, {
|
|
59
|
+
length: 844.2959729825288,
|
|
60
|
+
}),
|
|
61
|
+
new AeroflyMissionCheckpoint("24", "destination_runway", -70.60730234370952, 41.399093035543366, {
|
|
62
|
+
altitude: 20,
|
|
63
|
+
length: 1677.6191463161874,
|
|
64
|
+
frequency: 108700000,
|
|
65
|
+
}),
|
|
66
|
+
new AeroflyMissionCheckpoint("KMVY", "destination", -70.6139, 41.3934, {
|
|
67
|
+
altitude: 20,
|
|
68
|
+
}),
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
const mission = new AeroflyMission("KCCR #1: Concord / Buchanan Field", {
|
|
72
|
+
checkpoints,
|
|
73
|
+
conditions,
|
|
74
|
+
description: `It is a gusty, clear early morning, and you are 8 NM to the north of the towered airport Concord / Buchanan Field (27ft). As the wind is 11 kts from 190°, the main landing runway is 19L (191° / 844m). Fly the pattern and land safely.
|
|
75
|
+
|
|
76
|
+
- Local tower / CTAF frequency: 123.90
|
|
77
|
+
- Local navigational aids: VOR/DME CCR (117.00) 3.4 NM to the north`,
|
|
78
|
+
flightSetting: "cruise",
|
|
79
|
+
aircraft: {
|
|
80
|
+
name: "c172",
|
|
81
|
+
livery: "",
|
|
82
|
+
icao: "C172",
|
|
83
|
+
},
|
|
84
|
+
callsign: "N51911",
|
|
85
|
+
origin: {
|
|
86
|
+
icao: "KCCR",
|
|
87
|
+
longitude: -122.0736009331662,
|
|
88
|
+
latitude: 38.122300745843944,
|
|
89
|
+
dir: 174.37511511143452,
|
|
90
|
+
alt: 1066.799965862401,
|
|
91
|
+
},
|
|
92
|
+
destination: {
|
|
93
|
+
icao: "KMVY",
|
|
94
|
+
longitude: -70.6139,
|
|
95
|
+
latitude: 41.3934,
|
|
96
|
+
dir: 221,
|
|
97
|
+
alt: 20,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const missionList = new AeroflyMissionsList([mission]);
|
|
102
|
+
|
|
103
|
+
assert.strictEqual(missionList.missions.length, 1);
|
|
104
|
+
assert.strictEqual(missionList.missions[0].aircraft.name, "c172");
|
|
105
|
+
assert.strictEqual(missionList.missions[0].aircraft.icao, "C172");
|
|
106
|
+
|
|
107
|
+
console.dir(missionList.missions[0], { depth: null });
|
|
108
|
+
|
|
109
|
+
const missionListString = missionList.toString();
|
|
110
|
+
|
|
111
|
+
console.log(missionListString);
|
|
112
|
+
|
|
113
|
+
assert.ok(missionListString.includes("[origin]"));
|
|
114
|
+
assert.ok(missionListString.includes("[tmmission_definition]"));
|
|
115
|
+
assert.ok(missionListString.includes("[list_tmmission_checkpoint]"));
|
|
116
|
+
assert.ok(missionListString.includes("[tmmission_checkpoint]"));
|
|
117
|
+
assert.ok(missionListString.includes("[departure_runway]"));
|
|
118
|
+
assert.ok(missionListString.includes("[cloud_cover]"));
|
|
119
|
+
assert.ok(missionListString.includes("[cloud_cover2]"));
|
|
120
|
+
assert.ok(missionListString.includes("[tmmission_checkpoint][element][0]"));
|
|
121
|
+
assert.ok(missionListString.includes("[tmmission_checkpoint][element][1]"));
|
|
122
|
+
assert.ok(missionListString.includes("[tmmission_checkpoint][element][2]"));
|
|
123
|
+
assert.ok(missionListString.includes("[tmmission_checkpoint][element][3]"));
|
|
124
|
+
assert.ok(missionListString.includes("<[float64][length][844.2959729825288]>"));
|
|
125
|
+
|
|
126
|
+
console.log("✅ AeroflyMissionsList test successful");
|
|
127
|
+
}
|