Eventful no longer requires LUA_HOOK to do reaction events.

develop
expwnent 2015-01-31 20:10:06 -05:00
parent 1443a64ddb
commit ab01e7d102
2 changed files with 6 additions and 5 deletions

@ -1,6 +1,7 @@
DFHack Future DFHack Future
Internals Internals
Lua scripts can set environment variables of each other with dfhack.run_script_with_env. 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 Fixes
dfhack.run_script should correctly find save-specific scripts now. dfhack.run_script should correctly find save-specific scripts now.
New Plugins New Plugins

@ -391,8 +391,8 @@ static bool find_reactions(color_ostream &out)
for (size_t i = 0; i < rlist.size(); i++) for (size_t i = 0; i < rlist.size(); i++)
{ {
if (!is_lua_hook(rlist[i]->code)) //if (!is_lua_hook(rlist[i]->code))
continue; // continue;
reactions[rlist[i]->code].react = rlist[i]; 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); 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()) if (out_prod[i].isValid())
products[out_prod[i].product] = &out_prod[i]; products[out_prod[i].product] = &out_prod[i];
@ -433,7 +433,7 @@ static void world_specific_hooks(color_ostream &out,bool enable)
{ {
if(enable && find_reactions(out)) 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); INTERPOSE_HOOK(product_hook, produce).apply(true);
} }
else else