Add rain and snow minutes to the morning commute.

Day plans take a precomputed extra; Ai does not know precipitation.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-20 09:40:24 +03:00
co-authored by Cursor
parent fbac890be2
commit ce71a91a67
11 changed files with 189 additions and 16 deletions
+21
View File
@@ -1,3 +1,5 @@
using HSchool.Content;
namespace HSchool.Simulation;
/// <summary>Street precipitation. Below 0 °C the same roll is snow, above it is rain.</summary>
@@ -17,4 +19,23 @@ public readonly record struct OutdoorWeather(float TemperatureC, Precipitation P
Math.Round(TemperatureC * 10d, MidpointRounding.AwayFromZero),
short.MinValue,
short.MaxValue);
/// <summary>
/// Extra commute minutes for today's street. Ai receives this number; it does not see
/// precipitation. A pack without the fields adds nothing.
/// </summary>
public int ExtraCommuteMinutes(BehaviorDef? rules)
{
if (rules is null)
{
return 0;
}
return Precipitation switch
{
Precipitation.Rain => rules.CommuteRainMinutes,
Precipitation.Snow => rules.CommuteSnowMinutes,
_ => 0,
};
}
}
+2 -1
View File
@@ -217,7 +217,8 @@ internal static class PresenceSystem
school.Timetable,
school.Clock.Time,
school.SchoolWeekDays,
school.PeopleSeed);
school.PeopleSeed,
school.Weather.ExtraCommuteMinutes(school.Catalog!.BehaviorRules));
}
school.DecisionQueue.Clear();