listring

From Minetest Developer Wiki
Jump to: navigation, search

formspec

List rings are a formspec feature that allows for a player to transfer items between inventories by using Shift+Click. List rings define a minimum of two inventories and the relation between those inventories. IE, when shift clicking an item in this inventory send it to this other inventory. The simplest of listrings works in any situation where there are only two inventories being shown to the player.

Example

"listring[]"

This just makes the two last listed inventories both link to the other. If you want you can also use a more verbose method which gives control over which slots link to which. Each entry to the listring is one inventory location, two listrings are needed to create a full ring.

"listring[<inventory location>;<list name>]"


Furnace Code
The Furnace has a more complicated system because we can place items into the source slot from the player inventory, but can also put items from any of the furnace slots back into the player inventory.

"listring[current_name;dst]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"..
"listring[current_name;fuel]"..
"listring[current_player;main]"..


Learn more at https://forum.minetest.net/viewtopic.php?f=18&t=12629
and at https://github.com/minetest/minetest/blob/c977fbd9288d0e80019554411a2f1885f7760568/doc/lua_api.txt#L1343-1352

Due to Listrings being a part of formspecs, and formspecs being stored in meta, nodes placed before the listring was added will not have the functionality. They will have to be broken and replaced.

Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox