Add passive optical observation post (#136)
- new Optical unit kind with its own catalog row and deploy item - bounded one-contact line-of-sight checks against land and blocks - day/night reach and hold timing; obstacle and unknown geometry block sight - independent class observation with source, time and uncertainty, never DroneKind - map/monitor/panel statuses and a line to the selected contact - tests: day/night, wall/unknown, ageing, no kind leak, bounded work, passivity Cherry-picked from 3ae21123964a9d3234bb2b3efc9ff926d64fc77d onto the #132/#133/#134 base: the cue test's track literal now carries the shared class/source/product/quality contract instead of a DroneKind. Co-Authored-By: Kimi Code <noreply@moonshot.ai>
This commit is contained in:
@@ -72,6 +72,16 @@ pub fn sam_status(sam: &Sam) -> String {
|
||||
return format!("{text} «{}»: {}; целей {}{broken}, {channels}", profile.name, profile.products_text(), sam.own.len());
|
||||
}
|
||||
SamKind::Light => return format!("{text}{}", if sam.target.is_some() { ": в луче цель" } else { "" }),
|
||||
SamKind::Optical => {
|
||||
let mut t = format!("{text}: {}", sam.optical.status_text());
|
||||
if sam.health < 1.0 {
|
||||
t += &format!(" ({:.0}%)", sam.health * 100.0);
|
||||
}
|
||||
if !sam.comps.whole() {
|
||||
t += &format!(" [{}]", crate::why_view::worst(&sam.comps, sam.kind));
|
||||
}
|
||||
return t;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if let Some(cell) = sam.preparing_cell() {
|
||||
@@ -158,6 +168,9 @@ mod tests {
|
||||
let mut light = Sam::new(8, SamKind::Light, DVec3::ZERO, 0.0);
|
||||
light.target = Some(1);
|
||||
assert_eq!(sam_status(&light), "Прожектор: в луче цель");
|
||||
|
||||
let optical = Sam::new(9, SamKind::Optical, DVec3::ZERO, 0.0);
|
||||
assert_eq!(sam_status(&optical), "Оптический пост: ищет");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user