Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //I HAVE NO IDEA WHAT I'M DOING.
- #include "Core.h"
- #include "Console.h"
- #include "Export.h"
- #include "PluginManager.h"
- #include "modules/Items.h"
- #include <VTableInterpose.h>
- #include "df/general_ref.h" //no idea if this is right
- using namespace DFHack;
- using namespace df::enums;
- using df::global::world;
- static command_result tweak(color_ostream &out, vector <string> & parameters);
- DFHACK_PLUGIN("itemsyndrome_hooks");
- DEFINE_LUA_EVENT_1(onItemEquipped,unitID)
- DFHACK_PLUGIN_LUA_EVENTS {
- DFHACK_LUA_EVENT(itemEquipped),
- DFHACK_LUA_END
- };
- struct itemsyndrome_hook : df::general_ref_unit_holderst{
- typedef df::general_ref_unit_holderst interpose_base;
- DEFINE_VMETHOD_INTERPOSE(void,getUnit,(int16_t unitID)) //no idea if this argument thing will work at all, no idea where the plugins get them :X Sometimes I just can't find things...
- {
- CoreSuspendClaimer suspend;
- color_ostream_proxy out(Core::getInstance().getConsole());
- bool call_native=true;
- onItemEquipped(out,this,unitID);
- if(call_native)
- INTERPOSE_NEXT(itemEquipped)(unitID);
- itemEquipped(out,this);
- }
- };
- IMPLEMENT_VMETHOD_INTERPOSE(itemsyndrome_hook, getUnit);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement