Enhance school creation and staffing management with native language support
- Updated protocol documentation to include `nativeLanguages` in `nameSets` and added `nativeLanguage` to school creation options. - Enhanced the UI for school creation to allow selection of native languages, improving user experience. - Revised API interfaces to accommodate new native language features, ensuring proper data handling. - Improved localization strings to support new native language functionalities in both English and Russian. - Updated tests to validate the new native language features and ensure robust functionality in staffing scenarios.
This commit is contained in:
@@ -26,7 +26,7 @@ internal static class PeopleDefValidator
|
||||
|
||||
foreach (var names in catalog.NameSets.Values)
|
||||
{
|
||||
ValidateNameSet(names);
|
||||
ValidateNameSet(names, catalog);
|
||||
}
|
||||
|
||||
foreach (var subject in catalog.Subjects.Values)
|
||||
@@ -171,6 +171,11 @@ internal static class PeopleDefValidator
|
||||
throw new ContentLoadException($"SkillDef '{skill.DefName}' has a negative stdDev.");
|
||||
}
|
||||
|
||||
if (skill.AdultChance is < 0 or > 1)
|
||||
{
|
||||
throw new ContentLoadException($"SkillDef '{skill.DefName}' adultChance must be 0–1.");
|
||||
}
|
||||
|
||||
foreach (var limit in skill.BodyLimits)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(limit.Attribute))
|
||||
@@ -500,13 +505,41 @@ internal static class PeopleDefValidator
|
||||
}
|
||||
}
|
||||
|
||||
private static void ValidateNameSet(NameSetDef names)
|
||||
private static void ValidateNameSet(NameSetDef names, DefCatalog catalog)
|
||||
{
|
||||
if (!NameGrammar.IsKnownPatronymic(names.PatronymicRule))
|
||||
{
|
||||
throw new ContentLoadException($"NameSetDef '{names.DefName}' has unknown patronymicRule '{names.PatronymicRule}'.");
|
||||
}
|
||||
|
||||
foreach (var native in names.Spoken)
|
||||
{
|
||||
if (!catalog.Skills.TryGetValue(native, out var language) || language.Abstract)
|
||||
{
|
||||
throw new ContentLoadException($"NameSetDef '{names.DefName}' native language '{native}' is not a SkillDef.");
|
||||
}
|
||||
}
|
||||
|
||||
if (names.RelatedLanguageChance is < 0 or > 1)
|
||||
{
|
||||
throw new ContentLoadException($"NameSetDef '{names.DefName}' relatedLanguageChance must be 0–1.");
|
||||
}
|
||||
|
||||
if (names.RelatedLanguageStdDev < 0)
|
||||
{
|
||||
throw new ContentLoadException($"NameSetDef '{names.DefName}' relatedLanguageStdDev must not be negative.");
|
||||
}
|
||||
|
||||
if (names.RelatedLanguageMean < 0)
|
||||
{
|
||||
throw new ContentLoadException($"NameSetDef '{names.DefName}' relatedLanguageMean must not be negative.");
|
||||
}
|
||||
|
||||
if (names.RelatedLanguageMax < 0)
|
||||
{
|
||||
throw new ContentLoadException($"NameSetDef '{names.DefName}' relatedLanguageMax must not be negative.");
|
||||
}
|
||||
|
||||
if (!NameGrammar.IsKnownGiven(names.DefaultGivenDeclension))
|
||||
{
|
||||
throw new ContentLoadException($"NameSetDef '{names.DefName}' has unknown defaultGivenDeclension.");
|
||||
|
||||
Reference in New Issue
Block a user