Fire P1-SUN on network fire plots, make S-400/S-500 launchers only, give radars own models
build / mod (push) Successful in 30m51s

Gameplay fixes and art from the owner's balance review of 2026-12-05.

- The P1-SUN never launched (0 launches in 12 seeds of a 196-target raid): it
  has no radar of its own and only a separate launcher could fire on another
  station's plot. A unit without its own radar now fires like one
  (`why::on_network`), on the fresh own fire plot of an engagement or
  multifunction radar within link reach. Seven P1-SUN then launch 26-42 and
  kill 13-24 per raid; the leak count does not change.
- The С-400 and С-500 exist only as separate launchers (`mode: "launcher"` in
  the catalog). The `s400_launcher`/`s500_launcher` variants and their remotes
  are gone: `deploy s400`/`s500` and their remotes place a launcher. A system
  saved with its own radar loads as a launcher; `battery <n> integrated` is
  refused for these kinds.
- Every radar role has its own model: a wide curved array (search), a
  parabolic dish (engagement), a small head on mast sections (height); the
  multifunction radar keeps its panel, the optical post gets its own post and
  a turning head with a lens. A variant may carry its own `parts` in
  `catalog/content.json`; `Sam::parts()` resolves them.
- The enemy remembers the sides each approach raided from: a raid ordered the
  same way and within 200 blocks of the same distance comes from the same
  sides, so its sites stand where the last ones did. A launch area the radars
  fixed is remembered (up to 32): a site placed there again is known before
  its first launch and can be struck at once. Neither is saved yet.
- `sim/balance.rs` flies several raids over one cluster with stocked depots
  (`supply_raids`). With the 16-block depot reach, depots 30 blocks from the
  batteries leave 10 / 36 / 80 leaks over three raids against 6 / 10 / 17 for
  depots within reach; the reach itself is unchanged by decision of the owner.

The saturation checkpoint is re-recorded (123 kills / 323 launches instead of
129 / 344): that loadout has no fire radar, so its С-400/С-500 fire less as
launchers.

