Give packs an identity so create can refuse missing deps and load in a stable order.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+19
-8
@@ -40,7 +40,7 @@ from Monday (five is Mon–Fri; six adds Saturday). It is a school rule, not a c
|
||||
"gameMinutesPerRealSecond": 5,
|
||||
"schoolWeekDays": 5,
|
||||
"schools": [
|
||||
{ "id": 1, "name": "Гимназия №14", "gameTime": "2012-03-31T07:35:00Z", "running": false, "speedIndex": 1 }
|
||||
{ "id": 1, "name": "Гимназия №14", "gameTime": "2012-03-31T07:35:00Z", "running": false, "speedIndex": 1, "modIds": ["core"] }
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -53,20 +53,27 @@ Optional `?lang=en` draws from the English word list (`Northern Academy`); any o
|
||||
none, stays Russian. The client sends the active UI language. Names the player types are not
|
||||
translated — they are saved as written.
|
||||
|
||||
### `GET /api/mods`
|
||||
### `GET /api/mods?lang=ru|en`
|
||||
|
||||
Folders under the server's `mods/` directory. `core` is always first and `required: true`; other
|
||||
packs can be switched off in the create dialog.
|
||||
packs can be switched off in the create dialog. `lang` is the same value Hello carries — not
|
||||
`Accept-Language`. Anything other than `en` is Russian.
|
||||
|
||||
Each pack carries a human label, a version string and the ids it `requires`. The label is the pack
|
||||
id looked up in that pack's own `localizations/<lang>.jsonc`. A folder without `pack.jsonc` is
|
||||
still a pack: the id stands in for the name, `version` is empty, `requires` is empty.
|
||||
|
||||
```json
|
||||
{ "mods": [{ "id": "core", "required": true }] }
|
||||
{ "mods": [{ "id": "core", "required": true, "label": "Базовая игра", "version": "1.0", "requires": [] }] }
|
||||
```
|
||||
|
||||
### `GET /api/catalog?lang=ru|en&mods=addon1,addon2`
|
||||
|
||||
Placeable (non-abstract) types plus labels in `lang`, and the last-wins `maps/default.jsonc` for
|
||||
`core` plus the listed extras. The server always prepends `core`. `mods` is a comma-separated
|
||||
list of extra pack ids; omit it for vanilla. Unknown extras return `400` `unknown-mod`.
|
||||
`core` plus the listed extras. The server always prepends `core` and then reorders extras so
|
||||
`requires` load first, same as create. `mods` is a comma-separated list of extra pack ids; omit
|
||||
it for vanilla. Unknown extras return `400` `unknown-mod`. A selected pack whose dependency was
|
||||
not listed returns `400` `missing-mod`; a cycle returns `400` `mod-cycle`.
|
||||
|
||||
Room defs that are homerooms carry `homeroom`, `seatThing` and `defaultSeats` instead of a
|
||||
slot table. A map classroom stores `seats` — how many of that thing occupy the room. Capacity is
|
||||
@@ -114,8 +121,10 @@ Body:
|
||||
}
|
||||
```
|
||||
|
||||
`modIds` are extras; the server always prepends `core`. Omit `map` (or send `null`) to use that
|
||||
pack set's default layout. A supplied map is validated as a connected yard-and-rooms graph.
|
||||
`modIds` are extras; the server always prepends `core`, then **reorders** the selection so each
|
||||
pack's `requires` load first (stable topological sort over the player's order). The resolved
|
||||
order is returned as `modIds` on the created school and written to the save, so a restart loads
|
||||
the same catalog. Omit `map` (or send `null`) to use that pack set's default layout. A supplied map is validated as a connected yard-and-rooms graph.
|
||||
`nameSetId` is a `NameSetDef`; omit it to use the first placeable set in the catalog (vanilla:
|
||||
`Slavic`). Unknown ids return `400` `unknown-name-set`.
|
||||
`nativeLanguage` is a skill from that set's `nativeLanguages`. Omit it (or send `null`) to pick
|
||||
@@ -128,6 +137,8 @@ one from the school seed. An id that is not in the set returns `400` `unknown-na
|
||||
| `400` `invalid-start-date` | Outside 1900–2999. |
|
||||
| `400` `invalid-map` | Missing yard, no rooms, unknown def, or a disconnected graph. |
|
||||
| `400` `unknown-mod` | An extra pack id is missing under `mods/`. |
|
||||
| `400` `missing-mod` | A selected pack `requires` an id that was not selected. `missing` is that id. |
|
||||
| `400` `mod-cycle` | Selected packs require each other in a cycle. |
|
||||
| `400` `invalid-catalog` | The selected packs could not be loaded. |
|
||||
| `400` `unknown-name-set` | `nameSetId` is not a placeable `NameSetDef` in those packs. |
|
||||
| `400` `unknown-native-language` | `nativeLanguage` is not in that name set's `nativeLanguages`. |
|
||||
|
||||
Reference in New Issue
Block a user