Wire sick-teacher stay-home into cancelled lessons.
Heavy flu keeps the assigned teacher off the day plan; pupils get 48/73 no-teacher marks and a one-shot LessonCancelled notice instead of silent empty rooms.
This commit is contained in:
@@ -54,6 +54,8 @@ internal static class LessonLearningSystem
|
||||
teacherSkills[identity.Id] = personSkills.Values;
|
||||
});
|
||||
|
||||
RaiseSickTeacherLessons(school, places, weekday, slot.Index);
|
||||
|
||||
world.Query(
|
||||
in People,
|
||||
(ref PersonIdentity identity, ref PersonSkills skills, ref PersonTraits traits, ref PersonNeeds needs, ref PersonRoles roles, ref Presence presence, ref PersonActivity activity) =>
|
||||
@@ -208,6 +210,56 @@ internal static class LessonLearningSystem
|
||||
&& teacher.NodeId is not null
|
||||
&& teacher.NodeId.Equals(roomId, StringComparison.Ordinal);
|
||||
|
||||
/// <summary>
|
||||
/// One school toast per class slot when the assigned teacher stayed home sick (slice 15).
|
||||
/// Uses the morning day plan — re-rolling <see cref="DiseaseEffects.ShouldStayHome"/> at
|
||||
/// lesson time can flip after severity ticks. Toilet trips keep the per-pupil log only.
|
||||
/// </summary>
|
||||
private static void RaiseSickTeacherLessons(
|
||||
School school,
|
||||
Dictionary<string, Presence> places,
|
||||
int weekday,
|
||||
int period)
|
||||
{
|
||||
if (school.Timetable is null || school.Roster is null || school.Catalog is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var lesson in school.Timetable.Lessons)
|
||||
{
|
||||
if (lesson.Day != weekday || lesson.Period != period)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (TeacherStandingIn(places, lesson.TeacherId, lesson.RoomId))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!school.Plans.TryGetValue(lesson.TeacherId, out var plan) || plan.Comes)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var teacher = school.Roster.People.FirstOrDefault(row =>
|
||||
row.Id.Equals(lesson.TeacherId, StringComparison.Ordinal));
|
||||
if (teacher is null
|
||||
|| DiseaseEffects.StayHomeChance(teacher, school.Catalog, school.Clock.Time) <= 0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!school.TryClaimLessonNoTeacherEvent(lesson.ClassId, school.Clock.Time.Date, lesson.Period))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
school.RaiseWorldEvent(new WorldEvent(EventTriggers.LessonNoTeacher, lesson.TeacherId));
|
||||
}
|
||||
}
|
||||
|
||||
private static LessonPlacement? CurrentLesson(School school, Person person, int weekday, int period)
|
||||
{
|
||||
foreach (var lesson in Duty.LessonsToday(person, ClassOf(school, person), school.Timetable, weekday))
|
||||
|
||||
Reference in New Issue
Block a user