ConsumeItemTask ​
Inherits: BehaviorTask < Resource
Consume consumable items from the entity's inventory
Properties ​
int | item_id | 0 |
int | quantity | 1 |
bool | fail_if_item_not_found | true |
bool | fail_if_insufficient_quantity | true |
bool | fail_if_not_consumable | true |
Variables ​
ItemDefinitionConsumable | target_item | null |
int | items_consumed | 0 |
Methods ​
void | execute_task_start() |
void | execute_task_complete() |
void | execute_task_interrupt() |
void | execute_task_fail() |
void | set_item_id( new_item_id: int ) |
void | set_quantity( new_quantity: int ) |
void | set_item_and_quantity( new_item_id: int, new_quantity: int ) |
bool | is_item_consumable( check_item_id: int ) |
bool | has_sufficient_quantity( check_item_id: int, required_quantity: int = 1 ) |
int | get_available_quantity( check_item_id: int ) |
int | get_items_consumed() |
Property descriptions ​
Target
int item_id = 0 ​
The item ID to consume
int quantity = 1 ​
How many of the item to consume
Behavior
bool fail_if_item_not_found = true ​
Whether to fail if the item is not found in inventory
bool fail_if_insufficient_quantity = true ​
Whether to fail if there isn't enough quantity in inventory
bool fail_if_not_consumable = true ​
Whether to fail if the item cannot be consumed (not consumable)
Variable descriptions ​
ItemDefinitionConsumable target_item = null ​
The consumable the entity uses.
int items_consumed = 0 ​
How many items were used so far.
Method descriptions ​
void execute_task_start() ​
Execute the task - consume the specified item
void execute_task_complete() ​
Task completed successfully
void execute_task_interrupt() ​
Nothing to interrupt for consumption
void execute_task_fail() ​
Nothing to clean up for consumption
void set_item_id( new_item_id: int ) ​
Set the item ID to consume dynamically
void set_quantity( new_quantity: int ) ​
Set the quantity to consume dynamically
void set_item_and_quantity( new_item_id: int, new_quantity: int ) ​
Set both item ID and quantity
bool is_item_consumable( check_item_id: int ) ​
Check if the specified item is consumable
bool has_sufficient_quantity( check_item_id: int, required_quantity: int = 1 ) ​
Check if entity has enough of the specified item
int get_available_quantity( check_item_id: int ) ​
Get how many of the item are available in inventory
int get_items_consumed() ​
Get how many items were actually consumed in the last execution