Class SceneObjectNameResolver
The pure half of scene-object naming: given settings, a race, a seed and a gender, produce the name. Both peers run exactly this from the same inputs, which is what lets the server ship a 4-byte seed instead of a string.
public static class SceneObjectNameResolver
- Inheritance
-
SceneObjectNameResolver
- Inherited Members
Methods
DeriveSeed(SceneObjectNamingSettings, string)
The seed a name is generated from. With a region seed it is a stable hash of region + object, so the same object gets the same name on every server start; otherwise it is a fresh draw per spawn. Never zero — zero is the wire's "no generated name" sentinel.
public static int DeriveSeed(SceneObjectNamingSettings settings, string fallbackObjectSeed)
Parameters
settingsSceneObjectNamingSettingsfallbackObjectSeedstring
Returns
GenderRng(int)
An RNG for the gender roll, kept apart from the name draw so changing the gender policy does not reshuffle names.
public static DeterministicRNG GenderRng(int seed)
Parameters
seedint
Returns
ResolveBiome(SceneObjectNamingSettings, Vector3, WorldSceneSettings, out BiomeClimateVariant)
Builds the name. Returns false, with a reason, when the inputs cannot name the object — no templates loaded, no race for a race-driven mode, no biome for a biome-driven mode — so the caller can keep the authored name instead of guessing.
public static BiomeTemplate ResolveBiome(SceneObjectNamingSettings settings, Vector3 worldPosition, WorldSceneSettings scene, out BiomeClimateVariant variant)
Parameters
settingsSceneObjectNamingSettingsworldPositionVector3sceneWorldSceneSettingsvariantBiomeClimateVariant
Returns
ResolveGender(NamingGenderPolicy, RaceTemplate, DeterministicRNG)
Picks the gender for a name under the given policy. RaceModels draws only among genders the race actually has models for, so a male-only race never receives a feminine name; a race with no gendered sets falls back to a coin flip.
public static CharacterGender ResolveGender(NamingGenderPolicy policy, RaceTemplate race, DeterministicRNG rng)
Parameters
policyNamingGenderPolicyraceRaceTemplaterngDeterministicRNG
Returns
ResolveRace(SceneObjectNamingSettings, IFactionController)
The race a namer draws from: the explicit override when set, else the faction's race.
public static RaceTemplate ResolveRace(SceneObjectNamingSettings settings, IFactionController faction)
Parameters
settingsSceneObjectNamingSettingsfactionIFactionController
Returns
TryBuild(SceneObjectNamingSettings, RaceTemplate, int, CharacterGender, out string, out string, string, BiomeTemplate, BiomeClimateVariant)
public static bool TryBuild(SceneObjectNamingSettings settings, RaceTemplate race, int seed, CharacterGender gender, out string name, out string error, string autoProfession = null, BiomeTemplate biome = null, BiomeClimateVariant variant = null)
Parameters
settingsSceneObjectNamingSettingsraceRaceTemplateseedintgenderCharacterGendernamestringerrorstringautoProfessionstringProfession to use when the settings name none — the interactable's title, typically.
biomeBiomeTemplateThe biome to name from, already resolved by ResolveBiome(SceneObjectNamingSettings, Vector3, WorldSceneSettings, out BiomeClimateVariant); null to use only the settings' explicit biome.
variantBiomeClimateVariantThe climate variant the place reads under; null for none.
Returns
VariantAt(BiomeTemplate, WorldSceneSettings, byte)
The variant a wire index names, or null.
public static BiomeClimateVariant VariantAt(BiomeTemplate biome, WorldSceneSettings scene, byte index)
Parameters
biomeBiomeTemplatesceneWorldSceneSettingsindexbyte
Returns
VariantIndexOf(BiomeTemplate, WorldSceneSettings, BiomeClimateVariant)
Index of a variant in VariantsFor(BiomeTemplate, WorldSceneSettings) plus one; 0 when it is not one of them. What the wire carries.
public static byte VariantIndexOf(BiomeTemplate biome, WorldSceneSettings scene, BiomeClimateVariant variant)
Parameters
biomeBiomeTemplatesceneWorldSceneSettingsvariantBiomeClimateVariant
Returns
VariantsFor(BiomeTemplate, WorldSceneSettings)
The variants a biome can show under a scene: its own, else the scene climate's defaults.
public static IReadOnlyList<BiomeClimateVariant> VariantsFor(BiomeTemplate biome, WorldSceneSettings scene)
Parameters
biomeBiomeTemplatesceneWorldSceneSettings