public sealed class ContainerSetEvery container one owner has, and the one thing allowed to change them.
Remarks
A transaction is applied here or nowhere. `Container` exposes its slots read-only precisely so that this is the only writer: a mutation outside a transaction is one that cannot be rolled back, and a half-applied move is how an item ends up in two places or in none.
The client's copy is optimistic and reconciled from the authoritative result. Doc 28 § Inventory — the same pattern as prediction, one layer up. Nothing here is client-specific: both ends run this code over their own set, and the realm's answer wins.
Fields and properties (3)
public ItemLibrary LibraryWhere item templates come from.
public IReadOnlyCollection<Container> ContainersThe containers, in the order they were added.
public int TotalItemsEvery item in every container, stacks summed. What the conservation oracle counts.
Methods (6)
public ContainerSet(ItemLibrary library)Makes a set over the items a build knows.
public ContainerSet Add(Container container)Adds a container to the set.
public Container? Find(ContainerId id)Finds a container.
public Container Get(ContainerId id)Finds a container, and refuses to carry on without it.
public int CountOf(DefId definition)How many of one item the whole set holds.
public ContainerResult Apply(ContainerTransaction transaction)Applies a transaction, entirely or not at all.
Used by (6)
- AtomicityTestsVixen.Gameplay.Inventory.Tests
- BindingTestsVixen.Gameplay.Inventory.Tests
- ConservationOracleTestsVixen.Gameplay.Inventory.Tests
- ContainerBasicsTestsVixen.Gameplay.Inventory.Tests
- ContainerTransactionTestsVixen.Gameplay.Inventory.Tests
- ContentVixen.Gameplay.Inventory.Tests