Add lesson attendance from presence (present/late/absent).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-21 12:37:01 +03:00
co-authored by Cursor
parent d3c2327e23
commit a2b35da4dd
12 changed files with 835 additions and 11 deletions
+11
View File
@@ -722,6 +722,17 @@ internal static class PeopleDefValidator
previous = floor;
}
}
if (behavior.AttendanceMax < 0)
{
throw new ContentLoadException($"BehaviorDef '{behavior.DefName}' attendanceMax cannot be negative.");
}
if (behavior.LessonLateMinutes < 0f)
{
throw new ContentLoadException(
$"BehaviorDef '{behavior.DefName}' lessonLateMinutes cannot be negative.");
}
}
private static void ValidateTopic(TopicDef topic, DefCatalog catalog)
+17
View File
@@ -619,6 +619,23 @@ public sealed class BehaviorDef : Def
/// </summary>
public int? LessonMarkWhenNoTeacher { get; init; } = 2;
/// <summary>
/// How many recent attendance rows a person keeps. Oldest drop first. Zero disables attendance.
/// </summary>
public int AttendanceMax { get; init; } = 40;
/// <summary>
/// Minutes after the bell: first standing in the room within this window is present;
/// later is late. Inclusive — arrival at exactly this many minutes still counts as present.
/// </summary>
public float LessonLateMinutes { get; init; } = 5f;
/// <summary>
/// When true (vanilla), a late arrival still receives a lesson mark if they are standing in
/// the room — stage A quality path. False skips the mark for late pupils.
/// </summary>
public bool LessonMarkWhenLate { get; init; } = true;
public static IReadOnlyList<float> DefaultLessonMarkThresholds { get; } =
[
0.85f,