Clean up and rename ControlPoint.for_airbase.

This commit is contained in:
Dan Albert 2021-05-30 21:08:12 -07:00
parent 6616359baf
commit 4055b06e71
4 changed files with 11 additions and 24 deletions

View File

@ -307,7 +307,6 @@ class AirbaseGroundObjectGenerator(ControlPointGroundObjectGenerator):
group_id, group_id,
position, position,
self.control_point, self.control_point,
for_airbase=False,
) )
group = generate_armor_group(self.faction_name, self.game, g) group = generate_armor_group(self.faction_name, self.game, g)
@ -416,7 +415,6 @@ class AirbaseGroundObjectGenerator(ControlPointGroundObjectGenerator):
group_id, group_id,
position, position,
self.control_point, self.control_point,
for_airbase=False,
) )
groups = generate_anti_air_group(self.game, g, self.faction, ranges) groups = generate_anti_air_group(self.game, g, self.faction, ranges)
if not groups: if not groups:
@ -437,7 +435,6 @@ class AirbaseGroundObjectGenerator(ControlPointGroundObjectGenerator):
group_id, group_id,
position, position,
self.control_point, self.control_point,
for_airbase=False,
) )
group = generate_ewr_group(self.game, g, self.faction) group = generate_ewr_group(self.game, g, self.faction)
if group is None: if group is None:
@ -582,7 +579,7 @@ class FobGroundObjectGenerator(AirbaseGroundObjectGenerator):
unit["heading"], unit["heading"],
self.control_point, self.control_point,
unit["type"], unit["type"],
airbase_group=True, is_fob_structure=True,
) )
self.control_point.connected_objectives.append(g) self.control_point.connected_objectives.append(g)

View File

