Enhance school day structure and decision-making for lunch breaks
ci / server (push) Failing after 3m43s
ci / client (push) Successful in 15s

- Updated `ai.md` to clarify the mechanics of hunger restoration and the importance of lunch breaks in the school schedule.
- Revised `schedule.md` to detail the new lunch break structure, allowing for separate sittings for different grade levels.
- Enhanced `Decision.cs` and `DecisionPlanner.cs` to incorporate logic for lunch breaks, ensuring that students only leave lessons during their designated lunch windows.
- Updated `DayFrameDef` and related classes to support multiple lunch breaks and validate their configurations.
- Adjusted tests to validate the new decision-making logic regarding lunch breaks and hunger management, ensuring robust functionality.
- Improved localization strings to reflect changes in the school day structure and lunch functionalities.
This commit is contained in:
Leonid Pershin
2026-08-19 23:17:16 +03:00
parent a441ed9763
commit 5eabc90d53
33 changed files with 831 additions and 404 deletions
+25
View File
@@ -391,6 +391,31 @@ internal static class PeopleDefValidator
{
throw new ContentLoadException($"DayFrameDef '{frame.DefName}' longBreakAfter must be 0 or a lesson before the last.");
}
var fed = new HashSet<int>();
foreach (var sitting in frame.LunchBreaks)
{
if (sitting.AfterLesson < 1 || sitting.AfterLesson >= frame.LessonCount)
{
throw new ContentLoadException(
$"DayFrameDef '{frame.DefName}' has a lunch break after lesson {sitting.AfterLesson}; it must be a lesson before the last.");
}
if (sitting.GradeMin < 1 || sitting.GradeMax < sitting.GradeMin)
{
throw new ContentLoadException(
$"DayFrameDef '{frame.DefName}' has a lunch break with grades {sitting.GradeMin}{sitting.GradeMax}.");
}
for (var year = sitting.GradeMin; year <= sitting.GradeMax; year++)
{
if (!fed.Add(year))
{
throw new ContentLoadException(
$"DayFrameDef '{frame.DefName}' feeds grade {year} at two lunch breaks.");
}
}
}
}
private static void ValidateAction(ActionDef action, DefCatalog catalog)