Epic2 Plugin Basics
Introduction
The Epic2 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 | Epic2Pfd |
Upper MFD | Epic2UpperMfd |
Lower MFD | Epic2LowerMfd |
Airplane plugin scripts are loaded on a per-instrument basis via panel.xml
:
<PlaneHTMLConfig>
<Instrument>
<Name>Epic2Pfd_1</Name>
<Plugin>
coui://SimObjects/Airplanes/MyAirplane/panel/Instruments/Epic2v2/Plugins/PfdPlugins.js
</Plugin>
</Instrument>
<Instrument>
<Name>Epic2UpperMfd_2</Name>
<Plugin>
coui://SimObjects/Airplanes/MyAirplane/panel/Instruments/Epic2v2/Plugins/UpperMfdPlugins.js
</Plugin>
</Instrument>
<Instrument>
<Name>Epic2LowerMfd_3</Name>
<Plugin>
coui://SimObjects/Airplanes/MyAirplane/panel/Instruments/Epic2v2/Plugins/LowerMfdPlugins.js
</Plugin>
</Instrument>
<Instrument>
<Name>Epic2Pfd_4</Name>
<Plugin>
coui://SimObjects/Airplanes/MyAirplane/panel/Instruments/Epic2v2/Plugins/PfdPlugins.js
</Plugin>
</Instrument>
</PlaneHTMLConfig>
It is best practice to store aircraft-specific Epic2 plugin script files (.js
) in the aircraft's panel/Instruments/Epic2v2/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
Epic2 plugins conform to the standard SDK plugin interface.
All Epic2 plugins are passed the following references via binder
:
- The local event bus.
- The instrument backplane.
- The avionics configuration object (contains global options parsed from
panel.xml
).