public sealed class DefinitionRegistryThe shipped registry: one catalog, swappable while the frame runs.
Remarks
Doc 28's step 6 — "realms reload their definition registry live; no restart, no drain". A catalog is immutable, so a reload is a reference assignment and a reader either sees all of the old one or all of the new one. There is no lock on the read path.
⚠ Not every content change can be applied live, and the two that cannot are checked here. This is where doc 28's walk turned out to be optimistic:
A new tag renumbers the table, and every GameplayTag already sitting in a component, an effect or a packet in flight is an index into the old numbering. Adding an item that uses existing tags is live; adding an item that introduces a tag is a rolling update ([27](../../../docs/plan/27-mmo-framework.md) § Upgrades' build kind). A removed address is never additive. Doc 28 says so and this is where it is enforced: a stack in a bank naming a definition the catalog no longer has is unresolvable, and there is no reading of that which is not data loss. Deprecate, drain, then delete.
Everything else — a new address, a changed value, a retuned loot table — applies.
Fields and properties (3)
public DefinitionCatalog CatalogThe definitions in force right now.
public GameplayTagTable TagsThe tag table those definitions are numbered against.
public int GenerationHow many times a reload has been applied. What a diagnostic reports and a test asserts.
Methods (5)
public DefinitionRegistry(DefinitionCatalog? catalog = null)Makes a registry over a catalog.
public bool TryGet<TDefinition>(DefId id, out TDefinition? definition) where TDefinition : DefinitionFinds a definition and checks it is the kind the caller expected.
public TDefinition Get<TDefinition>(DefId id) where TDefinition : DefinitionFinds a definition, and refuses to carry on without it.
public void Reload(DefinitionCatalog next)Swaps in a new catalog, if the change is one that can be applied live.
public bool TryReload(DefinitionCatalog next, out string reason)Swaps in a new catalog, and says why not when it will not.
Used by (2)
- DefinitionContentTestsVixen.Gameplay.Content.Tests
- DefinitionRegistryTestsVixen.Gameplay.Tests