Files
h-school/src/HSchool.People/CountryClimate.cs
T
Leonid PershinandCursor 1b66c89cd7 Replace selectable name sets with a country that owns names and climate presets.
Create picks a country; climate is rolled from the school seed and stored. Old Slavic saves lift as Russia.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 02:55:13 +03:00

27 lines
778 B
C#

namespace HSchool.People;
/// <summary>
/// A country lists climate presets; the school rolls one at birth from the school seed.
/// Reloads without a stored pick take the first listed preset so old saves stay put.
/// </summary>
public static class CountryClimate
{
public static string? Pick(CountryDef country, int schoolSeed, bool rollIfOmitted)
{
ArgumentNullException.ThrowIfNull(country);
var presets = country.ClimatePresets;
if (presets.Count == 0)
{
return null;
}
if (!rollIfOmitted || presets.Count == 1)
{
return presets[0];
}
var rng = new Random(Seed.ForSchool(schoolSeed, Seed.ClimatePresetSalt));
return presets[rng.Next(presets.Count)];
}
}