Originally Posted by Shinni
|
Depending on when you will prehook inventory related stuff and functions it may cause other error messages as the inventory code get's tainted, (via addon inserted code) before it was fully build.
It will show you lua errors like "'...from insecure code. The callstack became untrusted ...".
I was able to circumvent this for most cases by hooking into functions and handlers that get used in the inventory surrounding at EVENT_PLAYER_ACTIVATED instead of EVENT_ADD_ON_LOADED. But even then it could happen.
Btw: Another idea would be to hook into the inventory slot actions (LibCustomMenu should be able to help here) and prevent the addition of the "Use" action in total! This will remove the keybind for it as well + the context menu entry will be gone then.
I'm using this within FCOItemSaver e.g for protected items to remove the "Destroy", "Extract" and other actions for marked (protected) items.
Downside is: You'd also have to hook into the inventory row's eventHandler for "OnDoubleClick" to prevent the usage of the item via double click.