Class GGInventorySystemFacade extends Node
Autoload/Singleton interface to the Inventory System.
This class provides access to the inventory system as the
Opening Inventories (Browse/transfer modes)
Inventories can be opened in two modes: Browse mode and transfer mode. The two methods are
Browse mode is intended for when the player is accessing their character's own inventory. For example: [codeblock] # Get a reference to the player's character var character: CharacterBody2D = $PlayerCharacter # Open the inventory user interface (in browse mode) so the player can interact with it. GGInventorySystem.open_inventory(character) [/codeblock] Transfer mode is intended for when the player is accessing another character or object's inventory. For example: [codeblock] # Get a reference to the player's character var character: CharacterBody2D = $PlayerCharacter # Get a reference to the object the character is interacting wth var object: StaticBody2D = $StorageBox # Open the inventory user interface (in transfer mode) so the player can interact with it. GGInventorySystem.open_transfer(character, object) [/codeblock] The inventory system defers the details of how inventories are accessed to the configured
Typically, entities are expected to have an [GGInventory] component, and an [GGEntityAccessManager] component (along with an [GGEntityAccessPolicy]), which the
GGInventorySystem
autoload/singleton in your Godot project. Internally, the class is named GGInventorySystemFacade
so that links to the built-in documentation can be provided. Opening Inventories (Browse/transfer modes)
Inventories can be opened in two modes: Browse mode and transfer mode. The two methods are
open_inventory()
and open_transfer()
. They accept (for browse mode) one or (for transfer mode) two entities, which are the characters or objects whose inventories are accessed. Browse mode is intended for when the player is accessing their character's own inventory. For example: [codeblock] # Get a reference to the player's character var character: CharacterBody2D = $PlayerCharacter # Open the inventory user interface (in browse mode) so the player can interact with it. GGInventorySystem.open_inventory(character) [/codeblock] Transfer mode is intended for when the player is accessing another character or object's inventory. For example: [codeblock] # Get a reference to the player's character var character: CharacterBody2D = $PlayerCharacter # Get a reference to the object the character is interacting wth var object: StaticBody2D = $StorageBox # Open the inventory user interface (in transfer mode) so the player can interact with it. GGInventorySystem.open_transfer(character, object) [/codeblock] The inventory system defers the details of how inventories are accessed to the configured
dialog_strategy
. Typically, entities are expected to have an [GGInventory] component, and an [GGEntityAccessManager] component (along with an [GGEntityAccessPolicy]), which the
entity_resolver_strategy
is responsible for finding.The [ProjectSettings] name where the [member dialog_strategy] is stored..PS_DIALOG_STRATEGY = "inventory_system/config/dialog_strategy"# Members
## The Dialog Strategy is responsible for opening the inventory user interface and all its details. Typically, the strategy verifies the player is allowed access via the [GGEntityAccessManager] and creates the necessary [Control]-based dialogs. The [method open_inventory] and [method open_transfer] methods both defer to this strategy.var dialog_strategy: GGInventorySystemDialogStrategy# Methods
## High-level API for a [param character] to open their own inventory.func open_inventory(character: Nodeobject: Node) -> Control## High-level API for a [param character] to open an [param object]'s inventory. Both parameters are expected to be [i]entities[/i].func open_transfer(character: Nodeobject: Node) -> Control