Item Definition

The item definition is a resource that has values for items that will be used in the Inventory node. In it we store various information such as its name, its id, its weight, etc…

Item ID

In inventories and other nodes of this plugin, items will not be used as definitions but rather referenced by their id. Many times you will want to acquire the item definition by id, for this you can use ready-made calls in the inventory node or database:

var db: InventoryDatabase
var def: ItemDefinition = db.get_item("my_item_id") # Get item definition by id

Note

The nodes in this plugin also extend the NodeInventories which has a direct call to get_item_from_id as well.

# Code in a node that extends NodeInventories (Inventory, CraftStation, etc)
var def: ItemDefinition = db.get_item_from_id("my_item_id") # Get item definition by id

Item Definition Editor

../../_images/item_definition_editor.png

In the window, items are displayed in a list on the left side, or we can also search by name.

  • ID:

    String identification of the item, used to get the item based on a list of items easily using the id. You can use the button to edit the id correctly, it will indicate in red if the id already exists.

  • Icon:

    Texture to display your item in-game and in the editor

  • Name:

    Name to be displayed or used as additional identification (It is your responsibility to use this field)

  • Can Stack:

    Defines whether there is a Max Stack for the item containing this item definition, unchecked means only one item is added to the stack.

  • Max Stack:

    Maximum stackable item in an inventory, only used if Can Stack is active.

  • Weight:

    Weight of the item, used to calculate the weight of the inventory.

  • Grid Size:

    Size of the item in Vector2i, used to calculate the size of item in GridInventory.

  • Categories:

    Categories this item is in are used for categorized stacks to only accept specific items. See in InventoryConstraint.