Skip to content
ct

Class

InventoryTarget

Generated GDScript class reference for ItemVault.InventoryTarget.

Status
Current
Version
v1.0
Updated
2026-07-31

Documented contract for an object that accepts ItemStack adds — the target type consumed by InventoryPickupBridge. InventoryTarget is a CONTRACT, not a base class: Inventory and ItemContainer satisfy it via duck-typing (they both expose add(stack: ItemStack) -> ItemStack and optionally a wallet property). The static helpers below validate that contract so misconfiguration fails LOUDLY at assignment time (in the bridge's target setter), not silently at pickup time. To support a new target type, expose:

  • func add(stack: ItemStack) -> ItemStack (required)
  • var wallet: Wallet (optional; enables currency routing) Why a static guard and not a base class: Inventory and ItemContainer already have separate inheritance chains (both ultimately RefCounted). Forcing a common base would be an invasive class-hierarchy change for a one-method contract. The explicit guard achieves the same compile-time-near safety (assignment fails immediately with a clear message) without the hierarchy cost.

Source: addons/item_vault/bridge/inventory_target.gd

Syntax

class InventoryTarget extends RefCounted

Members

NameKindSummary
is_valid_targetMethod
get_walletMethod
validate_or_warnMethod