[{"data":1,"prerenderedAt":735},["ShallowReactive",2],{"navigation":3,"class-ref-GGInventory":75,"class-ref-GGInteractable2DStrategyInventory":705},[4,13,40,60],{"title":5,"_path":6,"children":7},"Getting Started","/getting-started",[8,10],{"title":9,"_path":6},"Introduction",{"title":11,"_path":12},"Installation","/getting-started/installation",{"title":14,"_path":15,"children":16},"Concepts","/concepts",[17,19,22,25,28,31,34,37],{"title":18,"_path":15},"Overview",{"title":20,"_path":21},"Inventory","/concepts/inventory",{"title":23,"_path":24},"Interactions","/concepts/interaction",{"title":26,"_path":27},"Permissions","/concepts/permissions",{"title":29,"_path":30},"Multiplayer","/concepts/multiplayer",{"title":32,"_path":33},"User Interface","/concepts/user-interface",{"title":35,"_path":36},"Game Integration","/concepts/game-integration",{"title":38,"_path":39},"Crafting","/concepts/crafting",{"title":41,"_path":42,"children":43},"Demos","/demos",[44,46,49,52,54,57],{"title":45,"_path":42},"Inventory Tour",{"title":47,"_path":48},"Inventory UI Playground","/demos/inventory_ui",{"title":50,"_path":51},"Inventory Game UI","/demos/inventory_game_ui",{"title":38,"_path":53},"/demos/crafting",{"title":55,"_path":56},"Multiplayer Lobby","/demos/mp_lobby",{"title":58,"_path":59},"Sequencer (prototype)","/demos/sequencer",{"title":61,"_path":62,"children":63},"Guide","/guide",[64,66,69,72],{"title":65,"_path":62},"Architecture Deep Dive",{"title":67,"_path":68},"Design Principles","/guide/design-principles",{"title":70,"_path":71},"Changelog v2.x","/guide/changelog-v2",{"title":73,"_path":74},"Changelog v1.x","/guide/changelog",{"_path":76,"_dir":77,"_draft":78,"_partial":78,"_locale":79,"_id":80,"navigation":78,"addon":77,"version":81,"brief_description":82,"description":83,"tutorials":84,"methods":88,"members":589,"signals":658,"constants":700,"inherits":259,"name":311,"title":311,"_source":701,"_file":702,"_stem":703,"_extension":704},"/reference/2.0/gg_inventory/gginventory","gg_inventory",false,"","content:40.reference:2.0:gg_inventory:GGInventory.xml","2.0","Provides item storage capabilities to characters and objects.","The inventory component acts as a repository for items and provides methods to manage them. It is highly configurable and extensible through various [url=https://en.wikipedia.org/wiki/Strategy_pattern]strategies[/url] that modify its behavior. [br][br]The inventory offers methods for integration with your game logic, and methods for integration with the user interface used by players. [br][br][b]Managing Items[/b] [br][br]Basic operations for item management include [method add_item], [method get_item], [method has_item], and [method remove_item]. Items are stored in the [member contents] property. To organize items, use [method sort_items] and [method stack_items]. Their behavior is determined by the [member sorting_strategies] and [member stacking_strategy], respectively. [br][br][b]Inventory Limits[/b] [br][br]The [member max_items] property determines the item capacity of the inventory. Use [method item_count] to determine how many items the inventory contains. The [member max_weight] property determines the weight capacity of the inventory. [method item_weight] returns the combined weight of all items in the inventory. [br][br]Whenever inventory contents change, the [signal items_changed] signal is emitted, which the inventory user interface will react to. [br][br][b]Using Items[/b] [br][br]The [method use] method is a façade for using items and is typically invoked through the inventory's user interface. Its behavior is determined by the [member use_strategy]. It defaults to calling [method request_use_item], which abstracts multiplayer client handling and emits the [signal item_use_requested] signal on the server, which your game logic is expected to react to. [br][br][b]Dropping Items[/b] [br][br]Items can be dropped from the inventory either through game logic via the [method drop_items] method, through player action via the [method request_drop_items] method, or because the [member max_size] was reduced and the inventory can no longer hold as many items. The inventory will emit the [signal items_dropped] signal, which your game logic is expected to handle. [br][br][b]Permissions[/b] [br][br]Permissions are handled in two parts: Object-level access is handled by the [GGEntityAccessManager], while inventory-level permissions are handled by the [GGInventoryAccessPolicy]. [br][br]First, the inventory integrates with the [GGEntityAccessManager] for permissions handling. The access manager provides a [code]context_id[/code] which represents an actor for a particular client. Inventory methods such as [method request_sort_items], [method request_transfer_item_to_inventory], [method request_use_item], and other methods following the [code]request_*()[/code] format expect the [param context_id] as one of the parameters. This allows the host to determine which character the client is acting on behalf of. [br][br]Second, what an actor can [i]do[/i] with the inventory is determined by the inventory's [member access_policy]. The [GGInventoryAccessPolicy], despite having a similar name, is technically unrelated to the [GGEntityAccessPolicy] class. The inventory access policy defines what kind of actions an actor can take. The inventory provides façade methods to determine what permissions an actor has: For example, [method can_write] determines whether an actor can modify inventory contents at all, or if they have read-only access. In addition, the [method can_add_item], [method can_remove_item], [method can_use_item], and [method can_drop_item] determine what an actor can do with a specific item. These permissions are relied on by other behavior such as the [member transfer_strategy]. [br][br]For custom behavior, extend the [GGInventoryAccessPolicy] and override any methods with your game-specific logic. [br][br][b]Saving/Restoring[/b] [br][br]Inventory configuration and contents can be saved via [method serialize]. Use [method deserialize] to restore the inventory state. The serialization behavior can be modified via the [member serialization_strategy] property. [br][br][b]Multiplayer[/b] [br][br]Players (clients) act on behalf of their character. Any character or object the player interacts with must have a [GGEntityAccessManager] component from which a [code]context_id[/code] has to be obtained via [method GGEntityAccessManager.open_context]. [br][br]In this example, the player drops the item in the first inventory slot on behalf of their character: \n[codeblock]\nvar actor: CharacterBody2D = $PlayerCharacter\nvar entity_access_manager: GGEntityAccessManager = $PlayerCharacter/GGEntityAccessManager\nvar inventory: GGInventory = $PlayerCharacter/GGInventory\nvar first_item_id: Array[int] = [0]\n\nvar context_id: int = await entity_access_manager.open_context(actor)\ninventory.request_drop_items(first_item_id, context_id)\nentity_access_manager.close_context(context_id)\n[/codeblock]\n In most real-world scenarios, the [code]context_id[/code] is kept open to avoid having to re-open it for every action the player takes. For example, when a user interface shows inventory contents, it'll first open a [code]context_id[/code], which will only be closed once the user interface is closed. [br][br]The host's inventory component listens to the [signal GGEntityAccessManager.context_opened] and [signal GGEntityAccessManager.context_closed] signals. When a context is opened, the inventory contents are sent to the client. While a context is open, any item changes are synchronized with the respective client. [br][br]Since all multiplayer inventory interaction are server-authoritative and request/response-based, multiple clients can interact with the same inventory concurrently.",{"link":85},{"#text":86,"@title":87},"https://inventory.gogogodot.io/concepts/inventory#inventory-component","Conceptual Overview",[89,93,100,104,109,115,120,127,134,142,148,154,159,163,168,175,182,188,196,204,207,212,217,223,228,235,240,246,251,257,263,268,276,281,287,293,299,305,316,325,330,335,339,347,354,360,367,373,378,387,394,402,410,418,425,434,443,451,457,463,469,474,481,487,493,499,504,509,514,519,525,529,535,539,542,545,550,556,560,565,571,581],{"description":79,"name":90,"public":78,"returnType":91,"params":92},"_ready","void",[],{"description":79,"name":94,"public":78,"returnType":95,"params":96},"_iter_init","bool",[97],{"name":98,"type":99},"arg","Array",{"description":79,"name":101,"public":78,"returnType":95,"params":102},"_iter_next",[103],{"name":98,"type":99},{"description":79,"name":105,"public":78,"returnType":106,"params":107},"_iter_get","Variant",[108],{"name":98,"type":106},{"description":110,"name":111,"public":112,"returnType":113,"params":114},"Counts how many items the inventory contains.","item_count",true,"int",[],{"description":116,"name":117,"public":112,"returnType":118,"params":119},"The combined weight of all items in the inventory.","item_weight","float",[],{"description":121,"name":122,"public":112,"returnType":123,"params":124},"Returns the item of a slot","get_item","GGItemData",[125],{"name":126,"type":113},"slot_id",{"description":128,"name":129,"public":112,"returnType":123,"params":130},"Sets a slot to an item (or null)","set_item",[131,132],{"name":126,"type":113},{"name":133,"type":123},"item",{"description":135,"name":136,"public":112,"returnType":91,"params":137},"An optimized method to swap items in [param source_slot_id] and [param target_slot_id]. Performs an atomic swap, that results in a single [signal items_changed] signal. Other components can use it to detect that an item was moved, but that it is still in the inventory.","swap_items",[138,140],{"name":139,"type":113},"source_slot_id",{"name":141,"type":113},"target_slot_id",{"description":79,"name":143,"public":78,"returnType":91,"params":144},"_set_item_quantity",[145,146],{"name":126,"type":113},{"name":147,"type":113},"quantity",{"description":149,"name":150,"public":112,"returnType":113,"params":151},"Adds [param item] to the inventory. If [param quantity] is specified, only adds up to that quantity. Note: [method add_item] does not make a copy of the item, so if you're adding half of an item, it's the callers responsibility to first duplicate the item via [method GGItemData.copy].[br][br]Returns the quantity that was added.","add_item",[152,153],{"name":133,"type":123},{"name":147,"type":113},{"description":155,"name":156,"public":112,"returnType":123,"params":157},"Removes the item from the [param slot_id] and returns it.","remove_item",[158],{"name":126,"type":113},{"description":79,"name":160,"public":78,"returnType":123,"params":161},"_remove_item",[162],{"name":126,"type":113},{"description":164,"name":165,"public":112,"returnType":95,"params":166},"Checks if the inventory has the [param item]. Will only return true if the item is the exact same instance.","has_item",[167],{"name":133,"type":123},{"description":169,"name":170,"public":112,"returnType":95,"params":171},"Check if the inventory has the [param items] in sufficient quantities. The check will be compare the [param items]' types and quantities.","has_items",[172],{"name":173,"type":174},"items","GGItemData[]",{"description":176,"name":177,"public":112,"returnType":113,"params":178},"Returns the total quantity of the item [param type].","get_quantity_by_item_type",[179],{"name":180,"type":181},"type","GGItemType",{"description":183,"name":184,"public":112,"returnType":123,"params":185},"Consumes an item in [param slot_id]. If [param quantity] is specified, it'll consume and subtract the specific amount.","consume_item",[186,187],{"name":126,"type":113},{"name":147,"type":113},{"description":189,"name":190,"public":112,"returnType":174,"params":191},"Removes and returns the specified quantity of items from the inventory.[br][br]The returned array will contain the items in the format they were stored in the inventory; so if it requested a stack of 10 wood, and the inventory contained three items of 5 wood, 3 wood, and 8 wood, it'll return an array of 5, 3, and 2 wood.[br][br]If [param allow_partial] was set to [code]true[/code], the caller has to inspect what was returned. Partials means that nothing may have been returned at all. This makes it easy to consume ammo (e.g. request 30 bullets, but if only 10 were available, allow for a partial reload).","consume_items",[192,194],{"name":193,"type":174},"needed_items",{"name":195,"type":95},"allow_partial",{"description":197,"name":198,"public":112,"returnType":174,"params":199},"Consumes a specific [param quantity] of an item [param type]. If the inventory holds less than [param min_quantity], an empty array is returned. The caller should inspect the return value for the exact quantities. The returned quantities may be split across multiple items.","consume_item_type",[200,201,202],{"name":180,"type":181},{"name":147,"type":113},{"name":203,"type":113},"min_quantity",{"description":79,"name":205,"public":78,"returnType":91,"params":206},"_build_lookup_table",[],{"description":79,"name":208,"public":78,"returnType":91,"params":209},"_add_to_lookup_table",[210,211],{"name":126,"type":113},{"name":133,"type":123},{"description":79,"name":213,"public":78,"returnType":91,"params":214},"_remove_from_lookup_table",[215,216],{"name":126,"type":113},{"name":133,"type":123},{"description":79,"name":218,"public":78,"returnType":91,"params":219},"_adjust_lookup_table_quantity",[220,221],{"name":133,"type":123},{"name":222,"type":113},"diff",{"description":79,"name":224,"public":78,"returnType":91,"params":225},"_shift_lookup_table_slot_ids",[226],{"name":227,"type":113},"from_slot_id",{"description":229,"name":230,"public":112,"returnType":113,"params":231},"Returns the position of an open slot that can hold [param item], or [code]-1[/code] if all slots are taken.","find_free_slot_for_item",[232,233],{"name":133,"type":123},{"name":234,"type":113},"offset",{"description":236,"name":237,"public":112,"returnType":95,"params":238},"Whether the [param item] is accepted by this inventory as determined by the [member item_filter_strategy].","accepts_item",[239],{"name":133,"type":123},{"description":241,"name":242,"public":112,"returnType":95,"params":243},"Whether the [param item] is accepted by this inventory in [param slot_id] as determined by the [member item_filter_strategy].","slot_accepts_item",[244,245],{"name":133,"type":123},{"name":126,"type":113},{"description":247,"name":248,"public":112,"returnType":249,"params":250},"Serializes the inventory and returns its state. The implementation is determined by the [member serialization_strategy] and typically includes configuration and contents.","serialize","Dictionary",[],{"description":252,"name":253,"public":112,"returnType":91,"params":254},"Restores the inventory from the [param state]. The implementation is determined by the [member serialization_strategy] and typically includes configuration and contents.","deserialize",[255],{"name":256,"type":249},"state",{"description":79,"name":258,"public":78,"returnType":259,"params":260},"_find_actor_for_context","Node",[261],{"name":262,"type":113},"context_id",{"description":264,"name":265,"public":112,"returnType":266,"params":267},"Retrieve the list of currently subscribed clients from the [member entity_access_manager]. These are the \"remote_sender_ids\". When called on the client, it will only return the client's own peer_id.","get_subscribers","int[]",[],{"description":269,"name":270,"public":112,"returnType":95,"params":271},"Returns true if the [member entity_access_manager] has a context for the [param actor] owned by the [param remote_sender_id].","has_context",[272,274],{"name":273,"type":259},"actor",{"name":275,"type":113},"remote_sender_id",{"description":277,"name":278,"public":112,"returnType":95,"params":279},"Whether the [param actor] can modify the inventory contents. Defers to the [member access_policy].","can_write",[280],{"name":273,"type":259},{"description":282,"name":283,"public":112,"returnType":95,"params":284},"Whether the [param item] can be added by the [param actor]. Defers to the [member access_policy].","can_add_item",[285,286],{"name":133,"type":123},{"name":273,"type":259},{"description":288,"name":289,"public":112,"returnType":95,"params":290},"Whether the [param item] can be removed by the [param actor]. Defers to the [member access_policy].","can_remove_item",[291,292],{"name":133,"type":123},{"name":273,"type":259},{"description":294,"name":295,"public":112,"returnType":95,"params":296},"Whether the [param item] can be used by the [param actor]. Defers to the [member access_policy].","can_use_item",[297,298],{"name":133,"type":123},{"name":273,"type":259},{"description":300,"name":301,"public":112,"returnType":95,"params":302},"Whether the [param item] can be dropped by the [param actor]. Defers to the [member access_policy].","can_drop_item",[303,304],{"name":133,"type":123},{"name":273,"type":259},{"description":306,"name":307,"public":112,"returnType":95,"params":308},"Whether the [param source_inventory]'s [param source_item] can be stacked onto the [param target_item]. Defers to the [member stacking_strategy] for the logic.","can_stack",[309,312,314],{"name":310,"type":311},"source_inventory","GGInventory",{"name":313,"type":123},"source_item",{"name":315,"type":123},"target_item",{"description":317,"name":318,"public":112,"returnType":113,"params":319},"Attempt to stack the [param source_item] onto a specific [param target_slot_id]. The [param quantity] specifies how much of the item should be stacked. The return value is the quantity that was added for the [param source_item], for which the caller is responsible that it is applied.","stack",[320,321,322,324],{"name":310,"type":311},{"name":313,"type":123},{"name":323,"type":113},"target_item_id",{"name":147,"type":113},{"description":326,"name":327,"public":112,"returnType":91,"params":328},"Stack all stackable items to optimize inventory space. Will only work if the [param actor] Node has write permissions. This method should only be called server-side.","stack_items",[329],{"name":273,"type":259},{"description":331,"name":332,"public":112,"returnType":91,"params":333},"Request stacking all stackable items to optimize inventory space. The [param context_id] must have been created through the [member entity_access_manager] first. Can be called from the server or client.","request_stack_items",[334],{"name":262,"type":113},{"description":79,"name":336,"public":78,"returnType":91,"params":337},"_request_stack_items",[338],{"name":262,"type":113},{"description":340,"name":341,"public":112,"returnType":91,"params":342},"Split the item in [param slot_id] as specified by the [param amount]. Splitting is done on behalf of the [param actor], if they have write permission. This method should only be called server-side.","split_item",[343,344,346],{"name":126,"type":113},{"name":345,"type":113},"amount",{"name":273,"type":259},{"description":348,"name":349,"public":112,"returnType":91,"params":350},"Split the item in [param slot_id] as specified by the [param amount]. The actor will be retrieved via the [param context_id] which must have been created through the [member entity_access_manager] first. Can be called from the server or client.","request_split_item",[351,352,353],{"name":126,"type":113},{"name":345,"type":113},{"name":262,"type":113},{"description":79,"name":355,"public":78,"returnType":91,"params":356},"_request_split_item",[357,358,359],{"name":126,"type":113},{"name":345,"type":113},{"name":262,"type":113},{"description":361,"name":362,"public":112,"returnType":91,"params":363},"Sort all items according to the [param strategy_id], which is the Nth strategy in the [member sorting_strategies] Array. Sorting is done on behalf of the [param actor], if they have write permission. This method should only be called server-side. Clients should use the [method request_sort_items] method instead.","sort_items",[364,366],{"name":365,"type":113},"strategy_id",{"name":273,"type":259},{"description":368,"name":369,"public":112,"returnType":91,"params":370},"Requests sorting items according to the [param strategy_id], which is the Nth strategy in the [member sorting_strategies] Array. The actor will be retrieved via the [param context_id] which must have been created through the [member entity_access_manager] first. Can be called from the server or client.","request_sort_items",[371,372],{"name":365,"type":113},{"name":262,"type":113},{"description":79,"name":374,"public":78,"returnType":91,"params":375},"_request_sort_items",[376,377],{"name":365,"type":113},{"name":262,"type":113},{"description":379,"name":380,"public":112,"returnType":91,"params":381},"Transfers the items in [param slot_ids] to the [param target_inventory]. The transfer is done on behalf of the [param actor], if they have write permission. This method should only be called server-side. You should use [method request_transfer_items_to_inventory] as it is server/client agnostic.","transfer_items_to_inventory",[382,384,386],{"name":383,"type":266},"slot_ids",{"name":385,"type":311},"target_inventory",{"name":273,"type":259},{"description":388,"name":389,"public":112,"returnType":91,"params":390},"Transfers the items in the [param slot_ids] to the [param target_inventory]. The transfer is done on behalf of the actor identified by the [param context_id].","request_transfer_items_to_inventory",[391,392,393],{"name":383,"type":266},{"name":385,"type":311},{"name":262,"type":113},{"description":79,"name":395,"public":78,"returnType":91,"params":396},"_request_transfer_items_to_inventory",[397,398,401],{"name":383,"type":266},{"name":399,"type":400},"target_inventory_path","NodePath",{"name":262,"type":113},{"description":403,"name":404,"public":112,"returnType":91,"params":405},"Transfers the item in [param slot_id] to the [param target_inventory]. The [param quantity] parameter allows for partial transfers. The transfer is done on behalf of the [param actor], if they have write permission. This method should only be called server-side.","transfer_item_to_inventory",[406,407,408,409],{"name":126,"type":113},{"name":385,"type":311},{"name":147,"type":113},{"name":273,"type":259},{"description":411,"name":412,"public":112,"returnType":91,"params":413},"Requests transfer of the item in [param slot_id] to the [param target_inventory]. The [param quantity] parameter allows for partial transfers. The transfer is done on behalf of the actor identified by the [param context_id] issued by the [member entity_access_manager]. This method is server/client-agnostic.","request_transfer_item_to_inventory",[414,415,416,417],{"name":126,"type":113},{"name":385,"type":311},{"name":147,"type":113},{"name":262,"type":113},{"description":79,"name":419,"public":78,"returnType":91,"params":420},"_request_transfer_item_to_inventory",[421,422,423,424],{"name":126,"type":113},{"name":399,"type":400},{"name":147,"type":113},{"name":262,"type":113},{"description":426,"name":427,"public":112,"returnType":91,"params":428},"Transfers the item in [param source_slot_id] to the [param target_slot_id] in the [param target_inventory]. The [param quantity] parameter allows for partial transfers. The transfer is done on behalf of the [param actor], if they have write permission. This method should only be called by game logic on the server-side. UI logic should use [method request_transfer_item_to_slot] instead.","transfer_item_to_slot",[429,430,431,432,433],{"name":139,"type":113},{"name":385,"type":311},{"name":141,"type":113},{"name":147,"type":113},{"name":273,"type":259},{"description":435,"name":436,"public":112,"returnType":91,"params":437},"Requests transfer of the item in [param source_slot_id] to the [param target_slot_id] in the [param target_inventory]. The [param quantity] parameter allows for partial transfers. Can be called from the server or client.","request_transfer_item_to_slot",[438,439,440,441,442],{"name":139,"type":113},{"name":385,"type":311},{"name":141,"type":113},{"name":147,"type":113},{"name":262,"type":113},{"description":79,"name":444,"public":78,"returnType":91,"params":445},"_request_transfer_item_to_slot",[446,447,448,449,450],{"name":139,"type":113},{"name":399,"type":400},{"name":141,"type":113},{"name":147,"type":113},{"name":262,"type":113},{"description":452,"name":453,"public":112,"returnType":91,"params":454},"Use the item in [param slot_id] for [param actor]. Façade method that should be called locally. If no [member use_strategy] is defined, it defaults to calling [method request_use_item] for server-side handling.","use",[455,456],{"name":126,"type":113},{"name":262,"type":113},{"description":458,"name":459,"public":112,"returnType":91,"params":460},"Use the item in [param slot_id] for [param actor]. Should only be called server-side. This will only emit the [signal item_use_requested] signal. It is up to a listener to react to the item use request.","use_item",[461,462],{"name":126,"type":113},{"name":273,"type":259},{"description":464,"name":465,"public":112,"returnType":91,"params":466},"Request the use of the item in [param slot_id] for [param actor]. Can be called from the server or client. This will only emit the [signal item_use_requested] signal on the server. It is up to a listener to react to the item use request.","request_use_item",[467,468],{"name":126,"type":113},{"name":262,"type":113},{"description":79,"name":470,"public":78,"returnType":91,"params":471},"_request_use_item",[472,473],{"name":126,"type":113},{"name":262,"type":113},{"description":475,"name":476,"public":112,"returnType":91,"params":477},"Drops the item in [param slot_id] from the inventory on behalf of the [param actor]. The [param quantity] allows for specific quantities.","drop_item",[478,479,480],{"name":126,"type":113},{"name":147,"type":106},{"name":273,"type":259},{"description":79,"name":482,"public":112,"returnType":91,"params":483},"request_drop_item",[484,485,486],{"name":126,"type":113},{"name":147,"type":106},{"name":262,"type":113},{"description":79,"name":488,"public":78,"returnType":91,"params":489},"_request_drop_item",[490,491,492],{"name":126,"type":113},{"name":147,"type":106},{"name":262,"type":113},{"description":494,"name":495,"public":112,"returnType":91,"params":496},"Drops the items in slots specified by [param slot_ids] on behalf of [param actor].","drop_items",[497,498],{"name":383,"type":266},{"name":273,"type":259},{"description":79,"name":500,"public":112,"returnType":91,"params":501},"request_drop_items",[502,503],{"name":383,"type":266},{"name":262,"type":113},{"description":79,"name":505,"public":78,"returnType":91,"params":506},"_request_drop_items",[507,508],{"name":383,"type":266},{"name":262,"type":113},{"description":510,"name":511,"public":112,"returnType":113,"params":512},"Returns the slot ID of the [param item].","find_item_slot_id",[513],{"name":133,"type":123},{"description":515,"name":516,"public":112,"returnType":123,"params":517},"Find an item of a particular [param type].","find_item_by_type",[518],{"name":180,"type":181},{"description":79,"name":520,"public":78,"returnType":174,"params":521},"_find_items_by",[522],{"name":523,"type":524},"criteria","Callable",{"description":79,"name":526,"public":78,"returnType":174,"params":527},"_find_items_with_space_left",[528],{"name":180,"type":181},{"description":79,"name":530,"public":78,"returnType":91,"params":531},"_set_contents",[532],{"name":533,"type":534},"value","GGItemCollection",{"description":79,"name":536,"public":78,"returnType":91,"params":537},"_on_items_changed",[538],{"name":383,"type":266},{"description":79,"name":540,"public":78,"returnType":91,"params":541},"_apply_items_changed",[],{"description":79,"name":543,"public":78,"returnType":91,"params":544},"_resize_inventory",[],{"description":79,"name":546,"public":78,"returnType":91,"params":547},"_cl_resize_inventory",[548],{"name":549,"type":113},"slots",{"description":551,"name":552,"public":112,"returnType":91,"params":553},"Sends the inventory contents to the client identified by its [param peer_id]. In most cases, calling this method is not needed. Instead, use the [member entity_access_manager] to open a context, which will automatically sync inventory contents as needed.","send_contents_to_client",[554],{"name":555,"type":113},"peer_id",{"description":79,"name":557,"public":78,"returnType":91,"params":558},"_sv_send_contents",[559],{"name":275,"type":113},{"description":79,"name":561,"public":78,"returnType":91,"params":562},"_sync_items_with_client",[563,564],{"name":383,"type":99},{"name":275,"type":113},{"description":79,"name":566,"public":78,"returnType":91,"params":567},"_cl_update_item",[568,569],{"name":126,"type":113},{"name":570,"type":106},"data",{"description":79,"name":572,"public":78,"returnType":91,"params":573},"_on_context_opened",[574,576,578,580],{"name":575,"type":113},"_context_id",{"name":577,"type":259},"_actor",{"name":579,"type":113},"_nonce",{"name":275,"type":113},{"description":79,"name":582,"public":78,"returnType":91,"params":583},"_on_context_closed",[584,585,586,587],{"name":575,"type":113},{"name":577,"type":259},{"name":579,"type":113},{"name":588,"type":113},"_remote_sender_id",[590,594,599,604,607,611,615,619,623,628,632,636,640,645,649,653,655],{"name":591,"description":592,"type":534,"setter":530,"getter":79,"default":593,"public":112},"contents","The collection of items that the inventory manages.","new()",{"name":595,"description":596,"type":95,"setter":597,"getter":79,"default":598,"public":112},"allow_gaps","Allows gaps in the inventory.[br][br]When disabled, the [member contents] aren't allow to have any gaps. The [member GGItemCollection.items] Array is not allowed to have any [code]null[/code] values.[br][br]When enabled, the [member contents] are are padded with [code]null[/code] values. The size of the [member GGItemCollection.items] Array will match the [member max_slots] property.","@allow_gaps_setter","true",{"name":600,"description":601,"type":113,"setter":602,"getter":79,"default":603,"public":112},"max_slots","Maximum number of items this inventory can hold. Adjusting the value automatically resizes the [member contents]' [member GGItemCollection.items] array. If the resized inventory is too small, it will emit [signal items_dropped] with the items that were removed from the inventory.","@max_slots_setter","0",{"name":605,"type":95,"setter":79,"getter":79,"default":606,"public":112},"weight_limit","false",{"name":608,"description":609,"type":118,"setter":79,"getter":79,"default":610,"public":112},"max_weight","The maximum weight capacity of this inventory. [br][br]Use the [member item_filter_strategy] with the [GGInventoryItemFilterStrategyWeight] class to enforce the weight limit.","0.0",{"name":612,"description":613,"type":118,"setter":79,"getter":79,"default":614,"public":112},"expiration_multiplier","Modifies item expiration for this inventory. Smaller values expire faster, larger values expire slower (e.g. 2.0 means expiration is doubled). [br][br]Note: Requires the [GGInventoryExpirationsExtension].","1.0",{"name":616,"description":617,"type":618,"setter":79,"getter":79,"public":112},"use_strategy","The Use Strategy determines what happens when [method use] is called. The default behavior is for the inventory to call [method request_use_item]. If a strategy is specified, it can be used to \"intercept\" using an item on the client.","GGInventoryUseStrategy",{"name":620,"description":621,"type":622,"setter":79,"getter":79,"default":593,"public":112},"item_filter_strategy","Allows filtering items when they're added to the inventory. This can be used to ensure only specific items can be added, for example for crafting.","GGInventoryItemFilterStrategy",{"name":624,"description":625,"type":626,"setter":79,"getter":79,"default":627,"public":112},"sorting_strategies","Specifies the behavior of [method GGItemCollection.sort_items].","GGInventorySortingStrategy[]","[...]",{"name":629,"description":630,"type":631,"setter":79,"getter":79,"public":112},"transfer_strategy","Responsible for the logic when items are transferred to another inventory.","GGInventoryTransferStrategy",{"name":633,"description":634,"type":635,"setter":79,"getter":79,"public":112},"stacking_strategy","Specifies the strategy for stacking items.","GGInventoryStackingStrategy",{"name":637,"description":638,"type":639,"setter":79,"getter":79,"default":593,"public":112},"serialization_strategy","The serialization strategy determines how items are serialized and deserialized for the purpose of sending it to clients","GGInventorySerializationStrategy",{"name":641,"description":642,"type":643,"setter":644,"getter":79,"public":112},"entity_access_manager","Responsible for determining whether an actor has access to this inventory. This is required for multiplayer.","GGEntityAccessManager","@entity_access_manager_setter",{"name":646,"description":647,"type":648,"setter":79,"getter":79,"default":593,"public":112},"access_policy","The access policy determines what an actor interacting with the inventory is allowed to do.","GGInventoryAccessPolicy",{"name":650,"type":651,"setter":79,"getter":79,"default":652,"public":78},"_item_type_lut","Dictionary[GGItemType, GGInventory.LutEntry]","{}",{"name":654,"type":95,"setter":79,"getter":79,"default":606,"public":78},"_batch_changes",{"name":656,"type":266,"setter":79,"getter":79,"default":657,"public":78},"_batch_items_changed","[]",[659,664,669,676,683,689,695],{"description":660,"name":661,"params":662},"Emitted when the inventory's resized (for example, by adjusting the [member max_slots] property).","inventory_resized",[663],{"name":549,"type":113},{"description":665,"name":666,"params":667},"Emitted when items have changed.","items_changed",[668],{"name":383,"type":266},{"description":670,"name":671,"params":672},"Emitted when an item is added. This signal is intended for UI notifications. The [param item] refers to the item in the inventory, which is not necessarily the same instance of the item that was passed to [method add_item] because the item may have been stacked. [br][br]The [param quantity] argument indicates how many items were added, while [code]item.quantity[/code] indicates the total quantity in the item stack. [br][br]Adding a single item with a quantity greater than 1 may result multiple item_added signals as the item gets split up across multiple slots.","item_added",[673,674,675],{"name":133,"type":123},{"name":147,"type":113},{"name":126,"type":113},{"description":677,"name":678,"params":679},"Emitted when an item is removed from the inventory. This signal is intended for UI notifications. To detect when an item was dropped into the world, use [signal items_dropped] instead. The [param item] should not be modified.","item_removed",[680,681,682],{"name":133,"type":123},{"name":147,"type":113},{"name":126,"type":113},{"description":684,"name":685,"params":686},"Emitted when items are dropped from the inventory. Either through player action, or because the [member max_size] was reduced and the inventory can no longer hold as many items.","items_dropped",[687,688],{"name":173,"type":174},{"name":273,"type":259},{"description":690,"name":691,"params":692},"Emitted when the player requests using an item.","item_use_requested",[693,694],{"name":133,"type":123},{"name":273,"type":259},{"description":696,"name":697,"params":698},"Emitted when an item has expired and was removed from the inventory. Note: Requires the [GGInventoryExpirationsExtension].","item_expired",[699],{"name":133,"type":123},[],"content","40.reference/2.0/gg_inventory/GGInventory.xml","40.reference/2.0/gg_inventory/GGInventory","xml",{"_path":706,"_dir":77,"_draft":78,"_partial":78,"_locale":79,"_id":707,"navigation":78,"addon":77,"version":81,"brief_description":708,"description":709,"tutorials":79,"methods":710,"members":725,"signals":729,"constants":730,"inherits":731,"name":732,"title":732,"_source":701,"_file":733,"_stem":734,"_extension":704},"/reference/2.0/gg_inventory/gginteractable2dstrategyinventory","content:40.reference:2.0:gg_inventory:GGInteractable2DStrategyInventory.xml","High-level Inventory Interaction Strategy.","This strategy calls on the Inventory Game UI to open the character and object inventories in transfer mode. [br][br]The Inventory Game UI can either be called as an Autoload or looked up using a node group.",[711,720],{"description":79,"name":712,"public":112,"returnType":91,"params":713},"interact",[714,717],{"name":715,"type":716},"interactor","GGInteractor2D",{"name":718,"type":719},"interactable","GGInteractable2D",{"description":79,"name":721,"public":112,"returnType":91,"params":722},"end_interaction",[723,724],{"name":715,"type":716},{"name":718,"type":719},[726],{"name":727,"type":728,"setter":79,"getter":79,"default":652,"public":78},"_dialogs","Dictionary[Node, Control]",[],[],"GGInteractable2DStrategy","GGInteractable2DStrategyInventory","40.reference/2.0/gg_inventory/GGInteractable2DStrategyInventory.xml","40.reference/2.0/gg_inventory/GGInteractable2DStrategyInventory",1743268967518]