Update wire protocol to version 5, introducing pupil slots and item counts in map snapshots. Enhance UI components to display pupil slots and item counts in game screens and map editors. Revise localization strings for improved user guidance. Update tests to validate new functionalities and ensure robustness in handling room and item data.
ci / server (push) Failing after 3m37s
ci / client (push) Successful in 28s

This commit is contained in:
Leonid Pershin
2026-08-18 17:21:16 +03:00
parent f000b128f6
commit 38afbcad36
26 changed files with 349 additions and 64 deletions
+11 -4
View File
@@ -94,7 +94,7 @@ internal sealed record CatalogResponse(
Placeable(catalog.Buildings.Values, catalog, locale),
Placeable(catalog.Floors.Values, catalog, locale),
PlaceableRooms(catalog, locale),
Placeable(catalog.Things.Values, catalog, locale),
PlaceableThings(catalog, locale),
map);
private static IReadOnlyList<DefInfoResponse> Placeable<T>(IEnumerable<T> defs, DefCatalog catalog, string locale)
@@ -105,6 +105,13 @@ internal sealed record CatalogResponse(
.Select(def => new DefInfoResponse(def.DefName, catalog.Label(locale, def)))
.ToArray();
private static IReadOnlyList<DefInfoResponse> PlaceableThings(DefCatalog catalog, string locale) =>
catalog.Things.Values
.Where(def => !def.Abstract)
.OrderBy(def => def.DefName, StringComparer.Ordinal)
.Select(def => new DefInfoResponse(def.DefName, catalog.Label(locale, def), def.PupilSlots))
.ToArray();
private static IReadOnlyList<RoomInfoResponse> PlaceableRooms(DefCatalog catalog, string locale) =>
catalog.Rooms.Values
.Where(def => !def.Abstract)
@@ -112,12 +119,12 @@ internal sealed record CatalogResponse(
.Select(def => new RoomInfoResponse(
def.DefName,
catalog.Label(locale, def),
def.Slots.Select(slot => new RoomSlotInfo(slot.Key, slot.Thing)).ToArray(),
def.Slots.Select(slot => new RoomSlotInfo(slot.Key, slot.Thing, slot.Count)).ToArray(),
def.Positions.ToArray()))
.ToArray();
}
internal sealed record DefInfoResponse(string DefName, string Label);
internal sealed record DefInfoResponse(string DefName, string Label, int PupilSlots = 0);
internal sealed record RoomInfoResponse(
string DefName,
@@ -125,4 +132,4 @@ internal sealed record RoomInfoResponse(
IReadOnlyList<RoomSlotInfo> Slots,
IReadOnlyList<string> Positions);
internal sealed record RoomSlotInfo(string Key, string Thing);
internal sealed record RoomSlotInfo(string Key, string Thing, int Count);