From 70530747b7048df97428b7394c20249f042c8a1c Mon Sep 17 00:00:00 2001 From: Chad Spratt Date: Thu, 11 Dec 2025 15:03:38 -0600 Subject: [PATCH 1/2] Enhance is_detector to include OBSERVER type observers are always ready but because they are cloaked build_progress == 0 unless they are detected --- sc2/unit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc2/unit.py b/sc2/unit.py index 07b63e90..fbf91f9c 100644 --- a/sc2/unit.py +++ b/sc2/unit.py @@ -927,7 +927,7 @@ def detect_range(self) -> float: def is_detector(self) -> bool: """Checks if the unit is a detector. Has to be completed in order to detect and Photoncannons also need to be powered.""" - return self.is_ready and (self.type_id in IS_DETECTOR or self.type_id == UNIT_PHOTONCANNON and self.is_powered) + return self.is_ready and (self.type_id in IS_DETECTOR or self.type_id == UNIT_PHOTONCANNON and self.is_powered) or self.type_id == UnitTypeId.OBSERVER @property def radar_range(self) -> float: From fc925f1cae8c523dd091bdad2650f5d8b4fe96b6 Mon Sep 17 00:00:00 2001 From: Chad Spratt Date: Thu, 11 Dec 2025 15:13:23 -0600 Subject: [PATCH 2/2] pep8 formatting compliance --- sc2/unit.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sc2/unit.py b/sc2/unit.py index fbf91f9c..dab96642 100644 --- a/sc2/unit.py +++ b/sc2/unit.py @@ -927,7 +927,11 @@ def detect_range(self) -> float: def is_detector(self) -> bool: """Checks if the unit is a detector. Has to be completed in order to detect and Photoncannons also need to be powered.""" - return self.is_ready and (self.type_id in IS_DETECTOR or self.type_id == UNIT_PHOTONCANNON and self.is_powered) or self.type_id == UnitTypeId.OBSERVER + return ( + self.is_ready + and (self.type_id in IS_DETECTOR or self.type_id == UNIT_PHOTONCANNON and self.is_powered) + or self.type_id == UnitTypeId.OBSERVER + ) @property def radar_range(self) -> float: