Do not treat a cooling jammer as an active emitter (#139)
build / mod (push) Failing after 37s

Co-Authored-By: Kimi Code <noreply@moonshot.ai>
This commit is contained in:
2026-11-21 09:20:46 +03:00
parent 01765027b1
commit 433e1500e2
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -1012,6 +1012,11 @@ mod tests {
unit(&mut sim, radar).state = SamState::Search;
unit(&mut sim, ew).state = SamState::Search;
// Cooling down: a jammer locked by heat is not transmitting either.
unit(&mut sim, ew).ew_lock = true;
assert_eq!(source(&sim, ew), Some(Source::Flyby), "an overheated jammer was read as transmitting");
unit(&mut sim, ew).ew_lock = false;
// Damage: a failed sensor is no radar; a damaged hull with a working sensor still emits.
unit(&mut sim, radar).comps.0[Part::Sensor as usize] = 0.0;
assert_eq!(source(&sim, radar), Some(Source::Flyby), "a radar with a failed sensor was read as emitting");
+1 -1
View File
@@ -366,7 +366,7 @@ impl Sam {
/// Its jammer is really on the air: the switch, a live station and a deployed one. The same
/// state `step_ew` transmits in, so a look names jamming only while the transmitter works.
pub fn ew_up(&self) -> bool {
self.ew_on && self.alive() && !self.moving()
self.ew_on && !self.ew_lock && self.alive() && !self.moving()
}
pub fn track(&self, id: u32) -> Option<&Track> {
self.tracks.iter().find(|t| t.id == id)