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
+1 -1
View File
@@ -281,7 +281,7 @@ internal sealed class GameLoopService(
return;
}
if (!SchoolRegistry.TryNormalizeName(command.Name, out var normalized))
if (!SchoolNames.TryNormalize(command.Name, out var normalized))
{
command.Result.TrySetResult(new SchoolCreationOutcome(null, SchoolCreationError.InvalidName));
return;
@@ -8,6 +8,8 @@
"needGain": 0.5,
"roles": ["student", "staff"],
"weight": 0,
// Only during this parallel's sitting, see the day frame.
"lunch": true,
},
{
"defName": "UseToilet",
@@ -6,4 +6,11 @@
"breakMinutes": 10,
"longBreakAfter": 3,
"longBreakMinutes": 20,
// Two sittings so the canteen is not the whole school at once: juniors eat after the
// third lesson, seniors after the fourth. Both breaks are long because somebody eats in
// them. A pack that wants one sitting just drops this list.
"lunchBreaks": [
{ "afterLesson": 3, "gradeMin": 1, "gradeMax": 5 },
{ "afterLesson": 4, "gradeMin": 6, "gradeMax": 11 },
],
}
@@ -1,6 +1,6 @@
[
{ "defName": "Sleep", "initial": 1, "decayPerHour": 0.05, "min": 0, "max": 1, "restoredOffCampus": true },
{ "defName": "Hunger", "initial": 1, "decayPerHour": 0.1, "min": 0, "max": 1 },
{ "defName": "Hunger", "initial": 1, "decayPerHour": 0.2, "min": 0, "max": 1, "restoredOffCampus": true },
{ "defName": "Toilet", "initial": 1, "decayPerHour": 0.15, "min": 0, "max": 1 },
{ "defName": "Social", "initial": 1, "decayPerHour": 0.08, "min": 0, "max": 1 },
]
@@ -85,7 +85,7 @@
"floor": "floor-1",
"slots": [
{ "key": "counter", "thing": "DiningTable" },
{ "key": "seats", "thing": "Chair", "count": 8 },
{ "key": "seats", "thing": "Chair", "count": 112 },
],
},
{ "id": "restroom-1", "def": "Restroom", "building": "main", "floor": "floor-1", "label": "1" },