ItemDefinition
Inherits: Resource
Description
Abstract definition of an item, with values for stack, icon, name, etc.
This definition is not the same as a String placed in the inventory, the item added to an inventory needs this definition to know how many items can be added to a ItemStack.
This resource is configured and added to the items list of the InventoryDatabase. This can be easily changed in the plugin’s own editor.
Tutorials
Properties
|
|
|
Array[ItemCategory] |
|
|
Array[ |
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Methods
|
get_rotated_size() const |
|
is_of_category(category: ItemCategory) const |
Property Descriptions
bool
can_stack = true
🔗
void set_can_stack(value:
bool
)bool
get_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.
Array[ItemCategory] categories = []
🔗
void set_categories(value: Array[ItemCategory])
Array[ItemCategory] get_categories()
Categories this item is in are used for categorized stacks to only accept specific items. See in InventoryConstraint
Array[String
] dynamic_properties = []
🔗
void set_dynamic_properties(value: Array[
String
])Array[
String
] get_dynamic_properties()
Properties that are defined as dynamic and are calculated for individual items within the stack. Can only be used when max_stack is 1.
Texture2D
icon 🔗
void set_icon(value:
Texture2D
)Texture2D
get_icon()
Item icon in texture2D, displayed by UI e.g.
String
id = ""
🔗
void set_id(value:
String
)String
get_id()
Unique item identifier String within the InventoryDatabase.
This String can be used in the database to return an item by its id See InventoryDatabase.get_item
int
max_stack = 0
🔗
void set_max_stack(value:
int
)int
get_max_stack()
Maximum stackable item in an inventory, only used if can_stack is active.
String
name = ""
🔗
void set_name(value:
String
)String
get_name()
Name of the item to be displayed in the UI e.g.
Dictionary
properties = {}
🔗
void set_properties(value:
Dictionary
)Dictionary
get_properties()
Properties of this item, additional information here can be added (For example the 3d item that drops from this item, or its item from the player’s hand, etc.)
Vector2i
size = Vector2i(1, 1)
🔗
void set_size(value:
Vector2i
)Vector2i
get_size()
Size of the item in Vector2i, used to calculate the size of item in GridInventory.
float
weight = 0.0
🔗
void set_weight(value:
float
)float
get_weight()
Weight of the item, used to calculate the weight of the inventory.
Method Descriptions
Vector2i
get_rotated_size() const 🔗
There is currently no description for this method. Please help us by contributing one!
bool
is_of_category(category: ItemCategory) const 🔗
Returns true if this item is from category
.