|
| 1 | +import { AircraftConfigSimType, AircraftFeature, FeatureType } from '../defs' |
| 2 | +import { |
| 3 | + AircraftConfig, |
| 4 | + FeatureAddresses, |
| 5 | + FeatureState, |
| 6 | + Meta, |
| 7 | +} from '../interface/aircraft' |
| 8 | +import GetDefaultFlaps from './_default_flaps' |
| 9 | + |
| 10 | +export default class FlightFactor767 extends AircraftConfig { |
| 11 | + meta: Meta = { |
| 12 | + id: 'flightfactor-767', |
| 13 | + name: 'FlightFactor 767', |
| 14 | + sim: AircraftConfigSimType.XPlane, |
| 15 | + enabled: true, |
| 16 | + priority: 2, |
| 17 | + } |
| 18 | + |
| 19 | + features: FeatureAddresses = { |
| 20 | + [AircraftFeature.BeaconLights]: { |
| 21 | + 'sim/cockpit2/switches/beacon_on': FeatureType.Int, |
| 22 | + }, |
| 23 | + [AircraftFeature.LandingLights]: { |
| 24 | + 'sim/cockpit2/switches/landing_lights_switch': FeatureType.NumberArray, |
| 25 | + }, |
| 26 | + [AircraftFeature.LogoLights]: { |
| 27 | + 'sim/cockpit2/switches/generic_lights_switch': FeatureType.NumberArray, |
| 28 | + }, |
| 29 | + [AircraftFeature.NavigationLights]: { |
| 30 | + 'sim/cockpit2/switches/navigation_lights_on': FeatureType.Int, |
| 31 | + }, |
| 32 | + [AircraftFeature.StrobeLights]: { |
| 33 | + 'sim/cockpit2/switches/strobe_lights_on': FeatureType.Int, |
| 34 | + }, |
| 35 | + [AircraftFeature.TaxiLights]: { |
| 36 | + 'sim/cockpit2/switches/landing_lights_switch': FeatureType.NumberArray, |
| 37 | + }, |
| 38 | + [AircraftFeature.WingLights]: { |
| 39 | + 'sim/cockpit2/switches/generic_lights_switch': FeatureType.NumberArray, |
| 40 | + }, |
| 41 | + } |
| 42 | + |
| 43 | + /** |
| 44 | + * Determine if this config map should be used for the given aircraft |
| 45 | + * |
| 46 | + * @param {string} title The title of the aircraft, lowercased |
| 47 | + * @param {string=} icao The ICAO of the aircraft. Might not be available |
| 48 | + * @param {string=} config_path Path to the aircraft config. Might not be there |
| 49 | + * @return {boolean} |
| 50 | + */ |
| 51 | + match(title: string, icao: string, config_path: string): boolean { |
| 52 | + this.flapNames = GetDefaultFlaps('', 'B767', '') |
| 53 | + return ['boeing', '767'].every((w) => title.includes(w)) |
| 54 | + } |
| 55 | + |
| 56 | + beaconLights(value: number): FeatureState { |
| 57 | + return value === 1 |
| 58 | + } |
| 59 | + |
| 60 | + landingLights(value: number[]): FeatureState { |
| 61 | + return value[0] === 1 && value[1] === 1 |
| 62 | + } |
| 63 | + |
| 64 | + logoLights(value: number[]): FeatureState { |
| 65 | + return value[3] === 1 |
| 66 | + } |
| 67 | + |
| 68 | + navigationLights(value: number): FeatureState { |
| 69 | + return value === 1 |
| 70 | + } |
| 71 | + |
| 72 | + strobeLights(value: number): FeatureState { |
| 73 | + return value === 1 |
| 74 | + } |
| 75 | + |
| 76 | + taxiLights(value: number[]): FeatureState { |
| 77 | + return value[2] === 1 |
| 78 | + } |
| 79 | + |
| 80 | + wingLights(value: number[]): FeatureState { |
| 81 | + return value[0] === 1 |
| 82 | + } |
| 83 | +} |
0 commit comments