Merge recon flights and partial reports into the classified radar picture (#135)
build / mod (push) Failing after 1m5s

Co-Authored-By: Kimi Code <noreply@moonshot.ai>

# Conflicts:
#	airdef-mod/src/sim/mod.rs
This commit is contained in:
2026-11-21 00:07:39 +03:00
13 changed files with 2171 additions and 71 deletions
+50 -17
View File
@@ -784,16 +784,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));
}
@@ -2349,26 +2359,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));
}
@@ -2487,6 +2505,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));
@@ -2827,6 +2848,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));
@@ -2846,6 +2871,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));
}