From d946a9e526978cbe2a5868e0e549586f2cc3e7d5 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sat, 26 Dec 2020 15:40:38 -0800 Subject: [PATCH] Don't count blind SAMs as threats. https://github.com/Khopa/dcs_liberation/issues/647 --- game/theater/theatergroundobject.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/game/theater/theatergroundobject.py b/game/theater/theatergroundobject.py index 123aae63..c89f41fc 100644 --- a/game/theater/theatergroundobject.py +++ b/game/theater/theatergroundobject.py @@ -182,6 +182,13 @@ class TheaterGroundObject(MissionTarget): @property def threat_range(self) -> Distance: + if not self.detection_range: + # For simple SAMs like shilkas, the unit has both a threat and + # detection range. For complex sites like SA-2s, the launcher has a + # threat range and the search/track radars have detection ranges. If + # the site has no detection range it has no radars and can't fire, + # so it's not actually a threat even if it still has launchers. + return meters(0) return self._max_range_of_type("threat_range")