Skip to content

ItemDefinition ​

Inherits: DatabaseResource < Resource

Inherited by: ItemDefinitionConsumable, ItemDefinitionEnchantScroll, ItemDefinitionEquipment, ItemDefinitionMaterial, ItemDefinitionOnUse, ItemDefinitionQuest, ItemDefinitionReadable, ItemDefinitionSocketable

Base class for all item definitions with integrated Requirement system

Properties ​

Meshitem_modelnull
Array[Material]item_material_override[]
Meshprojectile_modelnull
Vector3projectile_rotationVector3.ZERO
intquality_id0
boolrandomize_qualityfalse
Array[int]rollable_quality_ids[]
boolstackablefalse
intmax_stack_size1
Vector2ishape_sizeVector2i(1, 1)
floatweight0.0
intvendor_value0
boolis_key_itemfalse
intitem_level1
boolscales_with_item_levelfalse
Array[int]groups[]
floatdropped_scale1.0
VFXSelectiondropped_vfx
SFXSelectionpickup_sound
Array[Requirement]requirements[]

Methods ​

Dictionarycheck_requirements( user: Entity, item_instance: ItemInstance = null )
boolmeets_requirements( user: Entity, item_instance: ItemInstance = null )
Stringget_requirement_failure_message( user: Entity, item_instance: ItemInstance = null )
Stringget_requirements_summary( item_instance: ItemInstance = null )
boolcan_drop_now( _system_hub: GameHost.SystemHub )
boolis_kept_aside()
boolneeds_generation()
Qualityget_quality()
Colorget_quality_color()
Stringget_quality_name()
intget_quality_tier()
boolhas_higher_quality_than( other_item: ItemDefinition )
boolcan_use( user: Entity, _item_instance: ItemInstance = null )
boolexecute_use( _user: Entity, _item_instance: ItemInstance )
Stringget_use_action_name( _item_instance: ItemInstance )

Property descriptions ​

Mesh item_model = null ​

3D mesh used when displaying this item in the world

Array[Material] item_material_override = [] ​

Material overrides applied to the item model

Projectile

Mesh projectile_model = null ​

The mesh this item has when it flies as a projectile (an arrow, a bolt, a thrown axe): the projectile effects that have a projectile mesh show it. Empty: the item model above is used.

Vector3 projectile_rotation = Vector3.ZERO ​

How the model is turned so that its tip points along +Y (the direction the projectile effects fly along), in degrees. 0, 0, 0: the model already has its tip up.

int quality_id = 0 ​

Quality ID that determines rarity and color coding (0 = no quality)

bool randomize_quality = false ​

Pick the quality when the item is generated (loot, rewards, vendors) from the qualities below, instead of using the quality above. The chance of each is its drop weight

Array[int] rollable_quality_ids = [] ​

The qualities the item can roll (Quality ids). Empty with the box ticked = it keeps the quality above

Stack Settings

bool stackable = false ​

Whether multiple instances can stack together in inventory slots

int max_stack_size = 1 ​

Maximum number of items in a single inventory slot

Value and Flags

Vector2i shape_size = Vector2i(1, 1) ​

How many cells the item covers in a grid inventory: width and height (1 x 1 = one cell). Always a rectangle. A slots inventory ignores it

float weight = 0.0 ​

What one of the item weighs, when the inventory style counts weight (a stack weighs this times its size). 0 = nothing

int vendor_value = 0 ​

Base vendor sale value in copper pieces

bool is_key_item = false ​

Whether this item cannot be discarded or sold

Level

int item_level = 1 ​

The item level: how powerful the item is. It sets the stat budget of a generated item and which affixes can roll. This is not a level requirement: use a Level requirement in Requirements for that (it can follow the item level). For an item that scales with its item level this is the level its values are written for

bool scales_with_item_level = false ​

The item scales with the item level it is generated at: its stats (and weapon damage) grow with the level of the budget, so one authored item can be a reward at every stage of the game. Needs a level when it is given (loot table, reward, vendor)

Groups

Array[int] groups = [] ​

Groups this item is in (see GroupDefinition): consumables of a group that shares its cooldown go on cooldown together, and ammo or reagent costs can name a group

Dropped Item

float dropped_scale = 1.0 ​

How big the model (or the picture of the icon) is when the item lies in the world

VFXSelection dropped_vfx ​

A visual effect shown on the item while it lies in the world (a glow, a beam of light). The quality of the item can have one too: both are shown

SFXSelection pickup_sound ​

The sound that plays when the item is picked up from the ground

Requirements

Array[Requirement] requirements = [] ​

Array of requirements that must be met to use/equip this item

Method descriptions ​

Dictionary check_requirements( user: Entity, item_instance: ItemInstance = null ) ​

Check if user meets all requirements to use this item

bool meets_requirements( user: Entity, item_instance: ItemInstance = null ) ​

Quick check: can this item be used?

String get_requirement_failure_message( user: Entity, item_instance: ItemInstance = null ) ​

Get failure message for why requirements aren't met

String get_requirements_summary( item_instance: ItemInstance = null ) ​

Get requirements summary for tooltip display

bool can_drop_now( _system_hub: GameHost.SystemHub ) ​

Is the item generated when it is given (loot, reward, vendor) rather than copied as it is? It is when it rolls its quality or scales with its item level; equipment also when it rolls stats or effects. See ItemGenerator Can loot give this item right now? Items hold nothing back; a quest item can wait for its quest (ItemDefinitionQuest.Availability)

bool is_kept_aside() ​

Is this item kept aside in the bag (taking no slot, cell or weight)? Only a quest item can be (ItemDefinitionQuest.BagSpace)

bool needs_generation() ​

Must the item be generated when it is made (a random quality or a level)?

Quality get_quality() ​

Get the actual Quality resource from the ID

Color get_quality_color() ​

========== QUALITY METHODS ==========

String get_quality_name() ​

The name of the quality of the item.

int get_quality_tier() ​

The tier of the quality of the item (higher is rarer).

bool has_higher_quality_than( other_item: ItemDefinition ) ​

Is the quality of this item higher than the other?

bool can_use( user: Entity, _item_instance: ItemInstance = null ) ​

Check if this item can be used by a specific user Pure validation - no side effects item_instance parameter is optional but needed for quest items

bool execute_use( _user: Entity, _item_instance: ItemInstance ) ​

Virtual method to execute item usage effects Called by ItemInstance - definitions handle logic, instances handle state

String get_use_action_name( _item_instance: ItemInstance ) ​

Get the display name for the use action (e.g., "Use", "Read", "Equip") Used by UI to show appropriate action text