OpenContainerTask ​
Inherits: BehaviorTask < Resource
Open a specific container and optionally take/deposit items Enhanced with proper signal-based movement handling
Properties ​
int | container_id | 0 |
bool | desired_open_state | true |
bool | move_to_container | true |
float | interaction_distance | 2.0 |
int | take_item_id | 0 |
int | take_quantity | 1 |
int | deposit_item_id | 0 |
int | deposit_quantity | 1 |
bool | create_new_items | false |
Variables ​
InteractableObject | target_container | null |
bool | initial_container_state | false |
bool | container_was_opened_by_us | false |
bool | items_processed | false |
Vector3 | container_position | Vector3.ZERO |
float | interaction_range | 2.0 |
bool | movement_completed | false |
bool | container_interaction_completed | false |
Methods ​
void | execute_task_start() |
void | execute_task_interrupt() |
void | execute_task_fail() |
InteractableObject | get_target_container() |
bool | is_container_accessible() |
float | get_distance_to_container() |
bool | is_in_container_interaction_range() |
void | set_container_id( new_id: int ) |
void | set_create_new_items( create_new: bool ) |
void | set_deposit_item( item_id: int, quantity: int = 1 ) |
void | clear_deposit_item() |
void | set_take_item( item_id: int, quantity: int = 1 ) |
void | clear_take_item() |
void | set_interaction_distance( distance: float ) |
Property descriptions ​
Target
int container_id = 0 ​
The unique ID of the container to interact with
bool desired_open_state = true ​
Desired container state (true = open, false = close)
bool move_to_container = true ​
Whether to move to container before interacting
float interaction_distance = 2.0 ​
Interaction distance from container
Items
int take_item_id = 0 ​
Item ID to take from container (0 = don't take anything)
int take_quantity = 1 ​
Quantity to take (defaults to 1)
int deposit_item_id = 0 ​
Item ID to deposit into container (0 = don't deposit anything)
int deposit_quantity = 1 ​
Quantity to deposit (defaults to 1)
bool create_new_items = false ​
If true, creates new items instead of taking from entity inventory
Variable descriptions ​
InteractableObject target_container = null ​
The container the entity opens.
bool initial_container_state = false ​
Whether the container was open when the task began.
bool container_was_opened_by_us = false ​
True when the task opened it (so it closes it again).
bool items_processed = false ​
True once the items were taken or put.
Vector3 container_position = Vector3.ZERO ​
The position of the container.
float interaction_range = 2.0 ​
How close the entity must be to open the container.
bool movement_completed = false ​
True once the entity arrived.
bool container_interaction_completed = false ​
True once the container was used.
Method descriptions ​
void execute_task_start() ​
Starts the task.
void execute_task_interrupt() ​
Called when something interrupts the task.
void execute_task_fail() ​
Called when the task fails.
InteractableObject get_target_container() ​
The container the entity opens.
bool is_container_accessible() ​
Can the container be opened now?
float get_distance_to_container() ​
The distance to the container (-1 when there is none).
bool is_in_container_interaction_range() ​
Is the entity close enough to open the container?
void set_container_id( new_id: int ) ​
Set the target container ID dynamically
void set_create_new_items( create_new: bool ) ​
Set whether to create new items instead of transferring from inventory
void set_deposit_item( item_id: int, quantity: int = 1 ) ​
Set the item to deposit with quantity dynamically
void clear_deposit_item() ​
Clear deposit item
void set_take_item( item_id: int, quantity: int = 1 ) ​
Set the item to take with quantity dynamically
void clear_take_item() ​
Clear take item
void set_interaction_distance( distance: float ) ​
Set interaction distance dynamically