From 747683e9e8738a98e82d7debd83237a20c19b408 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Mon, 10 May 2021 20:21:19 -0700 Subject: [PATCH] Allow other TGO types to be factories. The `FactoryGroundObject` is just a special case of `BuildingGroundObject` that we maybe don't actually need. For now it provides some special case logic for the layout, but this allows any TGO with the "factory" category to behave as a ground unit source. Note that the "factory" random strike targets are *not* generated anymore, so this doesn't affect campaign design currently. --- game/theater/controlpoint.py | 5 ++--- game/theater/theatergroundobject.py | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/game/theater/controlpoint.py b/game/theater/controlpoint.py index f811f059..f7714b72 100644 --- a/game/theater/controlpoint.py +++ b/game/theater/controlpoint.py @@ -21,17 +21,16 @@ from dcs.terrain.terrain import Airport, ParkingSlot from dcs.unittype import FlyingType from game import db +from game.point_with_heading import PointWithHeading from gen.flights.closestairfields import ObjectiveDistanceCache from gen.ground_forces.ai_ground_planner_db import TYPE_SHORAD from gen.ground_forces.combat_stance import CombatStance from gen.runways import RunwayAssigner, RunwayData from .base import Base from .missiontarget import MissionTarget -from game.point_with_heading import PointWithHeading from .theatergroundobject import ( BaseDefenseGroundObject, EwrGroundObject, - FactoryGroundObject, GenericCarrierGroundObject, SamGroundObject, TheaterGroundObject, @@ -341,7 +340,7 @@ class ControlPoint(MissionTarget, ABC): @property def has_factory(self) -> bool: for tgo in self.connected_objectives: - if isinstance(tgo, FactoryGroundObject) and not tgo.is_dead: + if tgo.is_factory and not tgo.is_dead: return True return False diff --git a/game/theater/theatergroundobject.py b/game/theater/theatergroundobject.py index 949e93a7..ec12bf08 100644 --- a/game/theater/theatergroundobject.py +++ b/game/theater/theatergroundobject.py @@ -217,6 +217,10 @@ class TheaterGroundObject(MissionTarget): return meters(0) return self._max_range_of_type(group, "threat_range") + @property + def is_factory(self) -> bool: + return self.category == "factory" + class BuildingGroundObject(TheaterGroundObject): def __init__(