mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Streamlining
This commit is contained in:
parent
3499ba5ffa
commit
c50dcaaafb
@ -24,5 +24,5 @@ class Builder(FormationAttackBuilder[SeadSweepFlightPlan, FormationAttackLayout]
|
|||||||
def layout(self) -> FormationAttackLayout:
|
def layout(self) -> FormationAttackLayout:
|
||||||
return self._build(FlightWaypointType.INGRESS_SEAD_SWEEP)
|
return self._build(FlightWaypointType.INGRESS_SEAD_SWEEP)
|
||||||
|
|
||||||
def build(self) -> SeadSweepFlightPlan:
|
def build(self, dump_debug_info: bool = False) -> SeadSweepFlightPlan:
|
||||||
return SeadSweepFlightPlan(self.flight, self.layout())
|
return SeadSweepFlightPlan(self.flight, self.layout())
|
||||||
|
|||||||
@ -297,7 +297,9 @@ class AircraftType(UnitType[Type[FlyingType]]):
|
|||||||
else:
|
else:
|
||||||
# Slow like warbirds or helicopters
|
# Slow like warbirds or helicopters
|
||||||
# Use whichever is slowest - mach 0.35 or 50% of max speed
|
# Use whichever is slowest - mach 0.35 or 50% of max speed
|
||||||
logging.debug(f"{self.display_name} max_speed * 0.5 is {max_speed * 0.5}")
|
logging.debug(
|
||||||
|
f"{self.display_name} max_speed * 0.5 is {max_speed * 0.5}"
|
||||||
|
)
|
||||||
return min(Speed.from_mach(0.35, altitude), max_speed * 0.5)
|
return min(Speed.from_mach(0.35, altitude), max_speed * 0.5)
|
||||||
|
|
||||||
def alloc_flight_radio(self, radio_registry: RadioRegistry) -> RadioFrequency:
|
def alloc_flight_radio(self, radio_registry: RadioRegistry) -> RadioFrequency:
|
||||||
@ -362,11 +364,17 @@ class AircraftType(UnitType[Type[FlyingType]]):
|
|||||||
state.update(updated.__dict__)
|
state.update(updated.__dict__)
|
||||||
self.__dict__.update(state)
|
self.__dict__.update(state)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _migrator() -> Dict[str, str]:
|
||||||
|
return {
|
||||||
|
"F-15E Strike Eagle (AI)": "F-15E Strike Eagle"
|
||||||
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def named(cls, name: str) -> AircraftType:
|
def named(cls, name: str) -> AircraftType:
|
||||||
if not cls._loaded:
|
if not cls._loaded:
|
||||||
cls._load_all()
|
cls._load_all()
|
||||||
return cls._by_name[name]
|
return cls._by_name[cls._migrator().get(name, name)]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def for_dcs_type(cls, dcs_unit_type: Type[FlyingType]) -> Iterator[AircraftType]:
|
def for_dcs_type(cls, dcs_unit_type: Type[FlyingType]) -> Iterator[AircraftType]:
|
||||||
@ -422,7 +430,6 @@ class AircraftType(UnitType[Type[FlyingType]]):
|
|||||||
def _variant_from_dict(
|
def _variant_from_dict(
|
||||||
cls, aircraft: Type[FlyingType], variant_id: str, data: dict[str, Any]
|
cls, aircraft: Type[FlyingType], variant_id: str, data: dict[str, Any]
|
||||||
) -> AircraftType:
|
) -> AircraftType:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
price = data["price"]
|
price = data["price"]
|
||||||
except KeyError as ex:
|
except KeyError as ex:
|
||||||
|
|||||||
@ -541,7 +541,7 @@ class Faction:
|
|||||||
|
|
||||||
def remove_aircraft_by_name(self, name: str) -> None:
|
def remove_aircraft_by_name(self, name: str) -> None:
|
||||||
for i in list(self.aircrafts):
|
for i in list(self.aircrafts):
|
||||||
if i.name == name:
|
if i.display_name == name:
|
||||||
self.aircrafts.remove(i)
|
self.aircrafts.remove(i)
|
||||||
|
|
||||||
def remove_preset(self, name: str) -> None:
|
def remove_preset(self, name: str) -> None:
|
||||||
|
|||||||
@ -119,7 +119,6 @@ class RequirementBuilder:
|
|||||||
def maximum_turn_to(
|
def maximum_turn_to(
|
||||||
self, turn_point: Point, next_point: Point, turn_limit: Heading
|
self, turn_point: Point, next_point: Point, turn_limit: Heading
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
large_distance = nautical_miles(400)
|
large_distance = nautical_miles(400)
|
||||||
next_heading = Heading.from_degrees(
|
next_heading = Heading.from_degrees(
|
||||||
angle_between_points(next_point, turn_point)
|
angle_between_points(next_point, turn_point)
|
||||||
|
|||||||
@ -61,7 +61,7 @@ class Migrator:
|
|||||||
for c in self.game.coalitions:
|
for c in self.game.coalitions:
|
||||||
for p in c.ato.packages:
|
for p in c.ato.packages:
|
||||||
if p.waypoints and not hasattr(p.waypoints, "initial"):
|
if p.waypoints and not hasattr(p.waypoints, "initial"):
|
||||||
p.waypoints = PackageWaypoints.create(p, c)
|
p.waypoints = PackageWaypoints.create(p, c, False)
|
||||||
|
|
||||||
def _update_package_attributes(self) -> None:
|
def _update_package_attributes(self) -> None:
|
||||||
for c in self.game.coalitions:
|
for c in self.game.coalitions:
|
||||||
|
|||||||
@ -31,10 +31,10 @@ class QFactionUnits(QScrollArea):
|
|||||||
|
|
||||||
def _add_checkboxes(self, units: set, counter: int, grid: QGridLayout) -> int:
|
def _add_checkboxes(self, units: set, counter: int, grid: QGridLayout) -> int:
|
||||||
counter += 1
|
counter += 1
|
||||||
for i, v in enumerate(sorted(units, key=lambda x: x.name), counter):
|
for i, v in enumerate(sorted(units, key=lambda x: str(x)), counter):
|
||||||
cb = QCheckBox(v.name)
|
cb = QCheckBox(str(v))
|
||||||
cb.setCheckState(Qt.CheckState.Checked)
|
cb.setCheckState(Qt.CheckState.Checked)
|
||||||
self.checkboxes[v.name] = cb
|
self.checkboxes[str(v)] = cb
|
||||||
grid.addWidget(cb, i, 1)
|
grid.addWidget(cb, i, 1)
|
||||||
counter += 1
|
counter += 1
|
||||||
counter += 1
|
counter += 1
|
||||||
|
|||||||
@ -86,7 +86,7 @@ def capture_fuzz_failures(solver: IpSolver) -> Iterator[None]:
|
|||||||
WaypointSolverTestCaseReducer(
|
WaypointSolverTestCaseReducer(
|
||||||
solver.debug_output_directory, test_case_directory
|
solver.debug_output_directory, test_case_directory
|
||||||
).reduce()
|
).reduce()
|
||||||
ex.add_note(f"Reduced test case was written to {test_case_directory}")
|
ex.add_note(f"Reduced test case was written to {test_case_directory}") # type: ignore
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user