Merge branch 'phase/77-health-conditions'

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-21 12:22:23 +03:00
co-authored by Cursor
9 changed files with 441 additions and 12 deletions
@@ -0,0 +1,26 @@
using HSchool.People;
namespace HSchool.Simulation;
/// <summary>
/// Ticks medical condition severity on the roster. Contagion and DiseaseDef outbreaks are later phases.
/// </summary>
internal static class HealthConditionSystem
{
public static bool Apply(School school, double gameMinutes)
{
if (gameMinutes <= 0 || school.Roster is null)
{
return false;
}
var dayNumber = DateOnly.FromDateTime(school.Clock.Time).DayNumber;
var changed = false;
foreach (var person in school.Roster.People)
{
changed |= HealthConditions.Tick(person, school.PeopleSeed, dayNumber, gameMinutes);
}
return changed;
}
}
+2 -1
View File
@@ -367,7 +367,7 @@ public sealed class School : IDisposable
}
}
/// <summary>Runs one fixed step of the school: calendar, yearly intake, applicant refresh, presence, actions, need decay, then apparel wear.</summary>
/// <summary>Runs one fixed step of the school: calendar, yearly intake, applicant refresh, presence, actions, need decay, apparel wear, then health conditions.</summary>
/// <returns><see langword="true"/> when the roster, applicant pool or wardrobe changed this step.</returns>
public bool Tick(double deltaTime, double gameMinutesPerRealSecond)
{
@@ -465,6 +465,7 @@ public sealed class School : IDisposable
peopleChanged |= AffinitySystem.Apply(this, talked);
}
peopleChanged |= HealthConditionSystem.Apply(this, gameMinutes);
peopleChanged |= RosterTalkDirty;
RosterTalkDirty = false;
return peopleChanged;