Class GGItemType extends Resource
Represents a type of inventory item and defines shared item properties.
Item types describe the properties shared by all instances of a particular type of item. An instance of an item type is represented by the [GGItemData] class. For example, the
Some item types may be
This class should be extended by your game to describe additional properties you may need. For example: [codeblock] class_name MyCustomItemType extends GGItemType # The item description that will be shown to players on the item detail screen var description: String = "" # Determines whether this type of item can be equipped. var equippable: bool = false [/codeblock]
name and image that represent the item type.Some item types may be
stackable, up to a specific stack_size. They may also have a weight.This class should be extended by your game to describe additional properties you may need. For example: [codeblock] class_name MyCustomItemType extends GGItemType # The item description that will be shown to players on the item detail screen var description: String = "" # Determines whether this type of item can be equipped. var equippable: bool = false [/codeblock]
# Members
## Represents the item visually.[br][br]This is, for example, used by the [GGInventorySlotItemUI].var icon: Texture2D = null## The name of the item.var name: String = ""## The description of the item.var description: String = ""## Wether instances of this item can be stacked with other instances of the same type.var stackable: bool = false## The maximum stack size for this item.var stack_size: int = 0## How much this type of item weighs. Used by [method GGInventory.item_weight] to calculate the weight of all items.var weight: float = 0.0## The audio to use when interacting with the item.var audio: GGItemAudio# Methods
## Creates and returns a new instance of the item type. The [param properties] can be used to set any properties on the [GGItemData] instance. Example:
[codeblock]
my_item_data = my_item_type.create_item({ quantity = 2 })
[/codeblock]func create_item(properties: Dictionary) -> GGItemData## Wether instances of this item can be stacked with other instances of the same type.func is_stackable() -> bool