Rename OCA strike tasks.

This commit is contained in:
Dan Albert 2020-11-24 17:28:48 -08:00
parent 65ac30acda
commit b99462b628
7 changed files with 29 additions and 26 deletions

View File

@ -389,8 +389,8 @@ class Airfield(ControlPoint):
]
else:
yield from [
FlightType.OCA_STRIKE,
FlightType.RUNWAY_ATTACK,
FlightType.OCA_AIRCRAFT,
FlightType.OCA_RUNWAY,
]
yield from super().mission_types(for_player)

View File

@ -1230,10 +1230,10 @@ class AircraftConflictGenerator:
self.configure_anti_ship(group, package, flight, dynamic_runways)
elif flight_type == FlightType.ESCORT:
self.configure_escort(group, package, flight, dynamic_runways)
elif flight_type == FlightType.RUNWAY_ATTACK:
elif flight_type == FlightType.OCA_RUNWAY:
self.configure_runway_attack(group, package, flight,
dynamic_runways)
elif flight_type == FlightType.OCA_STRIKE:
elif flight_type == FlightType.OCA_AIRCRAFT:
self.configure_oca_strike(group, package, flight, dynamic_runways)
else:
self.configure_unknown_task(group, flight)
@ -1377,8 +1377,8 @@ class PydcsWaypointBuilder:
FlightWaypointType.INGRESS_BAI: BaiIngressBuilder,
FlightWaypointType.INGRESS_CAS: CasIngressBuilder,
FlightWaypointType.INGRESS_DEAD: DeadIngressBuilder,
FlightWaypointType.INGRESS_OCA_STRIKE: OcaStrikeIngressBuilder,
FlightWaypointType.INGRESS_RUNWAY_BOMBING: RunwayBombingIngressBuilder,
FlightWaypointType.INGRESS_OCA_AIRCRAFT: OcaAircraftIngressBuilder,
FlightWaypointType.INGRESS_OCA_RUNWAY: OcaRunwayIngressBuilder,
FlightWaypointType.INGRESS_SEAD: SeadIngressBuilder,
FlightWaypointType.INGRESS_STRIKE: StrikeIngressBuilder,
FlightWaypointType.INGRESS_SWEEP: SweepIngressBuilder,
@ -1514,7 +1514,7 @@ class DeadIngressBuilder(PydcsWaypointBuilder):
return waypoint
class OcaStrikeIngressBuilder(PydcsWaypointBuilder):
class OcaAircraftIngressBuilder(PydcsWaypointBuilder):
def build(self) -> MovingPoint:
waypoint = super().build()
@ -1540,7 +1540,7 @@ class OcaStrikeIngressBuilder(PydcsWaypointBuilder):
return waypoint
class RunwayBombingIngressBuilder(PydcsWaypointBuilder):
class OcaRunwayIngressBuilder(PydcsWaypointBuilder):
def build(self) -> MovingPoint:
waypoint = super().build()

View File

@ -147,8 +147,8 @@ class Package:
FlightType.CAS,
FlightType.STRIKE,
FlightType.ANTISHIP,
FlightType.OCA_STRIKE,
FlightType.RUNWAY_ATTACK,
FlightType.OCA_AIRCRAFT,
FlightType.OCA_RUNWAY,
FlightType.BAI,
FlightType.DEAD,
FlightType.SEAD,
@ -173,6 +173,9 @@ class Package:
task = self.primary_task
if task is None:
return "No mission"
oca_strike_types = {FlightType.OCA_AIRCRAFT, FlightType.OCA_RUNWAY}
if task in oca_strike_types:
return "OCA Strike"
return str(task)
def __hash__(self) -> int:

View File

