Vixen
caa30e12
csharp
public sealed class Container

A fixed number of slots, a policy, and — for an equipment set — a tag per slot.

Read the guide page for this →

Remarks

⚠ The slots array is not exposed for writing, and that is the point of the type. Everything that changes a container goes through Apply, because a mutation that is not part of a transaction is a mutation that cannot be rolled back — and a half-applied move is exactly how an item ends up in two places or in none.

Fields and properties (8)

  • public ContainerId Id

    What it is called.

  • public int Capacity

    How many slots it has.

  • public ContainerPolicy Policy

    What it takes.

  • public bool IsSlotted

    Whether it is an equipment set — one tag per slot.

  • public ReadOnlySpan<ItemInstance> Slots

    What is in it.

  • public ItemInstance this[int slot]

    What is in one slot.

  • public int FreeSlots

    How many slots hold nothing.

  • public int TotalItems

    How many items it holds in total, stacks summed.

Methods (3)

  • public Container(ContainerId id, int capacity, ContainerPolicy? policy = null, GameplayTag[]? slotTags = null)

    Makes a container.

  • public GameplayTag SlotTag(int slot)

    Which slot tag a slot demands.

  • public int CountOf(DefId definition)

    How many of an item it holds, summed over every slot.

Used by (6)

  • AtomicityTestsVixen.Gameplay.Inventory.Tests
  • BindingTestsVixen.Gameplay.Inventory.Tests
  • ConservationOracleTestsVixen.Gameplay.Inventory.Tests
  • ContainerBasicsTestsVixen.Gameplay.Inventory.Tests
  • ContainerSetVixen.Gameplay.Inventory
  • ContainerTransactionTestsVixen.Gameplay.Inventory.Tests