Implement yearly intake functionality in school simulation, allowing for the graduation of students and the addition of new first-year pupils. Update the roster management to reflect these changes, ensuring proper entity handling in the simulation. Enhance the API to support name sets during roster installation and revise related tests to validate the new intake process and roster updates.
ci / server (push) Failing after 3m40s
ci / client (push) Failing after 20s

This commit is contained in:
Leonid Pershin
2026-08-18 19:57:59 +03:00
parent 533bd80f5e
commit 7f6852548d
12 changed files with 600 additions and 17 deletions
+9 -2
View File
@@ -239,6 +239,7 @@ internal sealed class SchoolWorker
var lastTimestamp = Stopwatch.GetTimestamp();
var accumulator = 0d;
var lastSave = lastTimestamp;
var peopleChanged = false;
try
{
@@ -256,10 +257,11 @@ internal sealed class SchoolWorker
lastTimestamp = now;
var steps = 0;
peopleChanged = false;
while (accumulator >= fixedDelta && steps < MaxCatchUpSteps)
{
var stepStarted = Stopwatch.GetTimestamp();
school.Tick(fixedDelta, _options.GameMinutesPerRealSecond);
peopleChanged |= school.Tick(fixedDelta, _options.GameMinutesPerRealSecond);
_metrics.RecordTick(Stopwatch.GetElapsedTime(stepStarted, Stopwatch.GetTimestamp()).TotalMilliseconds);
accumulator -= fixedDelta;
@@ -275,6 +277,11 @@ internal sealed class SchoolWorker
accumulator = 0d;
}
if (peopleChanged)
{
PersistPeople();
}
if (steps > 0)
{
PublishSnapshot();
@@ -508,7 +515,7 @@ internal sealed class SchoolWorker
$"School {_id} roster does not match its map; the people file was left untouched.");
}
school.InstallPeople(roster, seed);
school.InstallPeople(roster, seed, nameSetId);
return generated;
}