diff --git a/library/include/modules/EventManager.h b/library/include/modules/EventManager.h index 31ac01c18..1a6f15245 100644 --- a/library/include/modules/EventManager.h +++ b/library/include/modules/EventManager.h @@ -12,7 +12,6 @@ namespace DFHack { namespace EventManager { namespace EventType { enum EventType { - NONE, TICK, JOB_INITIATED, JOB_COMPLETED, diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 16fffd422..8aeeee8c3 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -130,7 +130,6 @@ if (BUILD_SUPPORTED) #DFHACK_PLUGIN(versionosd versionosd.cpp) DFHACK_PLUGIN(misery misery.cpp) #DFHACK_PLUGIN(dfstream dfstream.cpp LINK_LIBRARIES clsocket dfhack-tinythread) - DFHACK_PLUGIN(eventExample eventExample.cpp) endif() diff --git a/plugins/devel/CMakeLists.txt b/plugins/devel/CMakeLists.txt index 134d5cb67..80d627fa9 100644 --- a/plugins/devel/CMakeLists.txt +++ b/plugins/devel/CMakeLists.txt @@ -18,6 +18,7 @@ DFHACK_PLUGIN(stripcaged stripcaged.cpp) DFHACK_PLUGIN(rprobe rprobe.cpp) DFHACK_PLUGIN(nestboxes nestboxes.cpp) DFHACK_PLUGIN(vshook vshook.cpp) +DFHACK_PLUGIN(eventExample eventExample.cpp) IF(UNIX) DFHACK_PLUGIN(ref-index ref-index.cpp) ENDIF() diff --git a/plugins/eventExample.cpp b/plugins/devel/eventExample.cpp similarity index 87% rename from plugins/eventExample.cpp rename to plugins/devel/eventExample.cpp index 04657f1fd..2099be110 100644 --- a/plugins/eventExample.cpp +++ b/plugins/devel/eventExample.cpp @@ -9,7 +9,10 @@ #include "df/item.h" #include "df/world.h" +#include + using namespace DFHack; +using namespace std; DFHACK_PLUGIN("eventExample"); @@ -19,7 +22,15 @@ void timePassed(color_ostream& out, void* ptr); void unitDeath(color_ostream& out, void* ptr); void itemCreate(color_ostream& out, void* ptr); +command_result eventExample(color_ostream& out, vector& parameters); + + DFhackCExport command_result plugin_init(color_ostream &out, std::vector &commands) { + commands.push_back(PluginCommand("eventExample", "Sets up a few event triggers.",eventExample)); + return CR_OK; +} + +command_result eventExample(color_ostream& out, vector& parameters) { EventManager::EventHandler initiateHandler(jobInitiated); EventManager::EventHandler completeHandler(jobCompleted); EventManager::EventHandler timeHandler(timePassed); @@ -35,7 +46,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector