PopochiuIInventory
Extends: Node
Description
Property Descriptions
active
var active: PopochiuInventoryItem
- Setter:
@active_setter
Provides access to the inventory item that is currently selected.
clicked
var clicked: PopochiuInventoryItem
Provides access to the inventory item that was clicked.
items
var items: Array
[Array] containing instances of the currently held [PopochiuInventoryItem]s.
items_states
var items_states: Dictionary
Stores data about the state of each PopochiuInventoryItem in the game. The key of each entry is the [member PopochiuInventoryItem.script_name] of the item.
Method Descriptions
clean_inventory
func clean_inventory(in_bg: bool = false) -> void
Removes all the items that are currently in the inventory. If [param in_bg] is [code]true[/code], then the items are removed without calling [method PopochiuInventoryItem.discard] for each item.
show_inventory
func show_inventory(time: float = 1) -> void
Displays the inventory for a duration of [param time] seconds.
queue_show_inventory
func queue_show_inventory(time: float = 1) -> Callable
Displays the inventory for a duration of [param time] seconds.[br][br] [i]This method is intended to be used inside a [method Popochiu.queue] of instructions.[/i]
hide_inventory
func hide_inventory(use_anim: bool = true) -> void
Hides the inventory. If [param use_anim] is set to [code]true[/code], a GUI animation is applied.
queue_hide_inventory
func queue_hide_inventory(use_anim: bool = true) -> Callable
Hides the inventory. If [param use_anim] is set to [code]true[/code], a GUI animation is applied. [br][br] [i]This method is intended to be used inside a [method Popochiu.queue] of instructions.[/i]
get_item_instance
func get_item_instance(item_name: String) -> PopochiuInventoryItem
Returns the instance of the PopochiuInventoryItem. If the item doesn't exists, then [code]null[/code] is returned.[br][br] This method is used by [b]res://game/autoloads/i.gd[/b] to load the instace of each item (present in that script as a variable for code autocompletion) in runtime.
get_instance
func get_instance(script_name: String) -> PopochiuInventoryItem
Gets the instance of the PopochiuInventoryItem.
set_active_item
func set_active_item(item: PopochiuInventoryItem = null) -> void
Sets the cursor to use the texture of [param item].
is_item_in_inventory
func is_item_in_inventory(item_name: String) -> bool
Verifies if the item identified as [param item_name] is in the inventory.
is_full
func is_full() -> bool
Checks whether the inventory has reached its limit.
deselect_active
func deselect_active() -> void
Deselects the [member active] item.
set_active
func set_active(value: PopochiuInventoryItem) -> void
Signals
- signal item_added(item, animate): Emitted when [param item] is added to the inventory. [param animate] can be utilized by the GUI to display an animation of the item entering the inventory.
- signal item_add_done(item): Emitted when the [param item] has completed entering the inventory, signifying the end of the GUI animation.
- signal item_removed(item, animate): Emitted when [param item] is removed from the inventory. [param animate] can be employed by the GUI to display an animation of the item leaving the inventory.
- signal item_remove_done(item): Emitted when the [param item] has completed leaving the inventory, indicating the end of the GUI animation.
- signal item_replaced(item, new_item): Emitted when [param item] is replaced in the inventory by [param new_item]. Useful for handling inventory item combinations.
- signal item_replace_done(): Emitten when an item replacement has finished.
- signal item_discarded(item): Emitted when the [param item] has finished leaving the inventory (i.e. when the GUI animation is complete).
- signal item_selected(item): Emitted when [param item] is selected in the inventory.
- signal inventory_show_requested(time): Emitted when the inventory is about to be displayed. You can specify the duration it remains visible with [param time] in seconds.
- signal inventory_shown(): Emitted once the animation that displays the inventory has finished.
- signal inventory_hide_requested(use_anim): Emitted when you want to hide the inventory. [param use_anim] can be used to determine whether or not to use an animation in the GUI.