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
a2630fc75f
commit
03d8448def
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import TYPE_CHECKING, Type
|
from typing import TYPE_CHECKING, Type, Optional
|
||||||
|
|
||||||
from game.theater import FrontLine
|
from game.theater import FrontLine
|
||||||
from game.utils import Distance, Speed, kph, dcs_to_shapely_point
|
from game.utils import Distance, Speed, kph, dcs_to_shapely_point
|
||||||
@ -15,7 +15,7 @@ from .uizonedisplay import UiZone, UiZoneDisplay
|
|||||||
from .waypointbuilder import WaypointBuilder
|
from .waypointbuilder import WaypointBuilder
|
||||||
from ..flightwaypointtype import FlightWaypointType
|
from ..flightwaypointtype import FlightWaypointType
|
||||||
from ...flightplan.ipsolver import IpSolver
|
from ...flightplan.ipsolver import IpSolver
|
||||||
from ...persistence.paths import waypoint_debug_directory
|
from ...persistency import waypoint_debug_directory
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from ..flightwaypoint import FlightWaypoint
|
from ..flightwaypoint import FlightWaypoint
|
||||||
@ -23,12 +23,13 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class CasLayout(PatrollingLayout):
|
class CasLayout(PatrollingLayout):
|
||||||
ingress: FlightWaypoint
|
ingress: Optional[FlightWaypoint]
|
||||||
|
|
||||||
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
|
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
|
||||||
yield self.departure
|
yield self.departure
|
||||||
yield from self.nav_to
|
yield from self.nav_to
|
||||||
yield self.ingress
|
if self.ingress:
|
||||||
|
yield self.ingress
|
||||||
yield self.patrol_start
|
yield self.patrol_start
|
||||||
yield self.patrol_end
|
yield self.patrol_end
|
||||||
yield from self.nav_from
|
yield from self.nav_from
|
||||||
@ -154,13 +155,13 @@ class Builder(IBuilder[CasFlightPlan, CasLayout]):
|
|||||||
nav_to=builder.nav_path(
|
nav_to=builder.nav_path(
|
||||||
self.flight.departure.position,
|
self.flight.departure.position,
|
||||||
ingress_point,
|
ingress_point,
|
||||||
patrol_altitude,
|
ingress_egress_altitude,
|
||||||
use_agl_patrol_altitude,
|
use_agl_patrol_altitude,
|
||||||
),
|
),
|
||||||
nav_from=builder.nav_path(
|
nav_from=builder.nav_path(
|
||||||
patrol_end,
|
egress,
|
||||||
self.flight.arrival.position,
|
self.flight.arrival.position,
|
||||||
patrol_altitude,
|
ingress_egress_altitude,
|
||||||
use_agl_patrol_altitude,
|
use_agl_patrol_altitude,
|
||||||
),
|
),
|
||||||
ingress=ingress,
|
ingress=ingress,
|
||||||
|
|||||||
@ -10,7 +10,7 @@ from game.ato.flightplans.waypointbuilder import WaypointBuilder
|
|||||||
from game.flightplan import JoinZoneGeometry
|
from game.flightplan import JoinZoneGeometry
|
||||||
from game.flightplan.ipsolver import IpSolver
|
from game.flightplan.ipsolver import IpSolver
|
||||||
from game.flightplan.refuelzonegeometry import RefuelZoneGeometry
|
from game.flightplan.refuelzonegeometry import RefuelZoneGeometry
|
||||||
from game.persistency import debug_dir
|
from game.persistency import waypoint_debug_directory
|
||||||
from game.utils import dcs_to_shapely_point
|
from game.utils import dcs_to_shapely_point
|
||||||
from game.utils import nautical_miles
|
from game.utils import nautical_miles
|
||||||
|
|
||||||
@ -33,8 +33,6 @@ class PackageWaypoints:
|
|||||||
) -> PackageWaypoints:
|
) -> PackageWaypoints:
|
||||||
origin = package.departure_closest_to_target()
|
origin = package.departure_closest_to_target()
|
||||||
|
|
||||||
waypoint_debug_directory = debug_dir() / "Waypoints"
|
|
||||||
|
|
||||||
# Start by picking the best IP for the attack.
|
# Start by picking the best IP for the attack.
|
||||||
ip_solver = IpSolver(
|
ip_solver = IpSolver(
|
||||||
dcs_to_shapely_point(origin.position),
|
dcs_to_shapely_point(origin.position),
|
||||||
@ -43,7 +41,7 @@ class PackageWaypoints:
|
|||||||
coalition.opponent.threat_zone.all,
|
coalition.opponent.threat_zone.all,
|
||||||
)
|
)
|
||||||
ip_solver.set_debug_properties(
|
ip_solver.set_debug_properties(
|
||||||
waypoint_debug_directory / "IP", coalition.game.theater.terrain
|
waypoint_debug_directory() / "IP", coalition.game.theater.terrain
|
||||||
)
|
)
|
||||||
ingress_point_shapely = ip_solver.solve()
|
ingress_point_shapely = ip_solver.solve()
|
||||||
if dump_debug_info:
|
if dump_debug_info:
|
||||||
|
|||||||
@ -97,6 +97,8 @@ class Migrator:
|
|||||||
layout = f.flight_plan.layout
|
layout = f.flight_plan.layout
|
||||||
try_set_attr(layout, "nav_to", [])
|
try_set_attr(layout, "nav_to", [])
|
||||||
try_set_attr(layout, "nav_from", [])
|
try_set_attr(layout, "nav_from", [])
|
||||||
|
if f.flight_type == FlightType.CAS:
|
||||||
|
try_set_attr(layout, "ingress", None)
|
||||||
|
|
||||||
def _update_flights(self) -> None:
|
def _update_flights(self) -> None:
|
||||||
to_remove = []
|
to_remove = []
|
||||||
|
|||||||
@ -80,6 +80,10 @@ def debug_dir() -> Path:
|
|||||||
return base_path() / "Retribution" / "Debug"
|
return base_path() / "Retribution" / "Debug"
|
||||||
|
|
||||||
|
|
||||||
|
def waypoint_debug_directory() -> Path:
|
||||||
|
return debug_dir() / "Waypoints"
|
||||||
|
|
||||||
|
|
||||||
def settings_dir() -> Path:
|
def settings_dir() -> Path:
|
||||||
return base_path() / "Retribution" / "Settings"
|
return base_path() / "Retribution" / "Settings"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user