This commit is contained in:
Leonid Pershin
2026-08-18 23:51:10 +03:00
parent d8f8db6a48
commit 65feda3756
50 changed files with 1485 additions and 224 deletions
+31
View File
@@ -87,6 +87,7 @@ internal sealed record CatalogResponse(
IReadOnlyList<RoomInfoResponse> Rooms,
IReadOnlyList<DefInfoResponse> Things,
IReadOnlyList<DefInfoResponse> NameSets,
IReadOnlyList<SubjectInfoResponse> Subjects,
MapLayout DefaultMap)
{
public static CatalogResponse From(DefCatalog catalog, MapLayout map, string locale) =>
@@ -97,6 +98,7 @@ internal sealed record CatalogResponse(
PlaceableRooms(catalog, locale),
PlaceableThings(catalog, locale),
Placeable(catalog.NameSets.Values, catalog, locale),
PlaceableSubjects(catalog, locale),
map);
private static IReadOnlyList<DefInfoResponse> Placeable<T>(IEnumerable<T> defs, DefCatalog catalog, string locale)
@@ -121,9 +123,25 @@ internal sealed record CatalogResponse(
.Select(def => new RoomInfoResponse(
def.DefName,
catalog.Label(locale, def),
def.Homeroom,
def.SeatThing,
def.DefaultSeats,
def.Slots.Select(slot => new RoomSlotInfo(slot.Key, slot.Thing, slot.Count)).ToArray(),
def.Positions.ToArray()))
.ToArray();
private static IReadOnlyList<SubjectInfoResponse> PlaceableSubjects(DefCatalog catalog, string locale) =>
catalog.Subjects.Values
.Where(def => !def.Abstract)
.OrderBy(def => def.DefName, StringComparer.Ordinal)
.Select(def => new SubjectInfoResponse(
def.DefName,
catalog.Label(locale, def),
def.Grades.Min,
def.Grades.Max,
def.HoursPerWeek,
def.Skills.Select(share => new SubjectSkillInfo(share.Skill, share.Share)).ToArray()))
.ToArray();
}
internal sealed record DefInfoResponse(string DefName, string Label, int PupilSlots = 0);
@@ -131,7 +149,20 @@ internal sealed record DefInfoResponse(string DefName, string Label, int PupilSl
internal sealed record RoomInfoResponse(
string DefName,
string Label,
bool Homeroom,
string? SeatThing,
int DefaultSeats,
IReadOnlyList<RoomSlotInfo> Slots,
IReadOnlyList<string> Positions);
internal sealed record RoomSlotInfo(string Key, string Thing, int Count);
internal sealed record SubjectSkillInfo(string Skill, float Share);
internal sealed record SubjectInfoResponse(
string DefName,
string Label,
int GradeMin,
int GradeMax,
int HoursPerWeek,
IReadOnlyList<SubjectSkillInfo> Skills);
+1 -1
View File
@@ -10,7 +10,7 @@
"TickRate": 20,
"MaxSchools": 6,
"GameMinutesPerRealSecond": 5,
"DefaultStartDate": "2012-04-03T06:00:00",
"DefaultStartDate": "2012-03-31T06:00:00",
"SavesDirectory": "saves",
"ModsDirectory": "mods",
"SaveIntervalSeconds": 30
@@ -4,6 +4,5 @@
{ "defName": "Teacher" },
{ "defName": "Librarian" },
{ "defName": "Nurse" },
{ "defName": "PETeacher" },
{ "defName": "CafeteriaCook" },
]
@@ -1,15 +1,10 @@
[
{
"defName": "Classroom",
"slots": [
{ "key": "board", "thing": "Blackboard" },
{ "key": "teacherDesk", "thing": "Desk" },
{ "key": "teacherChair", "thing": "Chair" },
{ "key": "studentDesks", "thing": "StudentDesk", "count": 16 },
],
"positions": ["Teacher"],
"works": ["TeachLesson"],
"homeroom": true,
"seatThing": "StudentDesk",
"defaultSeats": 16,
"works": ["TeachLesson"],
},
{
"defName": "Library",
@@ -27,7 +22,6 @@
{ "key": "teacherChair", "thing": "Chair" },
{ "key": "computers", "thing": "Computer", "count": 12 },
],
"positions": ["Teacher"],
"works": ["TeachLesson"],
},
]
@@ -3,6 +3,5 @@
"slots": [
{ "key": "benches", "thing": "Bench", "count": 4 },
],
"positions": ["PETeacher"],
"works": ["PELesson"],
}
@@ -0,0 +1,79 @@
[
{
"defName": "PrimarySchool",
"grades": { "min": 1, "max": 4 },
"hoursPerWeek": 20,
"skills": [
{ "skill": "Mathematics", "share": 0.3 },
{ "skill": "RussianLanguage", "share": 0.3 },
{ "skill": "Literature", "share": 0.2 },
{ "skill": "Biology", "share": 0.2 },
],
},
{
"defName": "Mathematics",
"grades": { "min": 5, "max": 11 },
"hoursPerWeek": 5,
"skills": [{ "skill": "Mathematics", "share": 1 }],
},
{
"defName": "RussianLanguage",
"grades": { "min": 5, "max": 11 },
"hoursPerWeek": 4,
"skills": [{ "skill": "RussianLanguage", "share": 1 }],
},
{
"defName": "Literature",
"grades": { "min": 5, "max": 11 },
"hoursPerWeek": 3,
"skills": [{ "skill": "Literature", "share": 1 }],
},
{
"defName": "ForeignLanguage",
"grades": { "min": 5, "max": 11 },
"hoursPerWeek": 3,
"skills": [{ "skill": "ForeignLanguage", "share": 1 }],
},
{
"defName": "History",
"grades": { "min": 5, "max": 11 },
"hoursPerWeek": 2,
"skills": [{ "skill": "History", "share": 1 }],
},
{
"defName": "Geography",
"grades": { "min": 5, "max": 11 },
"hoursPerWeek": 2,
"skills": [{ "skill": "Geography", "share": 1 }],
},
{
"defName": "Biology",
"grades": { "min": 5, "max": 11 },
"hoursPerWeek": 2,
"skills": [{ "skill": "Biology", "share": 1 }],
},
{
"defName": "Informatics",
"grades": { "min": 5, "max": 11 },
"hoursPerWeek": 1,
"skills": [{ "skill": "Informatics", "share": 1 }],
},
{
"defName": "Physics",
"grades": { "min": 7, "max": 11 },
"hoursPerWeek": 2,
"skills": [{ "skill": "Physics", "share": 1 }],
},
{
"defName": "Chemistry",
"grades": { "min": 8, "max": 11 },
"hoursPerWeek": 2,
"skills": [{ "skill": "Chemistry", "share": 1 }],
},
{
"defName": "PhysicalEducation",
"grades": { "min": 1, "max": 11 },
"hoursPerWeek": 3,
"skills": [{ "skill": "PhysicalEducation", "share": 1 }],
},
]
@@ -16,8 +16,8 @@
"Teacher": "Teacher",
"Librarian": "Librarian",
"Nurse": "Nurse",
"PETeacher": "PE teacher",
"CafeteriaCook": "Cook",
"PrimarySchool": "Primary",
"PrincipalOfficeWork": "Principal's work",
"TeachLesson": "Teach a lesson",
"WalkSchool": "Walk the school",
@@ -87,6 +87,7 @@
"Toilet": "Toilet",
"Social": "Social",
"Slavic": "Slavic",
"Build": "Build",
"Skinny": "Skinny",
"Average": "Average",
"Athletic": "Athletic",
@@ -16,8 +16,8 @@
"Teacher": "Учитель",
"Librarian": "Библиотекарь",
"Nurse": "Медсестра",
"PETeacher": "Учитель физкультуры",
"CafeteriaCook": "Повар",
"PrimarySchool": "Начальные классы",
"PrincipalOfficeWork": "Работа директора",
"TeachLesson": "Урок",
"WalkSchool": "Обход школы",
@@ -87,6 +87,7 @@
"Toilet": "Туалет",
"Social": "Общение",
"Slavic": "Славянский",
"Build": "Телосложение",
"Skinny": "Худощавое",
"Average": "Обычное",
"Athletic": "Атлетическое",
+11 -66
View File
@@ -52,12 +52,7 @@
"building": "main",
"floor": "floor-1",
"label": "101",
"slots": [
{ "key": "board", "thing": "Blackboard" },
{ "key": "teacherDesk", "thing": "Desk" },
{ "key": "teacherChair", "thing": "Chair" },
{ "key": "studentDesks", "thing": "StudentDesk", "count": 16 },
],
"seats": 16,
},
{
"id": "classroom-102",
@@ -65,12 +60,7 @@
"building": "main",
"floor": "floor-1",
"label": "102",
"slots": [
{ "key": "board", "thing": "Blackboard" },
{ "key": "teacherDesk", "thing": "Desk" },
{ "key": "teacherChair", "thing": "Chair" },
{ "key": "studentDesks", "thing": "StudentDesk", "count": 16 },
],
"seats": 16,
},
{
"id": "classroom-103",
@@ -78,12 +68,7 @@
"building": "main",
"floor": "floor-1",
"label": "103",
"slots": [
{ "key": "board", "thing": "Blackboard" },
{ "key": "teacherDesk", "thing": "Desk" },
{ "key": "teacherChair", "thing": "Chair" },
{ "key": "studentDesks", "thing": "StudentDesk", "count": 16 },
],
"seats": 16,
},
{
"id": "classroom-104",
@@ -91,12 +76,7 @@
"building": "main",
"floor": "floor-1",
"label": "104",
"slots": [
{ "key": "board", "thing": "Blackboard" },
{ "key": "teacherDesk", "thing": "Desk" },
{ "key": "teacherChair", "thing": "Chair" },
{ "key": "studentDesks", "thing": "StudentDesk", "count": 16 },
],
"seats": 16,
},
{
"id": "cafeteria",
@@ -127,12 +107,7 @@
"building": "main",
"floor": "floor-2",
"label": "201",
"slots": [
{ "key": "board", "thing": "Blackboard" },
{ "key": "teacherDesk", "thing": "Desk" },
{ "key": "teacherChair", "thing": "Chair" },
{ "key": "studentDesks", "thing": "StudentDesk", "count": 16 },
],
"seats": 16,
},
{
"id": "classroom-202",
@@ -140,12 +115,7 @@
"building": "main",
"floor": "floor-2",
"label": "202",
"slots": [
{ "key": "board", "thing": "Blackboard" },
{ "key": "teacherDesk", "thing": "Desk" },
{ "key": "teacherChair", "thing": "Chair" },
{ "key": "studentDesks", "thing": "StudentDesk", "count": 16 },
],
"seats": 16,
},
{
"id": "classroom-203",
@@ -153,12 +123,7 @@
"building": "main",
"floor": "floor-2",
"label": "203",
"slots": [
{ "key": "board", "thing": "Blackboard" },
{ "key": "teacherDesk", "thing": "Desk" },
{ "key": "teacherChair", "thing": "Chair" },
{ "key": "studentDesks", "thing": "StudentDesk", "count": 16 },
],
"seats": 16,
},
{
"id": "classroom-204",
@@ -166,12 +131,7 @@
"building": "main",
"floor": "floor-2",
"label": "204",
"slots": [
{ "key": "board", "thing": "Blackboard" },
{ "key": "teacherDesk", "thing": "Desk" },
{ "key": "teacherChair", "thing": "Chair" },
{ "key": "studentDesks", "thing": "StudentDesk", "count": 16 },
],
"seats": 16,
},
{
"id": "classroom-205",
@@ -179,12 +139,7 @@
"building": "main",
"floor": "floor-2",
"label": "205",
"slots": [
{ "key": "board", "thing": "Blackboard" },
{ "key": "teacherDesk", "thing": "Desk" },
{ "key": "teacherChair", "thing": "Chair" },
{ "key": "studentDesks", "thing": "StudentDesk", "count": 16 },
],
"seats": 16,
},
{
"id": "classroom-206",
@@ -192,12 +147,7 @@
"building": "main",
"floor": "floor-2",
"label": "206",
"slots": [
{ "key": "board", "thing": "Blackboard" },
{ "key": "teacherDesk", "thing": "Desk" },
{ "key": "teacherChair", "thing": "Chair" },
{ "key": "studentDesks", "thing": "StudentDesk", "count": 16 },
],
"seats": 16,
},
{
"id": "classroom-207",
@@ -205,12 +155,7 @@
"building": "main",
"floor": "floor-2",
"label": "207",
"slots": [
{ "key": "board", "thing": "Blackboard" },
{ "key": "teacherDesk", "thing": "Desk" },
{ "key": "teacherChair", "thing": "Chair" },
{ "key": "studentDesks", "thing": "StudentDesk", "count": 16 },
],
"seats": 16,
},
{
"id": "library",