Smart raids, wave menu, radar detection (horizon, RCS, terrain), vulnerable SAMs, busiest-first grid
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -111,7 +111,8 @@ fn cell(sim: &Sim, index: usize, x: f32, y: f32, w: f32, h: f32, s: &mut Vec<Sha
|
||||
}
|
||||
let target = sim.watched(sam);
|
||||
let mut seen = 0;
|
||||
for d in sim.drones.iter().filter(|d| d.alive()) {
|
||||
// Only what its own radar holds.
|
||||
for d in sim.drones.iter().filter(|d| d.alive() && sam.seen.contains(&d.id)) {
|
||||
let rel = d.pos - sam.pos;
|
||||
let flat = (rel.x * rel.x + rel.z * rel.z).sqrt();
|
||||
if flat > reach * 1.25 {
|
||||
@@ -133,9 +134,30 @@ fn cell(sim: &Sim, index: usize, x: f32, y: f32, w: f32, h: f32, s: &mut Vec<Sha
|
||||
s.push(fill(rx - 1.5, ry - 1.5, 3.0, 3.0, 0xFF40A0FF));
|
||||
s.push(text(fit(format!("РЛС {} · {}", distance(reach), seen), rr * 2.0 + 4.0), x + 4.0, y + h - 10.0, 0xFF80FF90));
|
||||
|
||||
// Its health under the radar: a bar, red when it is low.
|
||||
if sam.alive() && sam.health < 1.0 {
|
||||
let bw = rr * 2.0;
|
||||
let hc = if sam.health < 0.35 { 0xFFFF3030 } else if sam.health < 0.7 { 0xFFFFB030 } else { 0xFF60FF60 };
|
||||
s.push(fill(x + 4.0, ry + rr + 1.0, bw, 2.0, 0x80000000));
|
||||
s.push(fill(x + 4.0, ry + rr + 1.0, bw * sam.health as f32, 2.0, hc));
|
||||
}
|
||||
|
||||
// The camera, at the right: the world as the system sees it, thermal.
|
||||
let cx = rx + rr + 6.0;
|
||||
let (cy, cw, ch) = (y + 15.0, x + w - 4.0 - cx, h - 28.0);
|
||||
if !sam.alive() {
|
||||
// A dead system shows a dead screen.
|
||||
s.push(fill(cx, cy, cw, ch, 0xFF100606));
|
||||
let noise = (tick * 2654435761) % 997;
|
||||
for i in 0..24 {
|
||||
let nx = cx + ((noise as f32 * (i + 3) as f32 * 13.7) % cw);
|
||||
let ny = cy + ((noise as f32 * (i + 7) as f32 * 7.3) % ch);
|
||||
s.push(fill(nx, ny, 3.0, 1.0, 0x60FFFFFF));
|
||||
}
|
||||
s.push(text("НЕТ СВЯЗИ", cx + cw / 2.0 - render::text_width("НЕТ СВЯЗИ") / 2.0, cy + ch / 2.0 - 4.0, 0xFFFF4040));
|
||||
s.push(text(if sam.burning() { "горит" } else { "уничтожен" }, cx, y + h - 10.0, 0xFFFF8060));
|
||||
return;
|
||||
}
|
||||
s.push(fill(cx - 1.0, cy - 1.0, cw + 2.0, ch + 2.0, 0xFF203020));
|
||||
// Searching: colour by day, night vision at night; tracking: thermal.
|
||||
let night = horizon_mod_sdk::game::get_clock().is_some_and(|c| (13000..23000).contains(&(c.day_time % 24000)));
|
||||
@@ -195,13 +217,27 @@ pub fn draw(sim: &Sim, index: usize) -> Vec<Shape> {
|
||||
}
|
||||
|
||||
/// Every system in a grid over the screen.
|
||||
pub fn grid(sim: &Sim, (gw, gh): (f32, f32)) -> Vec<Shape> {
|
||||
pub fn grid(sim: &Sim, picked: &[usize], (gw, gh): (f32, f32)) -> Vec<Shape> {
|
||||
let mut s = Vec::new();
|
||||
let n = sim.sams.len().min(8);
|
||||
let n = picked.len().min(8);
|
||||
s.push(fill(0.0, 0.0, gw, gh, 0xE0050806));
|
||||
s.push(text(
|
||||
fit(
|
||||
format!("КОМАНДНЫЙ ПУНКТ ПВО · комплексов {n} · целей {} · сбито {} · J закрыть", sim.drones.iter().filter(|d| d.alive()).count(), sim.kills),
|
||||
{
|
||||
let total = sim.sams.len();
|
||||
let busy = sim
|
||||
.sams
|
||||
.iter()
|
||||
.filter(|s| !matches!(s.state, SamState::Search | SamState::Hold | SamState::Destroyed))
|
||||
.count();
|
||||
let lost = sim.sams.iter().filter(|s| !s.alive()).count();
|
||||
let shown = if total > n { format!("показано {n} из {total}") } else { format!("комплексов {total}") };
|
||||
format!(
|
||||
"КОМАНДНЫЙ ПУНКТ ПВО · {shown} · в работе {busy} · потеряно {lost} · целей {} · сбито {} · J закрыть",
|
||||
sim.drones.iter().filter(|d| d.alive()).count(),
|
||||
sim.kills
|
||||
)
|
||||
},
|
||||
gw - 16.0,
|
||||
),
|
||||
8.0,
|
||||
@@ -221,8 +257,8 @@ pub fn grid(sim: &Sim, (gw, gh): (f32, f32)) -> Vec<Shape> {
|
||||
let (top, gap) = (18.0, 4.0);
|
||||
let cw = (gw - gap * (cols as f32 + 1.0)) / cols as f32;
|
||||
let ch = ((gh - top - gap * rows as f32) / rows as f32).min(cw * 0.62);
|
||||
for i in 0..n {
|
||||
let (c, r) = (i % cols, i / cols);
|
||||
for (k, &i) in picked.iter().take(n).enumerate() {
|
||||
let (c, r) = (k % cols, k / cols);
|
||||
let x = gap + c as f32 * (cw + gap);
|
||||
let y = top + r as f32 * (ch + gap);
|
||||
cell(sim, i, x, y, cw, ch, &mut s);
|
||||
|
||||
Reference in New Issue
Block a user