Updates eventful plugin with new EventManager event JOB_STARTED

develop
Josh Cooper 2021-08-19 18:43:53 -07:00 committed by Myk
parent 1107c03b86
commit 2b8024e62f
2 changed files with 9 additions and 0 deletions

@ -96,6 +96,7 @@ DEFINE_LUA_EVENT_NH_1(onProjUnitCheckMovement, df::proj_unitst*);
//event manager
DEFINE_LUA_EVENT_NH_1(onBuildingCreatedDestroyed, 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*);
DEFINE_LUA_EVENT_NH_1(onUnitDeath, int32_t);
DEFINE_LUA_EVENT_NH_1(onItemCreated, int32_t);
@ -122,6 +123,7 @@ DFHACK_PLUGIN_LUA_EVENTS {
DFHACK_LUA_EVENT(onBuildingCreatedDestroyed),
DFHACK_LUA_EVENT(onConstructionCreatedDestroyed),
DFHACK_LUA_EVENT(onJobInitiated),
DFHACK_LUA_EVENT(onJobStarted),
DFHACK_LUA_EVENT(onJobCompleted),
DFHACK_LUA_EVENT(onUnitDeath),
DFHACK_LUA_EVENT(onItemCreated),
@ -140,6 +142,11 @@ static void ev_mng_jobInitiated(color_ostream& out, void* job)
df::job* ptr=reinterpret_cast<df::job*>(job);
onJobInitiated(out,ptr);
}
static void ev_mng_jobStarted(color_ostream& out, void* job)
{
df::job* ptr=reinterpret_cast<df::job*>(job);
onJobStarted(out,ptr);
}
void ev_mng_jobCompleted(color_ostream& out, void* job)
{
df::job* ptr=reinterpret_cast<df::job*>(job);
@ -211,6 +218,7 @@ typedef void (*handler_t) (color_ostream&,void*);
static const handler_t eventHandlers[] = {
NULL,
ev_mng_jobInitiated,
ev_mng_jobStarted,
ev_mng_jobCompleted,
ev_mng_unitDeath,
ev_mng_itemCreate,

@ -152,6 +152,7 @@ end
eventType=invertTable{
[0]="TICK",
"JOB_INITIATED",
"JOB_STARTED",
"JOB_COMPLETED",
"UNIT_DEATH",
"ITEM_CREATED",