Addon: Difference between revisions

Jump to navigation Jump to search
3,031 bytes added ,  21 July 2017
no edit summary
No edit summary
No edit summary
Line 34: Line 34:
   |date  =  Sep 27th, 2016  
   |date  =  Sep 27th, 2016  
   |added  =  Sep 27th, 2016  
   |added  =  Sep 27th, 2016  
  |script_version = 0.40
  }}</ref>
We now have a simple API to add addons to FlightGear without the need to mess around with FGData/Nasal or FGHome/Nasal directories. FlightGear now accepts the command line switch --addon=/path/to/some/addon (note: command line switch is just that: a command line switch - not an option to be entered into the launcher). fgfs (through options.cxx) takes care of
* creating a property under /addons/addon[n]/path=/path/to/some/addon
* adding /path/to/some/addon/config.xml as a config file (same as --config=/path/to/some/addon/config.xml)
* adding /path/to/some/addon to the list of allowed directories (same as --fg-aircraft=/path/to/some/addon)
The addon may be installed anywhere on your hard disk and it needs at least two files:
* config.xml - a standard PropertyList to be used to populate or modify the property tree. (Same as to be used in --config=foo.xml)
* main.nas - the Nasal hook for the logic. This file needs a function called main() which will be called from the global addon initialier (FGData/addons.nas)
It is pretty simple but does it's job nicely with our two addons we currently have in FGAddon (ATCChatter and SpokenATC). There is a /very/ simple Skeleton addon available to be used as a boilerplate here: https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/Addons/Skeleton/ As always: feedback is much appreciated. <ref>{{cite web
  |url    =  https://sourceforge.net/p/flightgear/mailman/message/35951307/
  |title  =  <nowiki> [Flightgear-devel] Simple API for creating FlightGear addons/plugins </nowiki>
  |author =  <nowiki> Torsten Dreyer </nowiki>
  |date  =  Jul 18th, 2017
  |added  =  Jul 18th, 2017
  |script_version = 0.40
  }}</ref> <ref> {{cite web
  |url    =  https://forum.flightgear.org/viewtopic.php?p=314563#p314563
  |title  =  <nowiki> New Feature: Addon - "API" </nowiki>
  |author =  <nowiki> Torsten </nowiki>
  |date  =  Jul 18th, 2017
  |added  =  Jul 18th, 2017
  |script_version = 0.40
  }}</ref>
Triggered by this addon, Torsten has overhauled the addon "API" to make it a little easier to use.
Along with this, he added the spoken ATC feature as an addon to fgaddon: https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/Addons/SpokenATC/
It is now very easy to use (given you have FlightGear compiled from git HEAD or use FlightGear 2017.3.x or later.
you need at least these commits:
FlightGear: https://sourceforge.net/p/flightgear/flightgear/ci/f6698a0b1f9e8c0791314aa09cbe1625927ef3ff/
FGData: https://sourceforge.net/p/flightgear/fgdata/ci/5c1f4a69f131a55521050f4631b8fda42f050dd2/
* Get the addon from https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/Addons/SpokenATC/
* start flightgear with --addon=/your/full/path/to/SpokenATC
done.<ref>{{cite web
  |url    =  https://forum.flightgear.org/viewtopic.php?p=314562#p314562
  |title  =  <nowiki> Re: Spoken ATC </nowiki>
  |author =  <nowiki> Torsten </nowiki>
  |date  =  Jul 18th, 2017
  |added  =  Jul 18th, 2017
   |script_version = 0.40  
   |script_version = 0.40  
   }}</ref>
   }}</ref>

Navigation menu