@ -163,9 +163,9 @@ class AircraftAllocator:
return CAS_PREFERRED
elif task in (FlightType.DEAD, FlightType.SEAD):
return SEAD_PREFERRED
elif task == FlightType.OCA_STRIKE:
elif task == FlightType.OCA_AIRCRAFT:
return CAS_PREFERRED
elif task == FlightType.RUNWAY_ATTACK:
elif task == FlightType.OCA_RUNWAY:
return RUNWAY_ATTACK_PREFERRED
elif task == FlightType.STRIKE:
return STRIKE_PREFERRED
@ -187,9 +187,9 @@ class AircraftAllocator:
return CAS_CAPABLE
elif task in (FlightType.DEAD, FlightType.SEAD):
return SEAD_CAPABLE
elif task == FlightType.OCA_STRIKE:
elif task == FlightType.OCA_AIRCRAFT:
return CAS_CAPABLE
elif task == FlightType.RUNWAY_ATTACK:
elif task == FlightType.OCA_RUNWAY:
return RUNWAY_ATTACK_CAPABLE
elif task == FlightType.STRIKE:
return STRIKE_CAPABLE
@ -569,8 +569,8 @@ class CoalitionMissionPlanner:
for target in self.objective_finder.oca_targets(min_aircraft=20):
yield ProposedMission(target, [
ProposedFlight(FlightType.OCA_STRIKE, 2, self.MAX_OCA_RANGE),
ProposedFlight(FlightType.RUNWAY_ATTACK, 2, self.MAX_OCA_RANGE),
ProposedFlight(FlightType.OCA_AIRCRAFT, 2, self.MAX_OCA_RANGE),
ProposedFlight(FlightType.OCA_RUNWAY, 2, self.MAX_OCA_RANGE),
# TODO: Max escort range.
ProposedFlight(FlightType.ESCORT, 2, self.MAX_OCA_RANGE),
ProposedFlight(FlightType.SEAD, 2, self.MAX_OCA_RANGE),

View File

@ -28,8 +28,8 @@ class FlightType(Enum):
ESCORT = "Escort"
BAI = "BAI"
SWEEP = "Fighter sweep"
RUNWAY_ATTACK = "Runway attack"
OCA_STRIKE = "OCA Strike"
OCA_RUNWAY = "OCA/Runway"
OCA_AIRCRAFT = "OCA/Aircraft"
def __str__(self) -> str:
return self.value
@ -60,8 +60,8 @@ class FlightWaypointType(Enum):
INGRESS_SWEEP = 21
INGRESS_BAI = 22
DIVERT = 23
INGRESS_RUNWAY_BOMBING = 24
INGRESS_OCA_STRIKE = 25
INGRESS_OCA_RUNWAY = 24
INGRESS_OCA_AIRCRAFT = 25
class FlightWaypoint:

View File

@ -649,9 +649,9 @@ class FlightPlanBuilder:
return self.generate_dead(flight, custom_targets)
elif task == FlightType.ESCORT:
return self.generate_escort(flight)
elif task == FlightType.OCA_STRIKE:
elif task == FlightType.OCA_AIRCRAFT:
return self.generate_oca_strike(flight)
elif task == FlightType.RUNWAY_ATTACK:
elif task == FlightType.OCA_RUNWAY:
return self.generate_runway_attack(flight)
elif task == FlightType.SEAD:
return self.generate_sead(flight, custom_targets)
@ -964,7 +964,7 @@ class FlightPlanBuilder:
raise InvalidObjectiveLocation(flight.flight_type, location)
return self.strike_flightplan(flight, location,
FlightWaypointType.INGRESS_OCA_STRIKE)
FlightWaypointType.INGRESS_OCA_AIRCRAFT)
def generate_runway_attack(self, flight: Flight) -> StrikeFlightPlan:
"""Generate a runway attack flight plan at a given location.
@ -981,7 +981,7 @@ class FlightPlanBuilder:
raise InvalidObjectiveLocation(flight.flight_type, location)
return self.strike_flightplan(flight, location,
FlightWaypointType.INGRESS_RUNWAY_BOMBING)
FlightWaypointType.INGRESS_OCA_RUNWAY)
def generate_sead(self, flight: Flight,
custom_targets: Optional[List[Unit]]) -> StrikeFlightPlan:
@ -1079,7 +1079,7 @@ class FlightPlanBuilder:
return builder.dead_area(location)
elif flight.flight_type == FlightType.SEAD:
return builder.sead_area(location)
elif flight.flight_type == FlightType.OCA_STRIKE:
elif flight.flight_type == FlightType.OCA_AIRCRAFT:
return builder.oca_strike_area(location)
else:
return builder.strike_area(location)

View File

@ -80,7 +80,7 @@ class QBaseMenu2(QDialog):
bottom_row = QHBoxLayout()
main_layout.addLayout(bottom_row)
if FlightType.RUNWAY_ATTACK in self.cp.mission_types(for_player=True):
if FlightType.OCA_RUNWAY in self.cp.mission_types(for_player=True):
runway_attack_button = QPushButton("Attack airfield")
bottom_row.addWidget(runway_attack_button)