Skip to content

Commit 54e5867

Browse files
committed
Added MsFs20 and MsFs24 as sim types
1 parent 0c7f557 commit 54e5867

File tree

5 files changed

+97
-33
lines changed

5 files changed

+97
-33
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@ TEST-results.xml
6565
package.g.props
6666
*v8.log
6767
/lib/
68+
packages.lock.json

README.md

+36-29
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,28 @@ This will setup a watch, and then automatically transpile and then copy the cont
7575
npm run dev
7676
```
7777

78-
It's recommended to run this *after* you've started ACARS, or, in the ACARS configuration, disable the
79-
remote-download of configs:
78+
### Disable Downloading Latest Defaults
8079

81-
> TODO: Guide on how to disable remote config downloading
80+
Sometimes, it's just useful to disable downloading of the latest defaults, and just edit the scripts that are included
81+
to see how they work. To do that, create a file in your `Documents/vmsacars` directory, called `appsettings.local.json`,
82+
and place the following:
83+
84+
```json filename="appsettings.local.json"
85+
{
86+
"Config": {
87+
"App": {
88+
"DownloadConfig": false
89+
}
90+
},
91+
"Serilog": {
92+
"MinimumLevel": {
93+
"Default": "Verbose"
94+
}
95+
}
96+
}
97+
```
8298

99+
You can also adjust the log level to "Information", "Debug" or "Verbose" ("Debug" is recommended)
83100

84101
---
85102

@@ -104,31 +121,6 @@ It also includes other detailed type information, for example `Length`, so you c
104121

105122
---
106123

107-
## Disable Downloading Latest Defaults
108-
109-
Sometimes, it's just useful to disable downloading of the latest defaults, and just edit the scripts that are included
110-
to see how they work. To do that, create a file in your `Documents/vmsacars` directory, called `appsettings.local.json`,
111-
and place the following:
112-
113-
```json filename="appsettings.local.json"
114-
{
115-
"Config": {
116-
"App": {
117-
"DownloadConfig": false
118-
}
119-
},
120-
"Serilog": {
121-
"MinimumLevel": {
122-
"Default": "Verbose"
123-
}
124-
}
125-
}
126-
```
127-
128-
You can also adjust the log level to "Information", "Debug" or "Verbose" ("Debug" is recommended)
129-
130-
---
131-
132124
## Aircraft Configuration:
133125

134126
Aircraft rules are required to inherit the `AircraftConfig` abstract class. An example class would look like:
@@ -180,6 +172,8 @@ The configuration is a class which has a few different components.
180172
- `AircraftConfigSimType.XPlane`
181173
- `AircraftConfigSimType.Fsuipc`
182174
- `AircraftConfigSimType.MsFs`
175+
- `AircraftConfigSimType.MsFs20`
176+
- `AircraftConfigSimType.MsFs24`
183177
- `enabled`
184178
- `priority` - from 1 (lowest) to 10 (highest). If there are multiple rules which match this, then which one takes
185179
priority. All the built-in rules are at a priority 1, and aircraft specifics rules are priority 2. I recommend
@@ -202,6 +196,14 @@ The configuration is a class which has a few different components.
202196
In the above example, for the Fenix A320, the landing lights are controlled by two datarefs, both of which the
203197
values need to be 1 or 2 for the landing lights to be considered "on".
204198

199+
#### Targeting MSFS
200+
201+
There are 3 possible values for targetting MSFS in the configs:
202+
203+
- `AircraftConfigSimType.MsFs` - This will apply the configuration to both 2020 and 2024
204+
- `AircraftConfigSimType.MsFs20` - This will be for 2020 ONLY
205+
- `AircraftConfigSimType.MsFs24` - This will be for 2024 ONLY
206+
205207
### Features
206208

207209
Features are essentially stored in a dictionary of dictionaries, of type `FeatureAddresses`:
@@ -266,6 +268,11 @@ export default class Example extends AircraftConfig {
266268
}
267269
```
268270

