Implement the first full radar-profile slice (#134)
Give the separate radar three real profiles over SamKind::Radar and the typed catalog variants: - radar_search: coarse, slow, long-range search plots; no fire authority. - radar_height: raised mast, local refinement of low plots; no fire authority. - radar_track: local search, fast revisit, two refined/fire channels. - radar_multi remains the compatible universal profile, not best everywhere. Tracks now carry the measuring station, product (search/refine/fire), and quality (separate from identification), and keep the station's own plot when a fresher network relay replaces the published position. A relay never refreshes the measurement or authorizes a launch. Ordinary launches need the battery's own confirmed fire plot; launcher-only batteries use a supporting radar's own plot, and the existing heavy far shot keeps its cue-radar exception. Per-tick refinement/fire work is bounded by profile channels and local search radius. Off, damage, network and save/replay behavior are preserved: new saves write the stable profile ID, old role-only lines migrate, and embedded SAM radars keep their own fire authority. The deploy menu, status lines, map, monitor, radar scope and /airdef why explain the profile, source, age, quality, channels and refusal reason. Models/textures are untouched: all profiles reuse the existing radar silhouette (the separate art zone remains for its owner). Tests: profile single/pair/full scenarios and duplicate station, channels, relay source/age/quality, Off/damage, save migration, replay, embedded and Multifunction radars, catalog/generator checks, airdef-mod suites, core lib (non-balance on one thread; the four active balance tests in release) and core scenarios. Co-Authored-By: Kimi Code <noreply@moonshot.ai>
This commit is contained in:
+21
-4
@@ -657,7 +657,20 @@ fn track_lines(sim: &Sim, t: &Track, player: Option<DVec3>, lines: &mut Vec<(Str
|
||||
format!("Статус: {}{}", t.ident().name(), if forecast { format!(" · прогноз {} с", age / 20) } else { format!(" · измерение {} с назад", age / 20) }),
|
||||
if forecast { YELLOW } else { GREEN },
|
||||
));
|
||||
lines.push((format!("Источник: {}", if t.own_within(now, t.ttl as u64) { "своя РЛС" } else { "сеть (чужое измерение)" }), WHITE));
|
||||
let source = sim.sams.iter().enumerate().find(|(_, s)| s.id == t.source).map_or(
|
||||
if t.source == 0 { "неизвестен".to_string() } else { format!("№? ({})", t.source) },
|
||||
|(n, s)| format!("№{} {} ({})", n + 1, s.kind.name(), s.radar_profile().id),
|
||||
);
|
||||
lines.push((format!("Источник: {} · измерил {}", if t.own_within(now, t.ttl as u64) { "своя РЛС" } else { "сеть (чужое измерение)" }, source), WHITE));
|
||||
lines.push((format!("Продукт: {} · качество {}%", t.product.name(), t.quality), WHITE));
|
||||
let authority = if t.own_authorizes(now) {
|
||||
"у измерившей станции пригодно для пуска".to_string()
|
||||
} else if t.own_tick > 0 {
|
||||
format!("измерение станции {} с назад, для пуска не пригодно", now.saturating_sub(t.own_tick) / 20)
|
||||
} else {
|
||||
"передано сетью: собственного измерения нет, нужен огневой трек станции".to_string()
|
||||
};
|
||||
lines.push((format!("Пуск: {authority}"), if t.own_authorizes(now) { GREEN } else { YELLOW }));
|
||||
if t.locked {
|
||||
lines.push(("Огневой захват: да".into(), YELLOW));
|
||||
}
|
||||
@@ -2637,7 +2650,11 @@ impl AirDef {
|
||||
let k = sam.kind;
|
||||
lines.push((format!("{} №{}", k.name(), n + 1), CYAN));
|
||||
if k == SamKind::Radar {
|
||||
lines.push((format!("Роль РЛС: {}", crate::battery_view::radar_role_name(sam.radar_role)), WHITE));
|
||||
let profile = sam.radar_profile();
|
||||
lines.push((format!("Профиль РЛС: {} [{}]", profile.name, profile.id), WHITE));
|
||||
lines.push((crate::battery_view::radar_profile_line(profile), GREY));
|
||||
lines.push((format!("Ограничение: {}", profile.limit), GREY));
|
||||
lines.push((format!("Каналы: {}/{} · профиль задан при размещении", sam.own_channels_used(), profile.channels), GREY));
|
||||
} else if sam.mode == sim::battery::SamMode::LauncherOnly {
|
||||
lines.push(("Отдельная пусковая: внешняя РЛС сопровождения".into(), WHITE));
|
||||
}
|
||||
@@ -2928,7 +2945,7 @@ mod tests {
|
||||
assert_eq!(hover_at(&sim, &ui), Some(Hover::Drone(id)));
|
||||
// A measured track is hoverable in the honest picture too.
|
||||
sim.truth = false;
|
||||
let t = Track { id, class: sim::ClassEst::Firm(sim::Class::Drone), pos: DVec3::new(0.0, 64.0, 0.0), vel: DVec3::ZERO, tick: 0, own_tick: 0, ttl: 200, hits: 3, locked: false };
|
||||
let t = Track { id, class: sim::ClassEst::Firm(sim::Class::Drone), pos: DVec3::new(0.0, 64.0, 0.0), vel: DVec3::ZERO, tick: 0, own_tick: 0, source: 0, product: sim::battery::Measure::Search, quality: 40, own_product: sim::battery::Measure::Search, own_quality: 0, ttl: 200, hits: 3, locked: false };
|
||||
sim.sams[0].tracks.push(t);
|
||||
assert_eq!(hover_at(&sim, &ui), Some(Hover::Track(id)));
|
||||
// Away from the marker there is nothing.
|
||||
@@ -2940,7 +2957,7 @@ mod tests {
|
||||
#[test]
|
||||
fn the_network_card_never_claims_a_target_and_lists_its_status_and_interception() {
|
||||
let (mut sim, id, _) = hover_fixture();
|
||||
let t = Track { id, class: sim::ClassEst::Firm(sim::Class::Drone), pos: DVec3::new(0.0, 64.0, 0.0), vel: DVec3::new(0.0, 0.0, 0.5), tick: 0, own_tick: 0, ttl: 200, hits: 3, locked: true };
|
||||
let t = Track { id, class: sim::ClassEst::Firm(sim::Class::Drone), pos: DVec3::new(0.0, 64.0, 0.0), vel: DVec3::new(0.0, 0.0, 0.5), tick: 0, own_tick: 0, source: 0, product: sim::battery::Measure::Search, quality: 40, own_product: sim::battery::Measure::Search, own_quality: 0, ttl: 200, hits: 3, locked: true };
|
||||
sim.sams[0].tracks.push(t);
|
||||
let mut lines = Vec::new();
|
||||
track_lines(&sim, &t, Some(DVec3::ZERO), &mut lines);
|
||||
|
||||
Reference in New Issue
Block a user