Improves documentation for plugin writing

develop
Josh Cooper 2021-06-17 22:58:03 -07:00 committed by Myk
parent 3d8da26032
commit 12df6d14e9
2 changed files with 14 additions and 1 deletions

@ -316,6 +316,7 @@ namespace DFHack
#ifdef DEV_PLUGIN
#define DFHACK_PLUGIN(m_plugin_name) DFHACK_PLUGIN_AUX(m_plugin_name, true)
#else
// Expose the plugin name to the DFHack core, as well as metadata like the DFHack version.
#define DFHACK_PLUGIN(m_plugin_name) DFHACK_PLUGIN_AUX(m_plugin_name, false)
#endif

@ -19,7 +19,7 @@
using namespace DFHack;
using namespace df::enums;
// A plugin must be able to return its name and version.
// Expose the plugin name to the DFHack core, as well as metadata like the DFHack version.
// The name string provided must correspond to the filename -
// skeleton.plug.so, skeleton.plug.dylib, or skeleton.plug.dll in this case
DFHACK_PLUGIN("skeleton");
@ -59,6 +59,18 @@ DFhackCExport command_result plugin_shutdown (color_ostream &out)
return CR_OK;
}
// Used by `plug` to track this plugin's status.
// Called to enable/disable this plugin's state.
// Is called when using `enable` or `disable` in the console
/*
DFHACK_PLUGIN_IS_ENABLED(enabled);
DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
enabled = enable;
// other code
return CR_OK;
}
*/
// Called to notify the plugin about important state changes.
// Invoked with DF suspended, and always before the matching plugin_onupdate.
// More event codes may be added in the future.