Now that game pad support is out, I want to see if we can find a better way of adding actions to context menus.
Currently, we prehook ZO_InventorySlot_ShowContextMenu and shove our code in right before the menu is shown.
The game manages contextual actions in itemslot.lua, but there is no global object to work with and both the table of action handlers and the table of actions available to each slot type are local.
I've built up a preliminary library to manage the manipulation of these tables, but it unfortunately requires a pretty ham-fisted copy/paste of much of the code in itemslot.lua since there are so many local functions used to support the handlers in the actions table.
The benefit of going about managing contextual actions with this library would be:
- common way to manage actions for kb/m and game pad UIs
- easily get and manipulate handlers for existing actions
The drawback is obviously the rather large size (89 KB) due to the file containing the ported itemslot.lua code, but I may be able to slim that down further. (When I was originally building it, I broke mouse interactions with item slots like double click and dragging)
So, what do you all think? Am I over-engineering here? Can anyone think of any other potential benefits to build in that would offset the cost? Do you anticipate any problems with the current implementation?