Skip to content

🔌 Use / Adapters

(Inventory/Bridges/Pickups/Adapters)

Bridges between Inventory and optional effect / pickup systems.
These adapters compile only when the corresponding REV_*_PRESENT define is set, keeping Inventory cleanly decoupled from optional modules.


🧩 Purpose

Inventory is intentionally runtime-agnostic.

Adapters in this folder allow ItemUseSystem and UseEffectResolver to integrate with systems like Pickups without introducing hard dependencies.

When the target module is absent: - Adapters compile out - Stub implementations safely no-op - Inventory behaviour remains unchanged


Included Adapters

PickupEffectInvoker

  • Lives inside the Inventory module (Inventory/Internal)
  • Compiled only when REV_PICKUPS_PRESENT is defined
  • Acts as the internal choke point that executes a PickupEffect from an Inventory item-use context
  • Provides full ItemUseContext when the effect implements IPickupEffectWithContext
  • Falls back to classic ApplyTo(IDamageable, GameObject) otherwise
  • When Pickups is not present, the stub implementation is a safe no-op

This class is internal by design and is not part of the public Inventory API.


InventoryEffectApply (Pickups adapter)

Helper for developers who need to trigger a PickupEffect manually from Inventory-driven logic or UI.

  • Builds an ItemUseContext automatically
  • Forwards execution to PickupEffectRunner.Apply(...)
  • Wrapped in #if REV_PICKUPS_PRESENT for clean standalone compilation

Example:

// Full context
InventoryEffectApply.ApplyToOwnerWithContext(effect, owner, def, slotIndex);

// Simple form with no metadata
InventoryEffectApply.ApplySimple(effect, owner);

⚙️ Integration Defines

Define Enables Notes
REV_PICKUPS_PRESENT Pickups integration Registers resolver + context-aware item-use
(future) REV_VFX_PRESENT VFX integration Placeholder for future adapters

⚠️ Notes & Gotchas

  • Adapters are compile-time optional — Inventory compiles perfectly without them
  • When disabled, adapters become no-ops and do not allocate or reflect anything
  • No reflection is used; integration is type-safe and zero-cost when missing
  • Verify scripting defines under Project Settings → Player → Scripting Define Symbols

  • Use → item-use logic and effect resolution
  • ItemUseSystem → where adapters are invoked