Require factories for purchasing ground units.

https://github.com/Khopa/dcs_liberation/issues/986
This commit is contained in:
Dan Albert
2021-04-18 21:18:44 -07:00
parent 67b341cbd6
commit 627f18c42b
4 changed files with 60 additions and 29 deletions

View File

@@ -31,6 +31,7 @@ from game.point_with_heading import PointWithHeading
from .theatergroundobject import (
BaseDefenseGroundObject,
EwrGroundObject,
FactoryGroundObject,
GenericCarrierGroundObject,
SamGroundObject,
TheaterGroundObject,
@@ -312,6 +313,16 @@ class ControlPoint(MissionTarget, ABC):
connected.extend(cp.transitive_connected_friendly_points(seen))
return connected
def can_recruit_ground_units(self, game: Game) -> bool:
"""Returns True if this control point is capable of recruiting ground units."""
if not game.settings.enable_new_ground_unit_recruitment:
return True
for tgo in self.connected_objectives:
if isinstance(tgo, FactoryGroundObject) and not tgo.is_dead:
return True
return False
@property
def is_carrier(self):
"""