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:
@@ -65,13 +65,16 @@ internal static class LessonLearningSystem
|
||||
var hunger = needs.Values.GetValueOrDefault("Hunger", 1f);
|
||||
foreach (var share in subject.Skills)
|
||||
{
|
||||
if (!catalog.Skills.TryGetValue(share.Skill, out var skill)
|
||||
|| skill.Abstract
|
||||
|| !skills.Values.TryGetValue(share.Skill, out var current))
|
||||
if (!catalog.Skills.TryGetValue(share.Skill, out var skill) || skill.Abstract)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!skills.Values.TryGetValue(share.Skill, out var current))
|
||||
{
|
||||
current = skill.Range.Min;
|
||||
}
|
||||
|
||||
skills.Values[share.Skill] = LessonLearning.Gain(
|
||||
current,
|
||||
skill,
|
||||
|
||||
@@ -78,6 +78,9 @@ public sealed class School : IDisposable
|
||||
/// <summary>Name pack used to generate this school's people. Needed again on 1 September.</summary>
|
||||
public string? NameSetId { get; private set; }
|
||||
|
||||
/// <summary>Skill everyone generated for this school speaks natively.</summary>
|
||||
public string? NativeLanguage { get; private set; }
|
||||
|
||||
/// <summary>Last built table. Null until the worker installs people.</summary>
|
||||
public Timetable? Timetable { get; private set; }
|
||||
|
||||
@@ -115,7 +118,7 @@ public sealed class School : IDisposable
|
||||
/// <summary>
|
||||
/// Installs a roster that already matches the map. Spawns entities; does not write to disk.
|
||||
/// </summary>
|
||||
public void InstallPeople(Roster roster, int seed, string? nameSetId = null, ApplicantPool? applicants = null)
|
||||
public void InstallPeople(Roster roster, int seed, string? nameSetId = null, ApplicantPool? applicants = null, string? nativeLanguage = null)
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
ArgumentNullException.ThrowIfNull(roster);
|
||||
@@ -123,6 +126,7 @@ public sealed class School : IDisposable
|
||||
Roster = roster;
|
||||
PeopleSeed = seed;
|
||||
NameSetId = nameSetId;
|
||||
NativeLanguage = nativeLanguage;
|
||||
Applicants = applicants;
|
||||
RosterSpawner.Spawn(World, roster);
|
||||
PlanDay = null;
|
||||
@@ -282,7 +286,7 @@ public sealed class School : IDisposable
|
||||
var changed = false;
|
||||
foreach (var date in YearlyIntake.DatesBetween(before, after))
|
||||
{
|
||||
Roster = YearlyIntake.Apply(Catalog, Roster, PeopleSeed, NameSetId, date);
|
||||
Roster = YearlyIntake.Apply(Catalog, Roster, PeopleSeed, NameSetId, date, NativeLanguage);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
@@ -304,7 +308,7 @@ public sealed class School : IDisposable
|
||||
return false;
|
||||
}
|
||||
|
||||
var next = Applicants.Advance(Catalog, Roster, PeopleSeed, NameSetId, Clock.Time);
|
||||
var next = Applicants.Advance(Catalog, Roster, PeopleSeed, NameSetId, Clock.Time, NativeLanguage);
|
||||
if (next.Week == Applicants.Week)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -11,6 +11,7 @@ public enum SchoolCreationError
|
||||
UnknownMod,
|
||||
InvalidCatalog,
|
||||
UnknownNameSet,
|
||||
UnknownNativeLanguage,
|
||||
}
|
||||
|
||||
/// <summary>Outcome of <see cref="SchoolRegistry.Create"/>: either the school or the reason there is none.</summary>
|
||||
|
||||
Reference in New Issue
Block a user