Split the person card into overview, clothes, carry and now tabs.
Today's history is a paged HTTP log on the worker, not on the card or in people.json. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,6 +16,7 @@ public sealed class School : IDisposable
|
||||
public const int MaxNameLength = 40;
|
||||
|
||||
private bool _disposed;
|
||||
private readonly List<PersonLogEvent> _dayLog = [];
|
||||
|
||||
internal School(int id, string name, DateTime startDate, DefCatalog? catalog, MapLayout? map)
|
||||
{
|
||||
@@ -111,6 +112,21 @@ public sealed class School : IDisposable
|
||||
|
||||
public int PendingDecisionCount => DecisionQueue.Count;
|
||||
|
||||
/// <summary>
|
||||
/// Today's history for the person card. Cleared at six in the morning. Not written to disk.
|
||||
/// </summary>
|
||||
public IReadOnlyList<PersonLogEvent> DayLog => _dayLog;
|
||||
|
||||
internal Dictionary<string, string?> LoggedActivity { get; } = new(StringComparer.Ordinal);
|
||||
|
||||
internal void ResetDayLog()
|
||||
{
|
||||
_dayLog.Clear();
|
||||
LoggedActivity.Clear();
|
||||
}
|
||||
|
||||
internal void AppendDayLog(PersonLogEvent row) => _dayLog.Add(row);
|
||||
|
||||
public void QueueDecision(string personId)
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
@@ -137,6 +153,7 @@ public sealed class School : IDisposable
|
||||
LastDecisionSlot = null;
|
||||
Plans.Clear();
|
||||
DecisionQueue.Clear();
|
||||
LoggedActivity.Clear();
|
||||
}
|
||||
|
||||
public bool TryStartAction(string personId, string actionId)
|
||||
@@ -144,7 +161,13 @@ public sealed class School : IDisposable
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(personId);
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(actionId);
|
||||
return ActivitySystem.TryStart(this, personId, actionId);
|
||||
var started = ActivitySystem.TryStart(this, personId, actionId);
|
||||
if (started)
|
||||
{
|
||||
PersonDayLog.Sync(this);
|
||||
}
|
||||
|
||||
return started;
|
||||
}
|
||||
|
||||
public void ConfigurePresence(int weekDays = 5, int maxDecisionsPerTick = 64, int maxSkipDays = 400)
|
||||
@@ -203,6 +226,7 @@ public sealed class School : IDisposable
|
||||
|
||||
var before = Clock.Time;
|
||||
Clock.JumpTo(next.Value);
|
||||
ResetDayLog();
|
||||
var peopleChanged = TryYearlyIntake(before, next.Value);
|
||||
peopleChanged |= TryApplicantRefresh();
|
||||
PlanDay = null;
|
||||
@@ -257,6 +281,11 @@ public sealed class School : IDisposable
|
||||
var peopleChanged = false;
|
||||
if (gameMinutes > 0)
|
||||
{
|
||||
if (PersonDayLog.CrossedDayStart(before, Clock.Time))
|
||||
{
|
||||
ResetDayLog();
|
||||
}
|
||||
|
||||
peopleChanged = TryYearlyIntake(before, Clock.Time);
|
||||
peopleChanged |= TryApplicantRefresh();
|
||||
if (peopleChanged)
|
||||
@@ -271,6 +300,8 @@ public sealed class School : IDisposable
|
||||
PresenceSystem.Enqueue(this, id);
|
||||
}
|
||||
|
||||
PersonDayLog.Sync(this);
|
||||
|
||||
if (Catalog is not null)
|
||||
{
|
||||
var below = PresenceSystem.BelowThreshold(this);
|
||||
|
||||
Reference in New Issue
Block a user