WT21 Plugin Basics
Introduction
The WT21 package uses the Plugin API to allow developers to inject their own custom Typescript code into the avionics system in order to implement aircraft-specific features.
Loading Plugin Scripts
Global plugin scripts are loaded via XML files in the html_ui/Plugins
directory. The declared target of the plugin determines which instrument type the global plugin applies to:
Instrument Type | Plugin Target |
---|---|
PFD | WT21_PFD |
MFD | WT21_MFD |
FMC | WT21_FMC |
Airplane plugin scripts are loaded on a per-instrument basis via panel.xml
:
<PlaneHTMLConfig>
<Instrument>
<Name>WT21_PFD_1</Name>
<Plugin>coui://SimObjects/Airplanes/MyAirplane/panel/Instruments/WT21/Plugins/PfdPlugin.js</Plugin>
</Instrument>
<Instrument>
<Name>WT21_PFD_2</Name>
<Plugin>coui://SimObjects/Airplanes/MyAirplane/panel/Instruments/WT21/Plugins/PfdPlugin.js</Plugin>
</Instrument>
<Instrument>
<Name>WT21_MFD</Name>
<Plugin>coui://SimObjects/Airplanes/MyAirplane/panel/Instruments/WT21/Plugins/MfdPlugin.js</Plugin>
</Instrument>
</PlaneHTMLConfig>
It is best practice to store aircraft-specific WT21 plugin script files (.js
) in the aircraft's panel/Instruments/WT21/Plugins/
subdirectory. This greatly reduces the risk of file conflicts within the sim's virtual file system, because the plugin files are contained in an aircraft-specific subdirectory.
For more detailed information on how plugins are defined and loaded, please refer to the Plugin API documentation.
Plugin Interface
WT21 plugins conform to the standard SDK plugin interface.
All WT21 plugins are passed the following references via binder
:
- The local event bus.
- The instrument backplane.
- The flight plan lateral path calculator.
- If the instrument is the primary instrument.