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.
This commit is contained in:
Dan Albert 2021-05-10 20:21:19 -07:00
parent 5b191d72a6
commit 747683e9e8
2 changed files with 6 additions and 3 deletions

View File

@ -21,17 +21,16 @@ from dcs.terrain.terrain import Airport, ParkingSlot
from dcs.unittype import FlyingType from dcs.unittype import FlyingType
from game import db from game import db
from game.point_with_heading import PointWithHeading
from gen.flights.closestairfields import ObjectiveDistanceCache from gen.flights.closestairfields import ObjectiveDistanceCache
from gen.ground_forces.ai_ground_planner_db import TYPE_SHORAD from gen.ground_forces.ai_ground_planner_db import TYPE_SHORAD
from gen.ground_forces.combat_stance import CombatStance from gen.ground_forces.combat_stance import CombatStance
from gen.runways import RunwayAssigner, RunwayData from gen.runways import RunwayAssigner, RunwayData
from .base import Base from .base import Base
from .missiontarget import MissionTarget from .missiontarget import MissionTarget
from game.point_with_heading import PointWithHeading
from .theatergroundobject import ( from .theatergroundobject import (
BaseDefenseGroundObject, BaseDefenseGroundObject,
EwrGroundObject, EwrGroundObject,
FactoryGroundObject,
GenericCarrierGroundObject, GenericCarrierGroundObject,
SamGroundObject, SamGroundObject,
TheaterGroundObject, TheaterGroundObject,
@ -341,7 +340,7 @@ class ControlPoint(MissionTarget, ABC):
@property @property
def has_factory(self) -> bool: def has_factory(self) -> bool:
for tgo in self.connected_objectives: 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 True
return False return False

View File

@ -217,6 +217,10 @@ class TheaterGroundObject(MissionTarget):
return meters(0) return meters(0)
return self._max_range_of_type(group, "threat_range") return self._max_range_of_type(group, "threat_range")
@property
def is_factory(self) -> bool:
return self.category == "factory"
class BuildingGroundObject(TheaterGroundObject): class BuildingGroundObject(TheaterGroundObject):
def __init__( def __init__(