271+
### Equality Checking
272+
273+
I recommend using `==` instead of `===` for equality comparisons, since the types coming from the sim
274+
may not always match up or be casted properly (e.g, `1` being returned instead of `true`)
275+
269276
### Ignoring Features
270277

271278
To ignore a feature in the rules (for example, if a feature doesn't work properly), set the feature to false:
@@ -391,7 +398,7 @@ export default class BatteryOnDuringPushback implements Rule {
391398
// First check that the battery is declared as part of the aircraft's feature set
392399
if (AircraftFeature.Battery in data.features
393400
// And then check its value to see if it's on or off
394-
&& data.features[AircraftFeature.Battery] === false) {
401+
&& data.features[AircraftFeature.Battery] == false) {
395402
return ['The battery must be on during pushback']
396403
}
397404
}

src/aircraft/TBM930.ts src/aircraft/TBM930_MSFS20.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import {
77
Meta,
88
} from '../interface/aircraft'
99

10-
export default class FlyByWireA320N extends AircraftConfig {
10+
export default class TBM930_MSFS20 extends AircraftConfig {
1111
meta: Meta = {
12-
id: 'tbm_930',
13-
name: 'TBM 930',
14-
sim: AircraftConfigSimType.MsFs,
12+
id: 'tbm_930_2020',
13+
name: 'TBM 930 2020',
14+
sim: AircraftConfigSimType.MsFs20,
1515
enabled: true,
1616
priority: 2,
1717
}

src/aircraft/TBM930_MSFS24.ts

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { AircraftConfigSimType, AircraftFeature, FeatureType } from '../defs'
2+
import {
3+
AircraftConfig,
4+
FeatureAddresses,
5+
FeatureState,
6+
FlapNames,
7+
Meta,
8+
} from '../interface/aircraft'
9+
10+
export default class TBM930_MSFS24 extends AircraftConfig {
11+
meta: Meta = {
12+
id: 'tbm_930_2024',
13+
name: 'TBM 930 2024',
14+
sim: AircraftConfigSimType.MsFs24,
15+
enabled: true,
16+
priority: 2,
17+
}
18+
19+
features: FeatureAddresses = {
20+
[AircraftFeature.BeaconLights]: false,
21+
[AircraftFeature.TaxiLights]: {
22+
'A:LIGHT TAXI,bool': FeatureType.Int,
23+
},
24+
[AircraftFeature.LandingLights]: {
25+
'A:LIGHT LANDING,bool': FeatureType.Int,
26+
},
27+
[AircraftFeature.LogoLights]: false,
28+
}
29+
30+
flapNames: FlapNames = {
31+
0: 'UP',
32+
1: 'TO',
33+
2: 'LDG',
34+
}
35+
36+
match(title: string, icao: string, config_path: string): boolean {
37+
return title.includes('tbm') && title.includes('930')
38+
}
39+
40+
beaconLights(value: number): FeatureState {
41+
return value == 1
42+
}
43+
44+
landingLights(value: number): FeatureState {
45+
return value == 1
46+
}
47+
48+
taxiLights(value: number): FeatureState {
49+
return value == 1
50+
}
51+
}

src/defs.ts

+5
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,14 @@ export enum PirepState {
124124
}
125125
/** The simtype for the rule file */
126126
export enum AircraftConfigSimType {
127+
/** This configuration can be for either MSFS 2020 or 2024 */
127128
MsFs = 0,
128129
XPlane = 1,
129130
Fsuipc = 2,
131+
/** Configuration for MSFS 2020 *only* */
132+
MsFs20 = 3,
133+
/** Configuration for MSFS 2024 *only* */
134+
MsFs24 = 4,
130135
}
131136
/** Features of an aircraft. They are binary on or off */
132137
export enum AircraftFeature {

0 commit comments

Comments
 (0)