Counter-strikes collide, persist and record their flights (#106 #108 #109 #113)

Co-Authored-By: Kimi <noreply@moonshot.ai>
This commit is contained in:
2026-11-01 02:34:39 +03:00
parent 1a693763fd
commit 31d967b036
10 changed files with 646 additions and 70 deletions
+5 -3
View File
@@ -1047,6 +1047,8 @@ impl AirDef {
let mut out = sim::Out::default();
match self.sim.order_strike(site, DVec3::new(p.x, p.y, p.z), &mut out) {
Ok(m) => {
// The stock went down: the durable state must not forget it (#113).
self.dirty = true;
say(&m);
ui.note(tick, "Ударная ракета пошла");
}
@@ -1418,13 +1420,13 @@ impl AirDef {
};
self.map_sector(ui, &mut s, sam.pos, &d, sam.kind.range().max(200.0));
}
// Flights of the strike missiles.
// Flights of the strike missiles: the line to the target, the marker where the missile really is (#106).
for f in &self.sim.strikes.flights {
let a = ui.to_screen(f.from.x, f.from.z);
let b = ui.to_screen(f.aim.x, f.aim.y);
s.push(line(a, b, 1.0, alpha(0xFFA040, 0.5)));
let k = ((now.saturating_sub(f.start)) as f64 / (f.arrive.saturating_sub(f.start)).max(1) as f64).clamp(0.0, 1.0) as f32;
s.push(diamond(a.0 + (b.0 - a.0) * k, a.1 + (b.1 - a.1) * k, 3.0, ORANGE));
let c = ui.to_screen(f.pos.x, f.pos.z);
s.push(diamond(c.0, c.1, 3.0, ORANGE));
}
// Objects.
if ui.filters[F_OBJECTS] {