mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Refactor Templates to Layouts, Review and Cleanup
- Fix tgogenerator - Fix UI for ForceGroup and Layouts - Fix ammo depot handling - Split bigger files in smaller meaningful files (TGO, layouts, forces) - Renamed Template to Layout - Renamed GroundGroup to TheaterGroup and GroundUnit to TheaterUnit - Reorganize Layouts and UnitGroups to a ArmedForces class and ForceGroup similar to the AirWing and Squadron - Reworded the UnitClass, GroupRole, GroupTask (adopted to PEP8) and reworked the connection from Role and Task - added comments - added missing unit classes - added temp workaround for missing classes - add repariable property to TheaterUnit - Review and Cleanup Added serialization for loaded templates Loading the templates from the .miz files takes a lot of computation time and in the future there will be more templates added to the system. Therefore a local pickle serialization for the loaded templates was re-added: - The pickle will be created the first time the TemplateLoader will be accessed - Pickle is stored in Liberation SaveDir - Added UI option to (re-)import templates
This commit is contained in:
@@ -44,11 +44,11 @@ from game.theater import (
|
||||
NavalControlPoint,
|
||||
SamGroundObject,
|
||||
TheaterGroundObject,
|
||||
TheaterUnit,
|
||||
)
|
||||
from game.theater.theatergroundobject import (
|
||||
EwrGroundObject,
|
||||
NavalGroundObject,
|
||||
GroundUnit,
|
||||
)
|
||||
from game.typeguard import self_type_guard
|
||||
from game.utils import Distance, Heading, Speed, feet, knots, meters, nautical_miles
|
||||
@@ -1086,7 +1086,7 @@ class FlightPlanBuilder:
|
||||
self,
|
||||
flight: Flight,
|
||||
# TODO: Custom targets should be an attribute of the flight.
|
||||
custom_targets: Optional[List[GroundUnit]] = None,
|
||||
custom_targets: Optional[List[TheaterUnit]] = None,
|
||||
) -> None:
|
||||
"""Creates a default flight plan for the given mission."""
|
||||
if flight not in self.package.flights:
|
||||
@@ -1106,7 +1106,7 @@ class FlightPlanBuilder:
|
||||
) from ex
|
||||
|
||||
def generate_flight_plan(
|
||||
self, flight: Flight, custom_targets: Optional[List[GroundUnit]]
|
||||
self, flight: Flight, custom_targets: Optional[List[TheaterUnit]]
|
||||
) -> FlightPlan:
|
||||
# TODO: Flesh out mission types.
|
||||
task = flight.flight_type
|
||||
@@ -1209,7 +1209,7 @@ class FlightPlanBuilder:
|
||||
targets: List[StrikeTarget] = []
|
||||
|
||||
for j, u in enumerate(location.strike_targets):
|
||||
targets.append(StrikeTarget(f"{u.type} #{j}", u))
|
||||
targets.append(StrikeTarget(f"{u.type.id} #{j}", u))
|
||||
|
||||
return self.strike_flightplan(
|
||||
flight, location, FlightWaypointType.INGRESS_STRIKE, targets
|
||||
@@ -1668,7 +1668,7 @@ class FlightPlanBuilder:
|
||||
)
|
||||
|
||||
def generate_dead(
|
||||
self, flight: Flight, custom_targets: Optional[List[GroundUnit]]
|
||||
self, flight: Flight, custom_targets: Optional[List[TheaterUnit]]
|
||||
) -> StrikeFlightPlan:
|
||||
"""Generate a DEAD flight at a given location.
|
||||
|
||||
@@ -1738,7 +1738,7 @@ class FlightPlanBuilder:
|
||||
)
|
||||
|
||||
def generate_sead(
|
||||
self, flight: Flight, custom_targets: Optional[List[GroundUnit]]
|
||||
self, flight: Flight, custom_targets: Optional[List[TheaterUnit]]
|
||||
) -> StrikeFlightPlan:
|
||||
"""Generate a SEAD flight at a given location.
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ from game.theater import (
|
||||
MissionTarget,
|
||||
OffMapSpawn,
|
||||
TheaterGroundObject,
|
||||
TheaterUnit,
|
||||
)
|
||||
from game.utils import Distance, meters, nautical_miles
|
||||
from game.ato.flightwaypointtype import FlightWaypointType
|
||||
@@ -28,13 +29,13 @@ if TYPE_CHECKING:
|
||||
from game.ato.flight import Flight
|
||||
from game.coalition import Coalition
|
||||
from game.transfers import MultiGroupTransport
|
||||
from game.theater.theatergroundobject import GroundUnit, GroundGroup
|
||||
from game.theater.theatergroup import TheaterGroup
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class StrikeTarget:
|
||||
name: str
|
||||
target: Union[TheaterGroundObject, GroundGroup, GroundUnit, MultiGroupTransport]
|
||||
target: Union[TheaterGroundObject, TheaterGroup, TheaterUnit, MultiGroupTransport]
|
||||
|
||||
|
||||
class WaypointBuilder:
|
||||
|
||||
Reference in New Issue
Block a user