From 51fa0a08915a5176c8193046fa761cfd8e4023b2 Mon Sep 17 00:00:00 2001 From: Khopa Date: Tue, 8 Jun 2021 13:18:27 +0200 Subject: [PATCH] Added function to get cp number of fuel depots --- game/theater/controlpoint.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/game/theater/controlpoint.py b/game/theater/controlpoint.py index a94c7bd3..1f31e9bd 100644 --- a/game/theater/controlpoint.py +++ b/game/theater/controlpoint.py @@ -780,6 +780,22 @@ class ControlPoint(MissionTarget, ABC): """Return the number of ammo depots, including dead ones""" return len([obj for obj in self.connected_objectives if obj.category == "ammo"]) + @property + def active_fuel_depots_count(self) -> int: + """Return the number of available fuel depots""" + return len( + [ + obj + for obj in self.connected_objectives + if obj.category == "fuel" and not obj.is_dead + ] + ) + + @property + def total_fuel_depots_count(self) -> int: + """Return the number of fuel depots, including dead ones""" + return len([obj for obj in self.connected_objectives if obj.category == "fuel"]) + @property def strike_targets(self) -> List[Union[MissionTarget, Unit]]: return []