public sealed class ContainerTransactionA set of moves that happen entirely or not at all.
Remarks
Doc 28 § Inventory: "every mutation is a transaction over a set of containers". Move, split, merge, swap and equip are not five operations — they are Move with different counts and destinations, which is why there is one validator and one place a duplication bug could be.
⚠ Atomicity is the whole reason the type exists, and it is not an optimisation to skip it. A two-step move — take from the bank, put in the bag — that fails on the second step has destroyed an item; one that applies the second step first has duplicated it. The transaction snapshots every container it touches before the first step and restores them all if any step fails.
Fields and properties (1)
public int CountHow many steps it has.
Methods (5)
public ContainerTransaction Move(SlotRef from, SlotRef to, int count = 0)Moves some or all of a stack to a named slot.
public ContainerTransaction Swap(SlotRef left, SlotRef right)Exchanges what is in two slots.
public ContainerTransaction Insert(SlotRef to, ItemInstance item)Puts an item into a named slot.
public ContainerTransaction Add(ContainerId container, ItemInstance item)Puts an item anywhere in a container that will take it, filling stacks first.
public ContainerTransaction Remove(SlotRef from, int count = 0)Destroys some or all of a stack.
Used by (5)
- AtomicityTestsVixen.Gameplay.Inventory.Tests
- BindingTestsVixen.Gameplay.Inventory.Tests
- ConservationOracleTestsVixen.Gameplay.Inventory.Tests
- ContainerSetVixen.Gameplay.Inventory
- ContainerTransactionTestsVixen.Gameplay.Inventory.Tests