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>
This commit is contained in:
@@ -122,7 +122,7 @@ internal sealed record CatalogResponse(
|
||||
IReadOnlyList<DefInfoResponse> Floors,
|
||||
IReadOnlyList<RoomInfoResponse> Rooms,
|
||||
IReadOnlyList<DefInfoResponse> Things,
|
||||
IReadOnlyList<NameSetInfoResponse> NameSets,
|
||||
IReadOnlyList<CountryInfoResponse> Countries,
|
||||
IReadOnlyList<SubjectInfoResponse> Subjects,
|
||||
DayFrameResponse? DayFrame,
|
||||
IReadOnlyList<HolidayInfoResponse> Holidays,
|
||||
@@ -135,7 +135,7 @@ internal sealed record CatalogResponse(
|
||||
Placeable(catalog.Floors.Values, catalog, locale),
|
||||
PlaceableRooms(catalog, locale),
|
||||
PlaceableThings(catalog, locale),
|
||||
PlaceableNameSets(catalog, locale),
|
||||
PlaceableCountries(catalog, locale),
|
||||
PlaceableSubjects(catalog, locale),
|
||||
MapDayFrame(catalog, locale),
|
||||
PlaceableHolidays(catalog, locale),
|
||||
@@ -149,20 +149,21 @@ internal sealed record CatalogResponse(
|
||||
.Select(def => new DefInfoResponse(def.DefName, catalog.Label(locale, def)))
|
||||
.ToArray();
|
||||
|
||||
private static IReadOnlyList<NameSetInfoResponse> PlaceableNameSets(DefCatalog catalog, string locale) =>
|
||||
catalog.NameSets.Values
|
||||
private static IReadOnlyList<CountryInfoResponse> PlaceableCountries(DefCatalog catalog, string locale) =>
|
||||
catalog.Countries.Values
|
||||
.Where(def => !def.Abstract)
|
||||
.OrderBy(def => def.DefName, StringComparer.Ordinal)
|
||||
.Select(def => new NameSetInfoResponse(
|
||||
.Select(def => new CountryInfoResponse(
|
||||
def.DefName,
|
||||
catalog.Label(locale, def),
|
||||
def.Spoken
|
||||
def.Names.Spoken
|
||||
.Select(skill => new DefInfoResponse(
|
||||
skill,
|
||||
catalog.Skills.TryGetValue(skill, out var language)
|
||||
? catalog.Label(locale, language)
|
||||
: skill))
|
||||
.ToArray()))
|
||||
.ToArray(),
|
||||
def.ClimatePresets.ToArray()))
|
||||
.ToArray();
|
||||
|
||||
private static IReadOnlyList<DefInfoResponse> PlaceableThings(DefCatalog catalog, string locale) =>
|
||||
@@ -230,10 +231,11 @@ internal sealed record CatalogResponse(
|
||||
|
||||
internal sealed record DefInfoResponse(string DefName, string Label, int PupilSlots = 0);
|
||||
|
||||
internal sealed record NameSetInfoResponse(
|
||||
internal sealed record CountryInfoResponse(
|
||||
string DefName,
|
||||
string Label,
|
||||
IReadOnlyList<DefInfoResponse> NativeLanguages);
|
||||
IReadOnlyList<DefInfoResponse> NativeLanguages,
|
||||
IReadOnlyList<string> ClimatePresets);
|
||||
|
||||
internal sealed record RoomInfoResponse(
|
||||
string DefName,
|
||||
|
||||
@@ -53,7 +53,7 @@ internal static class SchoolEndpoints
|
||||
DateTime.SpecifyKind(request.StartDate, DateTimeKind.Utc),
|
||||
request.ModIds,
|
||||
request.Map,
|
||||
request.NameSetId,
|
||||
request.CountryId,
|
||||
request.NativeLanguage,
|
||||
request.Seed,
|
||||
NewCompletion<SchoolCreationOutcome>());
|
||||
@@ -77,10 +77,10 @@ internal static class SchoolEndpoints
|
||||
Problem(StatusCodes.Status400BadRequest, "unknown-mod", "A selected mod is missing."),
|
||||
SchoolCreationError.InvalidCatalog =>
|
||||
Problem(StatusCodes.Status400BadRequest, "invalid-catalog", "The selected packs could not be loaded."),
|
||||
SchoolCreationError.UnknownNameSet =>
|
||||
Problem(StatusCodes.Status400BadRequest, "unknown-name-set", "The selected name set is not in the catalog."),
|
||||
SchoolCreationError.UnknownCountry =>
|
||||
Problem(StatusCodes.Status400BadRequest, "unknown-country", "The selected country is not in the catalog."),
|
||||
SchoolCreationError.UnknownNativeLanguage =>
|
||||
Problem(StatusCodes.Status400BadRequest, "unknown-native-language", "The selected native language is not in that name set."),
|
||||
Problem(StatusCodes.Status400BadRequest, "unknown-native-language", "The selected native language is not in that country."),
|
||||
SchoolCreationError.MissingMod =>
|
||||
Problem(
|
||||
StatusCodes.Status400BadRequest,
|
||||
@@ -508,7 +508,7 @@ internal sealed record CreateSchoolRequest(
|
||||
DateTime StartDate,
|
||||
IReadOnlyList<string>? ModIds,
|
||||
MapLayout? Map,
|
||||
string? NameSetId,
|
||||
string? CountryId,
|
||||
string? NativeLanguage,
|
||||
int? Seed);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user