Add the recon UI and diagnostic layer to the smart enemy (#135)

The core recon flights and partial reports (9d8f3da57) had no player-facing
or diagnostic consumer: enemy_picture().recon/recon_sorties were read only by
core tests. This adds the missing layer on top, without touching the mechanics,
models or textures.

- Map: a tracked recon aircraft is a recognisable yellow hollow diamond with a
  "разведчик" label, a role line in the selection panel and a filter legend; in
  the sandbox truth mode it gets an amber marker of its own.
- Battle UI: the summary panel and the map show the flight's coarse phase
  (разведка → донесение → завершение) only while the player's network actually
  holds a recon aircraft — what the visible aircraft are doing, not what the
  enemy learned. The truth mode adds a recon count line.
- Diagnostics and after-action review: /airdef recon and the menu page
  "Разведка противника (разбор)" (from Main and Replays) list the enemy's marks
  best-first with the reason each outranks the rest — priority = freshness×4 +
  quality×3 + observed role (recon::priority_parts, cross-checked against
  Mark::priority by a test) — plus the sortie phases and the drones aimed at a
  mark. The omniscient enemy picture is never shown in the normal HUD; it is
  explicit debug/review only.

recon_view reads only the current report types (EnemyPictureReport, ReconReport,
ReconSortieReport); the sim side only widens visibility and adds priority_parts
and the is_recon_drone/recon_status read helpers. Tests: recon_view, panel,
command tree, priority_parts cross-check. README and IMPLEMENTATION-STATUS updated.

Co-Authored-By: Kimi Code <noreply@moonshot.ai>
This commit is contained in:
2026-11-20 23:09:34 +03:00
parent 245aceb434
commit c4e002ed8b
9 changed files with 528 additions and 30 deletions
+50 -17
View File
@@ -783,16 +783,26 @@ fn map_truth(sim: &Sim, ui: &mut MapUi, hover: Option<Hover>, s: &mut Vec<Shape>
}
prev = p;
}
// The drone: a white frame, never the network's red diamond.
s.extend(frame(c.0 - 5.0, c.1 - 5.0, 10.0, 10.0, 1.2, alpha(WHITE, 0.95)));
s.push(fill(c.0 - 1.0, c.1 - 1.0, 2.0, 2.0, WHITE));
// The drone: a white frame, never the network's red diamond. A recon aircraft has a
// sign of its own: an amber diamond, not the strike's frame (#135).
let recon = sim.is_recon_drone(d.id);
if recon {
let p = [(c.0, c.1 - 5.0), (c.0 + 5.0, c.1), (c.0, c.1 + 5.0), (c.0 - 5.0, c.1)];
for i in 0..4 {
s.push(line(p[i], p[(i + 1) % 4], 1.2, alpha(0xFFC040, 0.95)));
}
} else {
s.extend(frame(c.0 - 5.0, c.1 - 5.0, 10.0, 10.0, 1.2, alpha(WHITE, 0.95)));
}
s.push(fill(c.0 - 1.0, c.1 - 1.0, 2.0, 2.0, if recon { alpha(0xFFC040, 0.95) } else { WHITE }));
if ui.on_screen(aim, 6.0) {
s.push(diamond(aim.0, aim.1, 4.5, alpha(0xFFE070, 0.85)));
s.push(fill(aim.0 - 1.0, aim.1 - 1.0, 2.0, 2.0, alpha(0xFFE070, 0.9)));
}
taken.push([c.0 - 6.0, c.1 - 6.0, 12.0, 12.0]);
let chosen = hover == Some(Hover::Drone(d.id));
add_lab(ui, labs, format!("{} №{}", d.kind.spec().name, d.id), c, 7.0, alpha(YELLOW, 0.95), chosen);
let name = if recon { format!("разведчик №{}", d.id) } else { format!("{} №{}", d.kind.spec().name, d.id) };
add_lab(ui, labs, name, c, 7.0, alpha(YELLOW, 0.95), chosen);
if chosen {
s.extend(frame(c.0 - 8.0, c.1 - 8.0, 16.0, 16.0, 1.0, GREEN));
}
@@ -2299,26 +2309,34 @@ impl AirDef {
let chosen = ui.sel == Some(Sel::Track(id));
let forecast = t.forecast(now);
let age = t.age(now);
let col = if forecast { alpha(0xFFB0B0, 0.65) } else { 0xFFFF5050 };
s.push(diamond(c.0, c.1, TRACK_R, col));
if !forecast {
s.push(diamond(c.0, c.1, 3.0, 0xFF200808));
// A recon aircraft is a role of its own: a yellow hollow diamond and a named label, so
// the player tells it from a strike drone the network tracks the same way (#135).
let recon = sim::is_drone_id(id);
let r = if recon { 5.0 } else { TRACK_R };
let col = if recon { YELLOW } else if forecast { alpha(0xFFB0B0, 0.65) } else { 0xFFFF5050 };
s.push(diamond(c.0, c.1, r, col));
if recon || !forecast {
s.push(diamond(c.0, c.1, if recon { 2.0 } else { 3.0 }, 0xFF200808));
}
// Its measured course, a tick out of the marker.
let v = t.vel.normalize_or_zero();
if v != DVec3::ZERO {
s.push(line(c, (c.0 + v.x as f32 * 10.0, c.1 + v.z as f32 * 10.0), 1.5, col));
}
taken.push([c.0 - TRACK_R - 1.0, c.1 - TRACK_R - 1.0, TRACK_R * 2.0 + 2.0, TRACK_R * 2.0 + 2.0]);
let mark = t.class.mark();
let age = if age < 20 { "сейчас".to_string() } else { format!("{} с", age / 20) };
let txt = match (mark.is_empty(), forecast) {
(true, true) => format!("~{age}"),
(true, false) => age,
(false, true) => format!("{mark} ~{age}"),
(false, false) => format!("{mark} {age}"),
taken.push([c.0 - r - 1.0, c.1 - r - 1.0, r * 2.0 + 2.0, r * 2.0 + 2.0]);
let age_txt = if age < 20 { "сейчас".to_string() } else { format!("{} с", age / 20) };
let txt = if recon {
format!("разведчик {age_txt}")
} else {
let mark = t.class.mark();
match (mark.is_empty(), forecast) {
(true, true) => format!("~{age_txt}"),
(true, false) => age_txt,
(false, true) => format!("{mark} ~{age_txt}"),
(false, false) => format!("{mark} {age_txt}"),
}
};
add_lab(ui, labs, txt, c, TRACK_R + 1.0, col, chosen);
add_lab(ui, labs, txt, c, r + 1.0, col, chosen);
if chosen {
s.extend(frame(c.0 - 10.0, c.1 - 10.0, 20.0, 20.0, 1.0, GREEN));
}
@@ -2437,6 +2455,9 @@ impl AirDef {
inner.push(text(l, x0, y, GREY));
y += lh - 1.0;
}
let rn = self.sim.picture().values().filter(|t| sim::is_drone_id(t.id)).count();
inner.push(text(format!("жёлтый ромб — разведчик ({rn})"), x0, y, GREY));
y += lh - 1.0;
}
_ => {
inner.push(text("Имя сценария", x0, y, GREY));
@@ -2758,6 +2779,10 @@ impl AirDef {
lines.push((format!("Трек №{id}: потерян сетью"), GREY));
return;
};
if sim::is_drone_id(id) {
lines.push((format!("Разведчик противника №{id}"), YELLOW));
lines.push(("Роль: разведка (без оружия) — ищет технику вокруг объектов".into(), YELLOW));
}
let player = crate::player().map(|p| DVec3::new(p.x, p.y, p.z));
track_lines(&self.sim, t, player, lines);
lines.push(("Тонкая линия — пройденное по измерениям,".into(), GREY));
@@ -2777,6 +2802,14 @@ impl AirDef {
lines.push(("Режим ИСТИНА: настоящие дроны, их цели и маршруты.".into(), YELLOW));
lines.push(("Это песочница, не данные сети. T — обратно.".into(), YELLOW));
}
// The recon flight's phase, only while the network actually holds a recon aircraft:
// what the visible aircraft are doing, not what the enemy learned (#135).
if self.sim.picture().values().any(|t| sim::is_drone_id(t.id)) {
let pic = self.sim.enemy_picture();
if let Some(phase) = crate::recon_view::battle_phase(&pic) {
lines.push((format!("Разведка противника: {phase} · разведчиков {}", pic.recon_sorties.len()), YELLOW));
}
}
if self.battle() {
lines.push(("Идёт налёт: расстановка закрыта".into(), YELLOW));
}