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
@@ -97,6 +97,42 @@ public class BehaviorDefTests
Assert.Contains("lessonNoTextbookFactor", error.Message, StringComparison.Ordinal);
}
[Fact]
public void MissingCommuteWeatherMinutes_DefaultToZero()
{
var catalog = _loader.Load(
[CatalogLoader.CorePackId],
[
PackDocuments.Def(
CatalogLoader.CorePackId,
"behavior",
"rules",
"""{ "defName": "Behavior", "needThreshold": 0.35, "lessonSkillPerHour": 0.05, "commuteSlackMin": 0, "commuteSlackMax": 6, "switchMargin": 0.15 }"""),
]);
Assert.NotNull(catalog.BehaviorRules);
Assert.Equal(0, catalog.BehaviorRules.CommuteRainMinutes);
Assert.Equal(0, catalog.BehaviorRules.CommuteSnowMinutes);
}
[Theory]
[InlineData("commuteRainMinutes")]
[InlineData("commuteSnowMinutes")]
public void NegativeCommuteWeatherMinutes_FailsTheCatalog(string field)
{
var error = Assert.Throws<ContentLoadException>(() => _loader.Load(
[CatalogLoader.CorePackId],
[
PackDocuments.Def(
CatalogLoader.CorePackId,
"behavior",
"rules",
$$"""{ "defName": "Behavior", "{{field}}": -1 }"""),
]));
Assert.Contains("cannot be negative", error.Message, StringComparison.OrdinalIgnoreCase);
}
[Fact]
public void NegativeApparelWear_FailsTheCatalog()
{