diff --git a/plugins/skeleton/skeleton.cpp b/plugins/skeleton/skeleton.cpp index fd1571e4f..7206a778f 100644 --- a/plugins/skeleton/skeleton.cpp +++ b/plugins/skeleton/skeleton.cpp @@ -5,7 +5,7 @@ #include #include #include - +#include // If you need to save data per-world: //#include "modules/Persistence.h" @@ -19,94 +19,114 @@ using namespace DFHack; using namespace df::enums; -// Expose the plugin name to the DFHack core, as well as metadata like the DFHack version. +// A plugin must be able to return its name and 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"); +// A plugin can have a state which can be used to manage how the plugin operates. +// The state is referred to by this the identifier provided to the macro. eg. `enabled` +DFHACK_PLUGIN_IS_ENABLED(enabled); + // Any globals a plugin requires (e.g. world) should be listed here. // For example, this line expands to "using df::global::world" and prevents the // plugin from being loaded if df::global::world is null (i.e. missing from symbols.xml): // -// REQUIRE_GLOBAL(world); - -// Here go all the command declarations... -// mostly to allow having the mandatory stuff on top of the file and commands on the bottom -command_result skeleton (color_ostream &out, std::vector & parameters); - -// Mandatory init function. If you have some global state, create it here. -DFhackCExport command_result plugin_init (color_ostream &out, std::vector &commands) -{ - // Fill the command list with your commands. - commands.push_back(PluginCommand( - "skeleton", "Do nothing, look pretty.", - skeleton, false, /* true means that the command can't be used from non-interactive user interface */ - // Extended help string. Used by CR_WRONG_USAGE and the help command: - " This command does nothing at all.\n" - "Example:\n" - " skeleton\n" - " Does nothing.\n" - )); +REQUIRE_GLOBAL(world); + +// You may want some compile time debugging options +// one easy system just requires you to cache the color_ostream &out into a global debug variable +//#define P_DEBUG 1 +//uint16_t maxTickFreq = 1200; //maybe you want to use some events + +command_result command_callback1(color_ostream &out, std::vector ¶meters); + +DFhackCExport command_result plugin_init(color_ostream &out, std::vector &commands) { + commands.push_back(PluginCommand("skeleton", + "~54 character description of plugin", //to use one line in the ``[DFHack]# ls`` output + command_callback1, + false, + "" + " skeleton