From ab01e7d102d75567d650d82b3e491cbe91891d83 Mon Sep 17 00:00:00 2001 From: expwnent Date: Sat, 31 Jan 2015 20:10:06 -0500 Subject: [PATCH] Eventful no longer requires LUA_HOOK to do reaction events. --- NEWS | 1 + plugins/eventful.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index ea0d1b166..8c014c50c 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ DFHack Future Internals Lua scripts can set environment variables of each other with dfhack.run_script_with_env. + eventful Lua reactions no longer require LUA_HOOK as a prefix: you can register a callback for the completion of any reaction with a name Fixes dfhack.run_script should correctly find save-specific scripts now. New Plugins diff --git a/plugins/eventful.cpp b/plugins/eventful.cpp index 8cf1d7832..39b333326 100644 --- a/plugins/eventful.cpp +++ b/plugins/eventful.cpp @@ -391,8 +391,8 @@ static bool find_reactions(color_ostream &out) for (size_t i = 0; i < rlist.size(); i++) { - if (!is_lua_hook(rlist[i]->code)) - continue; + //if (!is_lua_hook(rlist[i]->code)) + // continue; reactions[rlist[i]->code].react = rlist[i]; } @@ -410,7 +410,7 @@ static bool find_reactions(color_ostream &out) parse_product(out, out_prod.back(), it->second.react, itprod); } - for (size_t i = 0; i < prod.size(); i++) + for (size_t i = 0; i < out_prod.size(); i++) { if (out_prod[i].isValid()) products[out_prod[i].product] = &out_prod[i]; @@ -433,12 +433,12 @@ static void world_specific_hooks(color_ostream &out,bool enable) { if(enable && find_reactions(out)) { - out.print("Detected reaction hooks - enabling plugin.\n"); + //out.print("Detected reaction hooks - enabling plugin.\n"); INTERPOSE_HOOK(product_hook, produce).apply(true); } else { - INTERPOSE_HOOK(product_hook, produce).apply(false); + INTERPOSE_HOOK(product_hook, produce).apply(false); reactions.clear(); products.clear(); }