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:
@@ -120,6 +120,14 @@ public sealed class School : IDisposable
|
||||
DecisionQueue.Clear();
|
||||
}
|
||||
|
||||
public bool TryStartAction(string personId, string actionId)
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(personId);
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(actionId);
|
||||
return ActivitySystem.TryStart(this, personId, actionId);
|
||||
}
|
||||
|
||||
public void ConfigurePresence(int weekDays = 5, int maxDecisionsPerTick = 64, int maxSkipDays = 400)
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
@@ -180,6 +188,7 @@ public sealed class School : IDisposable
|
||||
peopleChanged |= TryApplicantRefresh();
|
||||
PlanDay = null;
|
||||
LastDecisionSlot = null;
|
||||
NeedDecay.Apply(World, Catalog, (next.Value - before).TotalMinutes);
|
||||
return new SkipEmptyResult(SkipEmptyError.None, next.Value, peopleChanged);
|
||||
}
|
||||
|
||||
@@ -214,7 +223,7 @@ public sealed class School : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Runs one fixed step of the school: calendar, yearly intake, applicant refresh, then need decay.</summary>
|
||||
/// <summary>Runs one fixed step of the school: calendar, yearly intake, applicant refresh, presence, actions, then need decay.</summary>
|
||||
/// <returns><see langword="true"/> when the roster or the applicant pool changed this step.</returns>
|
||||
public bool Tick(double deltaTime, double gameMinutesPerRealSecond)
|
||||
{
|
||||
@@ -234,6 +243,7 @@ public sealed class School : IDisposable
|
||||
}
|
||||
|
||||
PresenceSystem.Apply(this, gameMinutes);
|
||||
ActivitySystem.Apply(this, gameMinutes);
|
||||
if (Catalog is not null)
|
||||
{
|
||||
NeedDecay.Apply(World, Catalog, gameMinutes);
|
||||
|
||||
Reference in New Issue
Block a user