Grow lesson skills only when the assigned teacher is standing in the room.

The timetable already named a teacher; learning ignored whether they were in the toilet, still walking, or not a person at all.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-20 08:33:28 +03:00
co-authored by Cursor
parent 936d6fb04f
commit fbc32f2bfc
9 changed files with 312 additions and 18 deletions
+17
View File
@@ -17,6 +17,7 @@ public sealed class School : IDisposable
private bool _disposed;
private readonly List<PersonLogEvent> _dayLog = [];
private readonly HashSet<string> _lessonLogOnce = new(StringComparer.Ordinal);
internal School(int id, string name, DateTime startDate, DefCatalog? catalog, MapLayout? map)
{
@@ -135,10 +136,26 @@ public sealed class School : IDisposable
{
_dayLog.Clear();
LoggedActivity.Clear();
_lessonLogOnce.Clear();
}
internal void AppendDayLog(PersonLogEvent row) => _dayLog.Add(row);
/// <summary>
/// Lesson-quality rows fire every tick the condition holds. One key per person per day is enough.
/// </summary>
internal bool TryLogLessonOnce(string personId, string type, string subject)
{
var key = string.Concat(personId, "\0", type, "\0", subject);
if (!_lessonLogOnce.Add(key))
{
return false;
}
AppendDayLog(new PersonLogEvent(personId, Clock.Time, type, subject));
return true;
}
public void QueueDecision(string personId)
{
ObjectDisposedException.ThrowIf(_disposed, this);