Rework module loading

Change module loading to use a module.json file describing the module
and patch in all files in a directory path passed to the patcher instead
of having to pass the files names and their content.  This allows the
specification of which files should be passed to the event_handler lib
and an easy implementation of loading stand alone modules.
This commit is contained in:
Hornwitser committed 2020-01-04 17:34:16 +01:00
1 parent 11992d1839
commit 80bd75ba16
11 files changed
+120 -47

No files matched your search

+8 -1
View File
@@ -18,7 +18,8 @@ The basic file structure of a plugin is the following.
+- instance.js
+- test/
| +- plugin.js
+- lua/
+- module/
+- module.json
+- plugin.lua
The most important file is the `info.js` file. Without it the plugin
@@ -70,6 +71,12 @@ The following properties are recognized:
Object with link messages definitions for this plugin. See guide
for [defining link messages](#defining-link-messages) below.
The optional module folder contains a Clusterio module that will be
patched into the save when the plugin is enabled. See the section on
[Clusterio Modules](developing-for-clusterio.md) in the Developing for
Clusterio document. The only restriction imposed on modules embedded
into plugins is that they must be named the same as the plugin.
While there is no standard for how to organize a plugin it's recommended
to put the MasterPlugin class definition into master.js and the
InstancePlugin class definition into instance.js. You can put them into