Catalog typed battery variants (#91)

The battery deploy pieces (s400_launcher, s500_launcher, radar_search/
track/height) were described three times: the menu table and the
configuration match in lib.rs, and a chained id list in commands.rs. One
catalog decision instead: catalog/content.json gains a variants section
(mode/role reuse the existing SamMode/RadarRole save keys), gen_catalog.py
generates catalog::UnitVariant rows, and the loader rejects duplicates,
unknown kinds/modes and id collisions with kinds or items. The battery
menu, its click handler and the deploy completion read the generated
table; the historical row order and labels are unchanged.

No variant carries its own balance: per-variant ammo profiles stay open
pending a confirmed profile and an explicitly labelled game abstraction
(PAC-3 note on #91), so no new specs, no new matches and no save/replay
change - a variant is only a deploy key over the same kind.

Checks: gen_catalog.py --check and gen_models.py --check clean, the
python catalog/asset and sound tests pass, airdef-core 234 unit + 8
scenarios, airdef-mod 69 unit + 1 boundary + 5 scenarios (save/load and
state round trips included), zero failures.

Co-Authored-By: Kimi Code <noreply@moonshot.ai>
This commit is contained in:
2026-11-20 18:38:23 +03:00
parent 306af49744
commit c59bfe9e54
9 changed files with 162 additions and 25 deletions
+37
View File
@@ -128,6 +128,43 @@
"item": "deploy_light"
}
],
"variants": [
{
"id": "s400_launcher",
"kind": "S400",
"mode": "launcher",
"role": "multi",
"label": "С-400 — отдельная пусковая"
},
{
"id": "s500_launcher",
"kind": "S500",
"mode": "launcher",
"role": "multi",
"label": "С-500 — отдельная пусковая"
},
{
"id": "radar_search",
"kind": "Radar",
"mode": "integrated",
"role": "search",
"label": "РЛС обзора"
},
{
"id": "radar_track",
"kind": "Radar",
"mode": "integrated",
"role": "engagement",
"label": "РЛС сопровождения"
},
{
"id": "radar_height",
"kind": "Radar",
"mode": "integrated",
"role": "height",
"label": "Мачтовая РЛС"
}
],
"items": [
{
"id": "designator",