📦 Containers¶
Read-only container-facing contracts exposed by the Inventory abstractions layer.
This folder defines the public read surface for inventory containers. It does not contain mutable container implementations, slot mutation logic, or service orchestration.
🎯 Purpose¶
Provide a safe, read-only view of container state for consumers that must not mutate inventory.
🧩 What Lives Here¶
IReadOnlyInventoryContainer¶
A read-only view over a single inventory container.
Exposes:
- Owner → the GameObject that owns the container
- Id → the canonical ContainerId
- Capacity → current slot capacity
- Slots → current slot list as a read-only list
- Peek(int index) → safe indexed stack lookup
Suitable for:
- UI rendering
- HUD and tooltips
- Search and filtering consumers
- Diagnostics and inspectors
- Systems that observe inventory state without mutating it
⚠️ Important Notes¶
- This folder defines observation contracts only
- It does not expose mutation paths or container internals
- Returned data should be treated as read-only state
🧠 Usage Guidance¶
Read-only by intent¶
IReadOnlyInventoryContainer allows systems to read inventory state without depending on runtime implementations.
Slot list exposure¶
The contract exposes IReadOnlyList<InventorySlot>.
This is a read surface only. It is not a supported mutation seam.
Safe stack lookup¶
Peek(int index) returns ItemStack.Empty when the index is out of range.
This avoids exception-based control flow during inspection.
🚫 Not for Production Use¶
This folder is not intended to:
- Provide mutation support
- Guarantee stable references to runtime containers
- Support writing through Slots
- Define event or delta behaviour
- Own container lifecycle or creation
For mutation, use the inventory service contracts in Abstractions/Services.
🔗 Related Documentation¶
- ../
- ../Services/README.md
- [../../Containers/README.md](../../Containers/REA