I've almost got this sussed but for one problem: updating the currently open inventory formspec.
I've
- Used another meta field (like "custom_formspec") instead of "formspec" to enable on_rightclick so the security check can be done before the inventory is shown.
- Used "list[nodemeta:x,y,z;..." to allow the "custom_formspec" to reference the inventory of the item at the clicked position.
- Used minetest.show_formspec with a mod table that maps a player to the item position so that the function registered with minetest.register_on_player_receive_fields can access the item.
How can I cause a dialog shown with minetest.show_formspec to be immediately updated with new formspec content without closing and re-opening the dialog? Or, is there a better way to do this using the meta "formspec" that calls a callback so a security check can cancel the show dialog action?
Any help with this would be greatly appreciated. It's so frustratingly close to working correctly.