Table of Contents

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

int

SupportedRaces

Registered race keys in ordinal order, so iteration is deterministic.

public static IReadOnlyList<string> SupportedRaces { get; }

Property Value

IReadOnlyList<string>

Methods

AllTags()

Every tag used by any registered race, in ordinal order.

public static IReadOnlyList<string> AllTags()

Returns

IReadOnlyList<string>

Categories()

Every category carried by a registered race, in ordinal order.

public static IReadOnlyList<string> Categories()

Returns

IReadOnlyList<string>

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

raceKey string

Returns

bool

Get(string)

The race for a key, or null when none is registered.

public static RaceTemplate Get(string raceKey)

Parameters

raceKey string

Returns

RaceTemplate

GetCultures(string)

Culture keys available for a race, in ordinal order.

public static IReadOnlyList<string> GetCultures(string raceKey)

Parameters

raceKey string

Returns

IReadOnlyList<string>

GetDisplayName(string)

Display name for a race key, or the key itself when the race is unknown.

public static string GetDisplayName(string raceKey)

Parameters

raceKey string

Returns

string

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

template RaceTemplate

Returns

int

PresentationCount()

Races × cultures-per-race × modifiers: how many distinct name profiles are available.

public static int PresentationCount()

Returns

int

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

biomeID int

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

category string

Returns

IReadOnlyList<string>

RacesWithTag(string)

Races whose phonology carries the given tag.

public static IReadOnlyList<string> RacesWithTag(string tag)

Parameters

tag string

Returns

IReadOnlyList<string>

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

template RaceTemplate

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

template RaceTemplate
culture string
modifier string

Returns

RacePhonology

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

raceKey string
culture string

Returns

RacePhonology

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

raceKey string
culture string
modifier string

Returns

RacePhonology

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

raceKey string
template RaceTemplate

Returns

bool

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

id int
template RaceTemplate

Returns

bool

TryGetCitySuffixes(string, out RaceCitySuffixes)

public static bool TryGetCitySuffixes(string raceKey, out RaceCitySuffixes suffixes)

Parameters

raceKey string
suffixes RaceCitySuffixes

Returns

bool

TryGetPlaces(string, out string[])

public static bool TryGetPlaces(string raceKey, out string[] places)

Parameters

raceKey string
places string[]

Returns

bool

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

raceKey string
titles RaceTitles

Returns

bool

Unregister(RaceTemplate)

Removes a race, but only if it is still the holder of its key.

public static void Unregister(RaceTemplate template)

Parameters

template RaceTemplate

Events

Changed

Raised after a race is registered or removed.

public static event Action Changed

Event Type

Action