Skip to main content

G3000 Plugin Basics

Introduction

The G3000 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 TypePlugin Target
PFDWTG3000_PFD
MFDWTG3000_MFD
GTCWTG3000_GTC

Airplane plugin scripts are loaded on a per-instrument basis via panel.xml:

<PlaneHTMLConfig>

<Instrument>
<Name>WTG3000_PFD_1</Name>

<Plugin>coui://SimObjects/Airplanes/MyAirplane/panel/Instruments/G3000/Plugins/PfdPlugin.js</Plugin>
</Instrument>

<Instrument>
<Name>WTG3000_PFD_2</Name>

<Plugin>coui://SimObjects/Airplanes/MyAirplane/panel/Instruments/G3000/Plugins/PfdPlugin.js</Plugin>
</Instrument>

<Instrument>
<Name>WTG3000_MFD</Name>

<Plugin>coui://SimObjects/Airplanes/MyAirplane/panel/Instruments/G3000/Plugins/MfdPlugin.js</Plugin>
</Instrument>

</PlaneHTMLConfig>
tip

It is best practice to store aircraft-specific G3000 plugin script files (.js) in the aircraft's panel/Instruments/G3000/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

G3000 plugins conform to the standard SDK plugin interface. In addition, all G3000 plugins support the onInit() lifecycle callback method. This callback is called after onInstalled() has been called for all plugins on the same instrument. It is also guaranteed to be called at the beginning of the instrument's initialization process. It is recommended that any plugin initialization tasks that require interaction with core parts of the G3000 avionics and/or other plugins be performed in onInit().

All G3000 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).
  • An instance of FacilityLoader.
  • The flight plan lateral path calculator.
  • The local flight management system (FMS) instance.
  • The local IAU user setting manager.
  • The local V-speed user setting manager.
  • The local FMS speed user setting manager (only if FMS speed is supported).