Enhance protocol and simulation features with activity tracking and behavior definitions

- Updated protocol documentation to include new `activity` and `activityLabel` fields in the person card response, reflecting real-time activity status.
- Introduced `BehaviorDef` to define behavior rules, including need thresholds and lesson skill gains, enhancing AI decision-making.
- Revised the `DefCatalog` to incorporate behavior definitions and updated validation logic to ensure proper behavior handling.
- Enhanced the simulation to manage presence and activity states, allowing for more dynamic interactions within the school environment.
- Updated tests to validate the new activity tracking and behavior functionalities, ensuring robust performance and reliability.
- Improved localization strings to support new activity and behavior features, enhancing user experience.
This commit is contained in:
Leonid Pershin
2026-08-19 19:49:44 +03:00
parent 3c54f981b7
commit b135a9caad
42 changed files with 1134 additions and 59 deletions
+28
View File
@@ -201,6 +201,28 @@ public sealed class StaffingDef : Def
public float WeeksPerMonth { get; init; }
}
/// <summary>
/// One school's behaviour numbers: when a need is urgent, how fast lessons teach, commute slack,
/// and how much a new goal must beat the current one before a person switches. A catalog may have
/// only one concrete ruleset.
/// </summary>
public sealed class BehaviorDef : Def
{
/// <summary>A need at or below this value is urgent. Phase 21 turns that into a goal weight.</summary>
public float NeedThreshold { get; init; }
/// <summary>Skill points a lesson adds per game hour, before traits and need state. Unused until phase 21.</summary>
public float LessonSkillPerHour { get; init; }
/// <summary>Inclusive range of extra commute minutes rolled per person per day.</summary>
public int CommuteSlackMin { get; init; }
public int CommuteSlackMax { get; init; }
/// <summary>A new goal must beat the current one by this much before the person switches.</summary>
public float SwitchMargin { get; init; }
}
public enum BodyAttributeKind
{
Number,
@@ -252,6 +274,12 @@ public sealed class NeedDef : Def
public float Min { get; init; }
public float Max { get; init; } = 1;
/// <summary>
/// When true, this need snaps to <see cref="Max"/> off campus instead of draining. Sleep
/// restores overnight; hunger does not keep falling at home.
/// </summary>
public bool RestoredOffCampus { get; init; }
}
public sealed class CaseTable