From 99d4cb7ad5ac36a5bebd4f34220fe8b7bf87354b Mon Sep 17 00:00:00 2001 From: MetalStormGhost <89945461+MetalStormGhost@users.noreply.github.com> Date: Thu, 27 Jan 2022 10:43:31 +0200 Subject: [PATCH] Tolerate empty TGOs in max_threat_range. cherry-pick from 3231d00 --- game/theater/theatergroundobject.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/game/theater/theatergroundobject.py b/game/theater/theatergroundobject.py index 51c5bc50..8771fb2a 100644 --- a/game/theater/theatergroundobject.py +++ b/game/theater/theatergroundobject.py @@ -176,7 +176,9 @@ class TheaterGroundObject(MissionTarget, Generic[GroupT]): return self._max_range_of_type(group, "detection_range") def max_threat_range(self) -> Distance: - return max(self.threat_range(g) for g in self.groups) + return ( + max(self.threat_range(g) for g in self.groups) if self.groups else meters(0) + ) def threat_range(self, group: GroupT, radar_only: bool = False) -> Distance: return self._max_range_of_type(group, "threat_range")