@ -12,7 +12,6 @@ from dcs.unittype import VehicleType
from .. import db from .. import db
from ..data.radar_db import ( from ..data.radar_db import (
UNITS_WITH_RADAR,
TRACK_RADARS, TRACK_RADARS,
TELARS, TELARS,
LAUNCHER_TRACKER_PAIRS, LAUNCHER_TRACKER_PAIRS,
@ -58,7 +57,6 @@ class TheaterGroundObject(MissionTarget):
heading: int, heading: int,
control_point: ControlPoint, control_point: ControlPoint,
dcs_identifier: str, dcs_identifier: str,
airbase_group: bool,
sea_object: bool, sea_object: bool,
) -> None: ) -> None:
super().__init__(name, position) super().__init__(name, position)
@ -67,7 +65,6 @@ class TheaterGroundObject(MissionTarget):
self.heading = heading self.heading = heading
self.control_point = control_point self.control_point = control_point
self.dcs_identifier = dcs_identifier self.dcs_identifier = dcs_identifier
self.airbase_group = airbase_group
self.sea_object = sea_object self.sea_object = sea_object
self.groups: List[Group] = [] self.groups: List[Group] = []
@ -205,7 +202,7 @@ class BuildingGroundObject(TheaterGroundObject):
heading: int, heading: int,
control_point: ControlPoint, control_point: ControlPoint,
dcs_identifier: str, dcs_identifier: str,
airbase_group=False, is_fob_structure=False,
) -> None: ) -> None:
super().__init__( super().__init__(
name=name, name=name,
@ -215,9 +212,9 @@ class BuildingGroundObject(TheaterGroundObject):
heading=heading, heading=heading,
control_point=control_point, control_point=control_point,
dcs_identifier=dcs_identifier, dcs_identifier=dcs_identifier,
airbase_group=airbase_group,
sea_object=False, sea_object=False,
) )
self.is_fob_structure = is_fob_structure
self.object_id = object_id self.object_id = object_id
# Other TGOs track deadness based on the number of alive units, but # Other TGOs track deadness based on the number of alive units, but
# buildings don't have groups assigned to the TGO. # buildings don't have groups assigned to the TGO.
@ -250,6 +247,10 @@ class BuildingGroundObject(TheaterGroundObject):
def strike_targets(self) -> List[Union[MissionTarget, Unit]]: def strike_targets(self) -> List[Union[MissionTarget, Unit]]:
return list(self.iter_building_group()) return list(self.iter_building_group())
@property
def is_control_point(self) -> bool:
return self.is_fob_structure
class SceneryGroundObject(BuildingGroundObject): class SceneryGroundObject(BuildingGroundObject):
def __init__( def __init__(
@ -272,7 +273,7 @@ class SceneryGroundObject(BuildingGroundObject):
heading=0, heading=0,
control_point=control_point, control_point=control_point,
dcs_identifier=dcs_identifier, dcs_identifier=dcs_identifier,
airbase_group=False, is_fob_structure=False,
) )
self.zone = zone self.zone = zone
try: try:
@ -305,7 +306,7 @@ class FactoryGroundObject(BuildingGroundObject):
heading=heading, heading=heading,
control_point=control_point, control_point=control_point,
dcs_identifier="Workshop A", dcs_identifier="Workshop A",
airbase_group=False, is_fob_structure=False,
) )
@ -339,7 +340,6 @@ class CarrierGroundObject(GenericCarrierGroundObject):
heading=0, heading=0,
control_point=control_point, control_point=control_point,
dcs_identifier="CARRIER", dcs_identifier="CARRIER",
airbase_group=True,
sea_object=True, sea_object=True,
) )
@ -361,7 +361,6 @@ class LhaGroundObject(GenericCarrierGroundObject):
heading=0, heading=0,
control_point=control_point, control_point=control_point,
dcs_identifier="LHA", dcs_identifier="LHA",
airbase_group=True,
sea_object=True, sea_object=True,
) )
@ -384,7 +383,6 @@ class MissileSiteGroundObject(TheaterGroundObject):
heading=0, heading=0,
control_point=control_point, control_point=control_point,
dcs_identifier="AA", dcs_identifier="AA",
airbase_group=False,
sea_object=False, sea_object=False,
) )
@ -406,7 +404,6 @@ class CoastalSiteGroundObject(TheaterGroundObject):
heading=heading, heading=heading,
control_point=control_point, control_point=control_point,
dcs_identifier="AA", dcs_identifier="AA",
airbase_group=False,
sea_object=False, sea_object=False,
) )
@ -421,7 +418,6 @@ class SamGroundObject(TheaterGroundObject):
group_id: int, group_id: int,
position: Point, position: Point,
control_point: ControlPoint, control_point: ControlPoint,
for_airbase: bool,
) -> None: ) -> None:
super().__init__( super().__init__(
name=name, name=name,
@ -431,7 +427,6 @@ class SamGroundObject(TheaterGroundObject):
heading=0, heading=0,
control_point=control_point, control_point=control_point,
dcs_identifier="AA", dcs_identifier="AA",
airbase_group=for_airbase,
sea_object=False, sea_object=False,
) )
# Set by the SAM unit generator if the generated group is compatible # Set by the SAM unit generator if the generated group is compatible
@ -499,7 +494,6 @@ class VehicleGroupGroundObject(TheaterGroundObject):
group_id: int, group_id: int,
position: Point, position: Point,
control_point: ControlPoint, control_point: ControlPoint,
for_airbase: bool,
) -> None: ) -> None:
super().__init__( super().__init__(
name=name, name=name,
@ -509,7 +503,6 @@ class VehicleGroupGroundObject(TheaterGroundObject):
heading=0, heading=0,
control_point=control_point, control_point=control_point,
dcs_identifier="AA", dcs_identifier="AA",
airbase_group=for_airbase,
sea_object=False, sea_object=False,
) )
@ -521,7 +514,6 @@ class EwrGroundObject(TheaterGroundObject):
group_id: int, group_id: int,
position: Point, position: Point,
control_point: ControlPoint, control_point: ControlPoint,
for_airbase: bool,
) -> None: ) -> None:
super().__init__( super().__init__(
name=name, name=name,
@ -531,7 +523,6 @@ class EwrGroundObject(TheaterGroundObject):
heading=0, heading=0,
control_point=control_point, control_point=control_point,
dcs_identifier="EWR", dcs_identifier="EWR",
airbase_group=for_airbase,
sea_object=False, sea_object=False,
) )
@ -564,7 +555,6 @@ class ShipGroundObject(NavalGroundObject):
heading=0, heading=0,
control_point=control_point, control_point=control_point,
dcs_identifier="AA", dcs_identifier="AA",
airbase_group=False,
sea_object=True, sea_object=True,
) )

View File

@ -433,7 +433,7 @@ class ObjectiveFinder:
is_building = isinstance(ground_object, BuildingGroundObject) is_building = isinstance(ground_object, BuildingGroundObject)
is_fob = isinstance(enemy_cp, Fob) is_fob = isinstance(enemy_cp, Fob)
if is_building and is_fob and ground_object.airbase_group: if is_building and is_fob and ground_object.is_control_point:
# This is the FOB structure itself. Can't be repaired or # This is the FOB structure itself. Can't be repaired or
# targeted by the player, so shouldn't be targetable by the # targeted by the player, so shouldn't be targetable by the
# AI. # AI.

View File

@ -356,7 +356,7 @@ class QBuyGroupForGroundObjectDialog(QDialog):
self.mainLayout = QHBoxLayout() self.mainLayout = QHBoxLayout()
self.mainLayout.addWidget(self.buySamBox) self.mainLayout.addWidget(self.buySamBox)
if self.ground_object.airbase_group: if self.ground_object.is_control_point:
self.mainLayout.addWidget(self.buyArmorBox) self.mainLayout.addWidget(self.buyArmorBox)
self.setLayout(self.mainLayout) self.setLayout(self.mainLayout)