Class RaceRegistry
- Namespace
- FishMMO.Shared.NameGeneration
- Assembly
- FishMMO.Shared.dll
Runtime index of every loaded RaceTemplate that carries usable naming data, keyed by NamingKey. The registry holds no data of its own: races register as Addressables load them (or as the editor loader finds them) and leave when they unload.
public static class RaceRegistry
- Inheritance
-
RaceRegistry
- Inherited Members
Properties
Count
Number of races currently registered.
public static int Count { get; }
Property Value
SupportedRaces
Registered race keys in ordinal order, so iteration is deterministic.
public static IReadOnlyList<string> SupportedRaces { get; }
Property Value
Methods
AllTags()
Every tag used by any registered race, in ordinal order.
public static IReadOnlyList<string> AllTags()
Returns
Categories()
Every category carried by a registered race, in ordinal order.
public static IReadOnlyList<string> Categories()
Returns
Clear()
Removes every race. Tests and the editor loader use this before a fresh registration.
public static void Clear()
Contains(string)
public static bool Contains(string raceKey)
Parameters
raceKeystring
Returns
Get(string)
The race for a key, or null when none is registered.
public static RaceTemplate Get(string raceKey)
Parameters
raceKeystring
Returns
GetCultures(string)
Culture keys available for a race, in ordinal order.
public static IReadOnlyList<string> GetCultures(string raceKey)
Parameters
raceKeystring
Returns
GetDisplayName(string)
Display name for a race key, or the key itself when the race is unknown.
public static string GetDisplayName(string raceKey)
Parameters
raceKeystring
Returns
IDOf(RaceTemplate)
The template's cached-object ID, derived from its type and name when the cache has not assigned one.
public static int IDOf(RaceTemplate template)
Parameters
templateRaceTemplate
Returns
PresentationCount()
Races × cultures-per-race × modifiers: how many distinct name profiles are available.
public static int PresentationCount()
Returns
RacesForBiome(int)
Registered races with an affinity for a biome, with their weights, heaviest first (ties in key order). What a spawner asks to decide who lives here.
public static List<(RaceTemplate race, float weight)> RacesForBiome(int biomeID)
Parameters
biomeIDint
Returns
- List<(RaceTemplate race, float weight)>
RacesInCategory(string)
Keys of the races in a category (case-insensitive), in key order.
public static IReadOnlyList<string> RacesInCategory(string category)
Parameters
categorystring
Returns
RacesWithTag(string)
Races whose phonology carries the given tag.
public static IReadOnlyList<string> RacesWithTag(string tag)
Parameters
tagstring
Returns
Register(RaceTemplate)
Registers a race under its naming key. A race without usable naming data is ignored; a second race resolving to the same key replaces the first with a warning, since names would otherwise silently come from whichever loaded last.
public static void Register(RaceTemplate template)
Parameters
templateRaceTemplate
ResolvePhonology(RaceTemplate, string, string)
Resolves the phonology straight from a race, for callers that already hold one.
public static RacePhonology ResolvePhonology(RaceTemplate template, string culture, string modifier = null)
Parameters
templateRaceTemplateculturestringmodifierstring
Returns
ResolvePhonology(string, string)
Resolves the phonology for a race and optional culture. A culture the race does not have falls back to the race's own phonology.
public static RacePhonology ResolvePhonology(string raceKey, string culture)
Parameters
Returns
ResolvePhonology(string, string, string)
Resolves race + culture, then layers a modifier on top when one is named.
public static RacePhonology ResolvePhonology(string raceKey, string culture, string modifier)
Parameters
Returns
TryGet(string, out RaceTemplate)
Looks a race up by key; the key is normalised first, so "Wood Elf" finds "woodelf".
public static bool TryGet(string raceKey, out RaceTemplate template)
Parameters
raceKeystringtemplateRaceTemplate
Returns
TryGetByID(int, out RaceTemplate)
Looks a template up by its cached-object ID. Outside play mode nothing has called
AddToCache, so a template's own ID is still zero; the ID is then derived the way
the cache would derive it, which is also what a [TemplateReference] field stores.
public static bool TryGetByID(int id, out RaceTemplate template)
Parameters
idinttemplateRaceTemplate
Returns
TryGetCitySuffixes(string, out RaceCitySuffixes)
public static bool TryGetCitySuffixes(string raceKey, out RaceCitySuffixes suffixes)
Parameters
raceKeystringsuffixesRaceCitySuffixes
Returns
TryGetPlaces(string, out string[])
public static bool TryGetPlaces(string raceKey, out string[] places)
Parameters
Returns
TryGetTitles(string, out RaceTitles)
The race's titles merged with every title pool serving its category.
public static bool TryGetTitles(string raceKey, out RaceTitles titles)
Parameters
raceKeystringtitlesRaceTitles
Returns
Unregister(RaceTemplate)
Removes a race, but only if it is still the holder of its key.
public static void Unregister(RaceTemplate template)
Parameters
templateRaceTemplate
Events
Changed
Raised after a race is registered or removed.
public static event Action Changed