Merge branch 'phase/73-lesson-marks'
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -683,6 +683,45 @@ internal static class PeopleDefValidator
|
||||
throw new ContentLoadException(
|
||||
$"BehaviorDef '{behavior.DefName}' directorHearingMinutes must be positive.");
|
||||
}
|
||||
|
||||
if (behavior.LessonMarkMax < 0)
|
||||
{
|
||||
throw new ContentLoadException($"BehaviorDef '{behavior.DefName}' lessonMarkMax cannot be negative.");
|
||||
}
|
||||
|
||||
if (behavior.LessonMarkWhenNoTeacher is { } absent
|
||||
&& absent is < 2 or > 5)
|
||||
{
|
||||
throw new ContentLoadException(
|
||||
$"BehaviorDef '{behavior.DefName}' lessonMarkWhenNoTeacher must be 2–5 or null.");
|
||||
}
|
||||
|
||||
if (behavior.LessonMarkThresholds.Count > 0)
|
||||
{
|
||||
if (behavior.LessonMarkThresholds.Count != 3)
|
||||
{
|
||||
throw new ContentLoadException(
|
||||
$"BehaviorDef '{behavior.DefName}' lessonMarkThresholds must list three floors (5, 4, 3).");
|
||||
}
|
||||
|
||||
float? previous = null;
|
||||
foreach (var floor in behavior.LessonMarkThresholds)
|
||||
{
|
||||
if (floor is < 0f or > 1f)
|
||||
{
|
||||
throw new ContentLoadException(
|
||||
$"BehaviorDef '{behavior.DefName}' lessonMarkThresholds must be 0–1.");
|
||||
}
|
||||
|
||||
if (previous is { } prior && floor > prior)
|
||||
{
|
||||
throw new ContentLoadException(
|
||||
$"BehaviorDef '{behavior.DefName}' lessonMarkThresholds must be descending.");
|
||||
}
|
||||
|
||||
previous = floor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ValidateTopic(TopicDef topic, DefCatalog catalog)
|
||||
|
||||
Reference in New Issue
Block a user