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
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

@ -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();
}