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:
@@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user