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:
2026-11-20 22:26:16 +03:00
parent 53fbeced22
commit e5ee15a2ca
23 changed files with 1139 additions and 27 deletions
+28 -1
View File
@@ -380,6 +380,31 @@ const UNIT_SPEC_LIGHT: SamSpec = SamSpec {
mast: 1.5,
};
const UNIT_SPEC_OPTICAL: SamSpec = SamSpec {
name: "Оптический пост",
key: "optical",
missile: None,
gun: None,
reload: 0,
scale: 1.0,
rest_pitch: 0.0,
roles: 0,
family: Family::Static,
parts: Parts {
body: "airdef:radar_truck",
launcher: None,
pack: None,
dish: None,
fixed: &[],
spinner: Some(("airdef:radar_panel", 1.2, 0.0, 0.6, -0.2)),
},
mount: (0.0, 0.0),
pivot: DVec3::ZERO,
muzzle: Muzzle::None,
sensor: 0.0,
mast: 2.5,
};
impl SamKind {
/// Its row of numbers from `catalog/specs.json`.
pub fn spec(self) -> &'static SamSpec {
@@ -399,13 +424,14 @@ impl SamKind {
SamKind::Tzm => &UNIT_SPEC_TZM,
SamKind::Ew => &UNIT_SPEC_EW,
SamKind::Light => &UNIT_SPEC_LIGHT,
SamKind::Optical => &UNIT_SPEC_OPTICAL,
}
}
}
/// Save keys by kind; a rename needs an explicit migration.
#[cfg(test)]
pub(super) const UNIT_SPEC_KEYS: [(SamKind, &str); 15] = [
pub(super) const UNIT_SPEC_KEYS: [(SamKind, &str); 16] = [
(SamKind::Patriot, "patriot"),
(SamKind::Gepard, "gepard"),
(SamKind::Pantsir, "pantsir"),
@@ -421,4 +447,5 @@ pub(super) const UNIT_SPEC_KEYS: [(SamKind, &str); 15] = [
(SamKind::Tzm, "tzm"),
(SamKind::Ew, "ew"),
(SamKind::Light, "light"),
(SamKind::Optical, "optical"),
];