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:
+10
-3
@@ -179,14 +179,21 @@ mod catalog_tests {
|
||||
}
|
||||
fn item_exists(item: &str) {
|
||||
let name = item.strip_prefix("airdef:").expect("item namespace");
|
||||
for path in [format!("items/{name}.json"), format!("models/item/{name}.json"), format!("textures/item/{name}.png")] {
|
||||
for path in [format!("items/{name}.json"), format!("models/item/{name}.json")] {
|
||||
assert!(assets().join(&path).is_file(), "{item}: missing {path}");
|
||||
}
|
||||
let definition = std::fs::read_to_string(assets().join(format!("items/{name}.json"))).unwrap();
|
||||
assert!(definition.contains(&format!("airdef:item/{name}")), "{item}: wrong item model");
|
||||
let model = std::fs::read_to_string(assets().join(format!("models/item/{name}.json"))).unwrap();
|
||||
assert!(model.contains(&format!("airdef:item/{name}")), "{item}: wrong icon reference");
|
||||
let png = std::fs::read(assets().join(format!("textures/item/{name}.png"))).unwrap();
|
||||
// The icon reference may be an alias of an existing texture (the optical post uses the
|
||||
// radar icon until its own asset lands, #136); what matters is that the PNG it names exists.
|
||||
let layer = model
|
||||
.split("\"layer0\": \"")
|
||||
.nth(1)
|
||||
.and_then(|s| s.split('"').next())
|
||||
.unwrap_or_else(|| panic!("{item}: no icon reference"));
|
||||
let texture = layer.strip_prefix("airdef:item/").unwrap_or_else(|| panic!("{item}: bad icon reference {layer}"));
|
||||
let png = std::fs::read(assets().join(format!("textures/item/{texture}.png"))).unwrap();
|
||||
assert!(png.starts_with(b"\x89PNG\r\n\x1a\n"), "{item}: invalid PNG signature");
|
||||
}
|
||||
fn model_exists(model: &str) {
|
||||
|
||||
Reference in New Issue
Block a user