Tolerate empty TGOs in max_threat_range.

cherry-pick from 3231d00
This commit is contained in:
MetalStormGhost 2022-01-27 10:43:31 +02:00 committed by RndName
parent 815849ae64
commit 99d4cb7ad5
No known key found for this signature in database
GPG Key ID: 5EF516FD9537F7C0

View File

@ -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")