diff --git a/plugins/eventful.cpp b/plugins/eventful.cpp index dfddab9e8de..f2ed6c8b96a 100644 --- a/plugins/eventful.cpp +++ b/plugins/eventful.cpp @@ -96,6 +96,7 @@ DEFINE_LUA_EVENT_NH_2(onProjUnitCheckImpact, df::proj_unitst*, bool); DEFINE_LUA_EVENT_NH_1(onProjUnitCheckMovement, df::proj_unitst*); //event manager DEFINE_LUA_EVENT_NH_1(onBuildingCreatedDestroyed, int32_t); +DEFINE_LUA_EVENT_NH_1(onTick, int32_t); DEFINE_LUA_EVENT_NH_1(onJobInitiated, df::job*); DEFINE_LUA_EVENT_NH_1(onJobStarted, df::job*); DEFINE_LUA_EVENT_NH_1(onJobCompleted, df::job*); @@ -124,6 +125,7 @@ DFHACK_PLUGIN_LUA_EVENTS { /* event manager events */ DFHACK_LUA_EVENT(onBuildingCreatedDestroyed), DFHACK_LUA_EVENT(onConstructionCreatedDestroyed), + DFHACK_LUA_EVENT(onTick), DFHACK_LUA_EVENT(onJobInitiated), DFHACK_LUA_EVENT(onJobStarted), DFHACK_LUA_EVENT(onJobCompleted), @@ -140,6 +142,11 @@ DFHACK_PLUGIN_LUA_EVENTS { DFHACK_LUA_END }; +void ev_mng_tick(color_ostream& out, void* tick) +{ + int32_t tval = (int32_t)(intptr_t)tick; + onTick(out, tval); +} static void ev_mng_jobInitiated(color_ostream& out, void* job) { df::job* ptr=reinterpret_cast(job); @@ -229,7 +236,7 @@ using namespace EventManager::EventType; handler_t getManager(EventType t) { switch (t) { case TICK: - return nullptr; + return ev_mng_tick; case JOB_INITIATED: return ev_mng_jobInitiated; case JOB_STARTED: