Add EventDef notices, morning and lesson bells, and info toasts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-20 20:46:33 +03:00
co-authored by Cursor
parent ea3f5c7bf1
commit a554738084
38 changed files with 952 additions and 22 deletions
+22
View File
@@ -18,6 +18,7 @@ public sealed class School : IDisposable
private bool _disposed;
private readonly List<PersonLogEvent> _dayLog = [];
private readonly HashSet<string> _lessonLogOnce = new(StringComparer.Ordinal);
private readonly List<WorldEvent> _worldEvents = [];
internal School(int id, string name, DateTime startDate, DefCatalog? catalog, MapLayout? map)
{
@@ -297,6 +298,7 @@ public sealed class School : IDisposable
NeedDecay.Apply(World, Catalog, (next.Value - before).TotalMinutes);
peopleChanged |= ApparelWear.Apply(this, gameMinutes: 0, before);
SyncWeather(force: true);
RecordWorldEvents(before, next.Value);
return new SkipEmptyResult(SkipEmptyError.None, next.Value, peopleChanged);
}
@@ -368,6 +370,8 @@ public sealed class School : IDisposable
var heavyMinutes = ClockSpeed.HeavyGameMinutes(Clock.SpeedIndex, gameMinutes);
peopleChanged |= ApplyHeavySystems(heavyMinutes);
}
RecordWorldEvents(before, Clock.Time);
}
else
{
@@ -377,6 +381,24 @@ public sealed class School : IDisposable
return peopleChanged;
}
/// <summary>Facts raised since the last drain. The worker maps them to notices; simulation has no UI.</summary>
public IReadOnlyList<WorldEvent> DrainWorldEvents()
{
if (_worldEvents.Count == 0)
{
return [];
}
var copy = _worldEvents.ToArray();
_worldEvents.Clear();
return copy;
}
private void RecordWorldEvents(DateTime before, DateTime after)
{
_worldEvents.AddRange(EventSystem.Detect(this, before, after));
}
private bool ApplyHeavySystems(double gameMinutes)
{
HeavySystemsInvocations++;