Torsten Dreyer
2017-07-18 11:03:41 UTC
Hi,
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 initializer
(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.
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 initializer
(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.
--
Torsten Dreyer
Torsten Dreyer