ItemDefinitionOnUse ​
Inherits: ItemDefinition < DatabaseResource < Resource
Items that function like abilities when used - trigger ability execution with charge consumption Uses charges instead of stacking for cleaner inventory management
Properties ​
int | ability_id | |
int | max_charges | 1 |
int | starting_charges | 1 |
int | charges_per_use | 1 |
bool | consume_on_start | true |
Methods ​
bool | can_use( user: Entity, item_instance: ItemInstance = null ) |
bool | execute_use( user: Entity, item_instance: ItemInstance ) |
String | get_use_action_name( item_instance: ItemInstance ) |
int | get_effective_charges_per_use( item_instance: ItemInstance ) |
void | on_on_use_item_used( item_instance: ItemInstance, user: Entity, charges_consumed: int ) |
Property descriptions ​
int ability_id ​
The ability definition executed when this item is used
int max_charges = 1 ​
Maximum charges this item can hold
int starting_charges = 1 ​
Charges the item starts with when created
int charges_per_use = 1 ​
Number of charges consumed per use (allows flexibility for powerful abilities)
bool consume_on_start = true ​
True: consume immediately when used; False: consume only after ability completes successfully
Method descriptions ​
bool can_use( user: Entity, item_instance: ItemInstance = null ) ​
Check if the on-use item can be used
bool execute_use( user: Entity, item_instance: ItemInstance ) ​
Execute on-use item - trigger ability and let instance handle charge consumption
String get_use_action_name( item_instance: ItemInstance ) ​
Get display name for on-use action
int get_effective_charges_per_use( item_instance: ItemInstance ) ​
Get effective charges per use including instance modifications
void on_on_use_item_used( item_instance: ItemInstance, user: Entity, charges_consumed: int ) ​
Virtual method for on-use specific logic when charges are consumed Called by ItemInstance after successful charge consumption