Verified: airdef-core release 363 passed and 8 scenarios; airdef-mod 135 passed,
1 boundary, 2 saturation, 5 scenarios; gen_catalog/gen_models/gen_sounds --check;
test_gen_assets, test_model_bounds, test_web_panel; git diff --check. Not run:
the actual WASM contract, the models in game, CI.
Co-Authored-By: ZCode <zcode@localhost>
This commit is contained in:
2026-12-05 23:38:14 +03:00
parent 817b5b7e9f
commit 02f99c31f6
98 changed files with 4124 additions and 261 deletions
+10 -6
View File
@@ -44,7 +44,7 @@ def load(specs=None):
data["items"] = items
data["aircraft"] = [{"kind": row["kind"], "item": row["item"]["id"] if row["item"] else None,
"raid": row["raid_slot"] is not None} for row in ordered]
data["units"] = [{"kind": row["kind"], "item": row["item"]["id"]} for row in specs["units"]]
data["units"] = [{"kind": row["kind"], "item": row["item"]["id"], "mode": row.get("mode", "integrated")} for row in specs["units"]]
ids = [item["id"] for item in items]
if len(ids) != len(set(ids)):
raise ValueError("duplicate item ID in content catalog")
@@ -60,8 +60,10 @@ def load(specs=None):
taken = set(referenced) | unit_kinds | set(ids)
for variant in data["variants"]:
where = f"variants[{variant['id']}]"
if set(variant) != {"id", "kind", "mode", "role", "label", "description"}:
raise ValueError(f"{where}: expected keys id, kind, mode, role, label, description, got {sorted(variant)}")
if not {"id", "kind", "mode", "role", "label", "description"} <= set(variant) or set(variant) - {"id", "kind", "mode", "role", "label", "description", "parts"}:
raise ValueError(f"{where}: expected keys id, kind, mode, role, label, description[, parts], got {sorted(variant)}")
if "parts" in variant:
_parts(variant["parts"], f"{where}.parts", set(specs["named"]))
if not re.fullmatch(r"[a-z0-9_]+", variant["id"]):
raise ValueError(f"{where}: invalid variant id {variant['id']!r}")
if variant["kind"] not in unit_kinds:
@@ -99,8 +101,8 @@ def load_sounds():
return entries
def _exact(entry, keys, where):
if not isinstance(entry, dict) or set(entry) != set(keys):
def _exact(entry, keys, where, optional=()):
if not isinstance(entry, dict) or not set(keys) <= set(entry) or set(entry) - set(keys) - set(optional):
got = sorted(entry) if isinstance(entry, dict) else type(entry).__name__
raise ValueError(f"{where}: expected keys {sorted(keys)}, got {got}")
@@ -343,7 +345,9 @@ def validate_specs(data, events):
where = f"units[{i}]"
profile = {"ground_strike"} if isinstance(entry, dict) and "ground_strike" in entry else set()
_exact(entry, {"kind", "key", "name", "item", "missile", "gun", "reload", "scale", "rest_pitch",
"roles", "family", "parts", "mount", "pivot", "muzzle", "sensor", "mast", "village_cost"} | profile, where)
"roles", "family", "parts", "mount", "pivot", "muzzle", "sensor", "mast", "village_cost"} | profile, where, optional=("mode",))
if entry.get("mode", "integrated") not in ("integrated", "launcher"):
raise ValueError(f"{where}: mode is integrated or launcher")
kind = _text(entry["kind"], f"{where}.kind", r"[A-Z][A-Za-z0-9]*")
if entry["item"] is None:
raise ValueError(f"{where}.item: deployed units need an item")
-2
View File
@@ -347,8 +347,6 @@ ICON_DRAW = {
ICON_ALIAS = {
"deploy_optical": "deploy_radar",
# A variant remote keeps its unit's silhouette: only the configuration differs.
"deploy_s400_launcher": "deploy_s400",
"deploy_s500_launcher": "deploy_s500",
"deploy_radar_search": "deploy_radar",
"deploy_radar_track": "deploy_radar",
"deploy_radar_height": "deploy_radar",
+20 -7
View File
@@ -35,7 +35,10 @@ def generate(data):
kind, item = entry["kind"], entry["item"]
if not re.fullmatch(r"[A-Z][A-Za-z0-9]*", kind) or not re.fullmatch(r"[a-z0-9_]+", item):
raise ValueError(f"invalid unit {entry!r}")
lines.append(f' Unit {{ kind: SamKind::{kind}, deploy_item: "airdef:{item}" }},')
mode = entry.get("mode", "integrated")
if mode not in MODES:
raise ValueError(f"invalid deploy mode {mode!r} for {kind}")
lines.append(f' Unit {{ kind: SamKind::{kind}, deploy_item: "airdef:{item}", launcher_only: {str(mode == "launcher").lower()} }},')
return "\n".join(lines + ["];", ""])
@@ -327,8 +330,8 @@ def generate_variants(data):
"""A variant of a complex is one record: a deploy id over an existing unit's
typed configuration (`battery::SamMode`, `battery::RadarRole`). No balance of
its own — everything but the label comes from the unit rows it points at."""
lines = ["// Generated by tools/gen_catalog.py from catalog/content.json. Do not edit.",
"pub const VARIANTS: &[UnitVariant] = &["]
lines = ["// Generated by tools/gen_catalog.py from catalog/content.json. Do not edit."]
rows = ["pub const VARIANTS: &[UnitVariant] = &["]
registered = {entry["id"] for entry in data["items"]}
for entry in data["variants"]:
mode = MODES[entry["mode"]]
@@ -336,10 +339,20 @@ def generate_variants(data):
item = f"deploy_{entry['id']}"
if item not in registered:
raise ValueError(f"variants[{entry['id']}]: remote {item} is not a registered item")
lines.append(f" UnitVariant {{ id: {text(entry['id'])}, deploy_item: \"airdef:{item}\", "
f"kind: SamKind::{entry['kind']}, mode: SamMode::{mode}, role: RadarRole::{role}, "
f"label: {text(entry['label'])}, description: {text(entry['description'])} }},")
return "\n".join(lines + ["];", ""])
# A configuration drawn with its own models (a radar's antenna by its role): a parts
# constant before the table, in the unit rows' own form.
parts = "None"
if "parts" in entry:
name = "PARTS_" + entry["id"].upper()
body = parts_value(entry["parts"], 2)[1:-1]
lines.append(f"const {name}: Parts = Parts {{")
lines += [line[2:] for line in body]
lines.append("};")
parts = f"Some(&{name})"
rows.append(f" UnitVariant {{ id: {text(entry['id'])}, deploy_item: \"airdef:{item}\", "
f"kind: SamKind::{entry['kind']}, mode: SamMode::{mode}, role: RadarRole::{role}, "
f"label: {text(entry['label'])}, description: {text(entry['description'])}, parts: {parts} }},")
return "\n".join(lines + [""] + rows + ["];", ""])
def main():
+57 -1
View File
@@ -441,6 +441,57 @@ def tpk_cap():
el((5, 5, z_face), (11, 11, z1), "dark_metal")]
def radar_search_array():
"""Антенна РЛС обзора: широкий слегка изогнутый экран на высокой опоре; вращается вокруг центра модели."""
p = [el((-6, 0, 7), (22, 30, 9), "radar_face"),
el((-16, 0, 7), (-6, 30, 9), "radar_face", rot=("y", -22.5)),
el((22, 0, 7), (32, 30, 9), "radar_face", rot=("y", 22.5)),
el((-6.5, -0.5, 9), (22.5, 30.5, 10), "dark_metal"),
el((-6, 30, 6), (22, 32, 10), "dark_metal"),
el((-10, 13, 9), (-6, 17, 13), "dark_metal"), el((22, 13, 9), (26, 17, 13), "dark_metal"),
el((4, -4, 4), (12, 2, 12), "dark_metal"),
el((6.5, -10, 6.5), (9.5, -4, 9.5), "metal")]
return p
def radar_dish():
"""Антенна РЛС сопровождения: параболическое зеркало ступенями, облучатель на штанге."""
p = [el((-8, -6, 8), (24, 20, 10), "dish"),
el((-4, -2, 10), (16, 16, 12), "dish"),
el((0, 2, 12), (12, 12, 14), "dish"),
el((-8.5, -6.5, 10), (24.5, 20.5, 11), "dark_metal"),
el((3, -3, 14), (13, 3, 17), "dark_metal"),
el((7, 6, 2), (9, 8, 9), "metal"),
el((5.5, 4.5, -2), (10.5, 9.5, 2), "dark_metal"),
el((6.5, -10, 6.5), (9.5, -3, 9.5), "metal")]
return p
def radar_height_head():
"""Головка мачтовой РЛС: небольшой двусторонний экран поверх секций мачты."""
return [el((1, -2, 5), (15, 14, 7), "radar_face"), el((1, -2, 9), (15, 14, 11), "radar_face"),
el((0.5, -2.5, 7), (15.5, 14.5, 9), "dark_metal"),
el((6, -8, 6), (10, -2, 10), "metal"),
el((2, 14, 7), (14, 16, 9), "dark_metal")]
def optical_head():
"""Оптический пост: поворотная головка с объективом на вилке."""
p = [el((4, -6, 4), (12, -1, 12), "dark_metal"),
el((2.5, -1, 6.5), (5.5, 6, 9.5), "ru_khaki"), el((10.5, -1, 6.5), (13.5, 6, 9.5), "ru_khaki"),
el((3, -1, -6), (13, 7, 7), "ru_khaki"),
el((5, 1, -7.5), (11, 5, -6), "glass"),
el((9, 7, -4), (12, 10, 3), "dark_metal"), el((10, 7.5, -5), (11, 9.5, -4), "glass")]
return p
def optical_post():
"""Основание оптического поста: бетонная площадка и аппарат."""
return [el((-6, 0, -6), (22, 2, 22), "concrete"),
el((1, 2, 1), (15, 9, 15), "ru_khaki", {"east": "metal"}),
el((-4, 2, -2), (1, 7, 4), "crate")]
def radar_mast():
"""Generic two-block telescoping radar mast segment; stackable for role-based height."""
return [el((4, 0, 4), (12, 3, 12), "dark_metal"),
@@ -1032,6 +1083,11 @@ MODELS = {
"radar_mast": (radar_mast, "Радиомачта (секция высоты)"),
"radar_trailer": (radar_trailer, "Прицеп РЛС"),
"radar_panel": (big_radar_panel, "РЛС обзора"),
"radar_search_array": (radar_search_array, "Антенна РЛС обзора"),
"radar_dish": (radar_dish, "Зеркало РЛС сопровождения"),
"radar_height_head": (radar_height_head, "Головка мачтовой РЛС"),
"optical_head": (optical_head, "Головка оптического поста"),
"optical_post": (optical_post, "Основание оптического поста"),
"m57e6": (missile_57e6, "57Э6"),
"m48n6": (missile_48n6, "48Н6"),
# Own identity for the coordinate-strike game profile; stylized geometry based on the existing family.
@@ -1073,7 +1129,7 @@ MODELS = {
WRECKS = ["patriot_trailer", "patriot_launcher", "gepard_hull", "gepard_turret", "gepard_guns", "pantsir_truck",
"pantsir_turret", "pantsir_pack", "s400_chassis", "s400_tubes", "s500_chassis", "s500_tubes", "tpk_cap", "radar_mast",
"irist_chassis", "irist_tubes", "nasams_trailer", "nasams_launcher", "buk_chassis", "buk_turret",
"buk_rails", "tor_chassis", "tor_turret", "p1sun_launcher", "radar_truck", "depot", "tzm_truck",
"buk_rails", "tor_chassis", "tor_turret", "p1sun_launcher", "radar_truck", "radar_trailer", "optical_post", "depot", "tzm_truck",
"ew_truck", "searchlight", "searchlight_head"]
CAM_MODELS = ["shahed", "geran3", "lancet", "gerbera", "kh101", "kalibr", "kh22", "zircon", "iskander", "kinzhal", "reentry"]