Page 1 of 1

How to make a node open up an inventory?

PostPosted: Tue Feb 26, 2013 01:42
by scifiboi
In my industry mod, I have all my machine nodes registered. Now I am working on getting an inventory to open up when I right-click the node. I understand that I need to make a string with the formspec, but I've absolutely no clue how to make the node open up the inventory with the formspec layout. Thanks!

PostPosted: Tue Feb 26, 2013 03:16
by prestidigitator
If the formspec is properly formed, it should just open on right-click. However, note that the documentation for formspecs may be wrong. On the wiki it shows examples of "context" being used for the current node's inventory, and in the lua_api.txt for 0.4.4 it says:

"context": Selected node metadata (deprecated: "current_name")


I'm not sure whether to interpret that as 1.) "context" is deprecated and "current_name" should be used in newer versions, or 2.) the opposite. I DO know that in 0.4.4 stable "current_name" works while "context" does NOT (and when I used "context" I got the same behavior you are experiencing: no formspec opened on right-click). I haven't updated the wiki on this because I'm not sure whether the behavior in the 0.4.4 release is newer, or if it is old and the documentation needs to be updated to represent the newer behavior on the development branch.