Merge branch 'develop' into helipads

# Conflicts:
#	game/data/weapons.py
#	game/db.py
#	game/theater/conflicttheater.py
#	resources/factions/france_1995.json
#	resources/factions/insurgents.json
#	resources/factions/iraq_1991.json
#	resources/factions/syria_1967_with_ww2_weapons.json
#	resources/factions/syria_2011.json
This commit is contained in:
Khopa
2021-05-21 13:58:22 +02:00
55 changed files with 345 additions and 132 deletions

View File

@@ -132,7 +132,6 @@ CAP_CAPABLE = [
MiG_29A,
F_16C_50,
FA_18C_hornet,
F_15E,
F_16A,
F_4E,
JF_17,
@@ -140,6 +139,7 @@ CAP_CAPABLE = [
MiG_21Bis,
Mirage_2000_5,
M_2000C,
F_15E,
F_5E_3,
MiG_19P,
A_4E_C,

View File

@@ -79,6 +79,7 @@ class FlightWaypointType(Enum):
INGRESS_OCA_AIRCRAFT = 25
PICKUP = 26
DROP_OFF = 27
BULLSEYE = 28
class FlightWaypoint:

View File

@@ -426,6 +426,7 @@ class BarCapFlightPlan(PatrollingFlightPlan):
takeoff: FlightWaypoint
land: FlightWaypoint
divert: Optional[FlightWaypoint]
bullseye: FlightWaypoint
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
yield self.takeoff
@@ -438,6 +439,7 @@ class BarCapFlightPlan(PatrollingFlightPlan):
yield self.land
if self.divert is not None:
yield self.divert
yield self.bullseye
@dataclass(frozen=True)
@@ -446,6 +448,7 @@ class CasFlightPlan(PatrollingFlightPlan):
target: FlightWaypoint
land: FlightWaypoint
divert: Optional[FlightWaypoint]
bullseye: FlightWaypoint
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
yield self.takeoff
@@ -459,6 +462,7 @@ class CasFlightPlan(PatrollingFlightPlan):
yield self.land
if self.divert is not None:
yield self.divert
yield self.bullseye
def request_escort_at(self) -> Optional[FlightWaypoint]:
return self.patrol_start
@@ -472,6 +476,7 @@ class TarCapFlightPlan(PatrollingFlightPlan):
takeoff: FlightWaypoint
land: FlightWaypoint
divert: Optional[FlightWaypoint]
bullseye: FlightWaypoint
lead_time: timedelta
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
@@ -485,6 +490,7 @@ class TarCapFlightPlan(PatrollingFlightPlan):
yield self.land
if self.divert is not None:
yield self.divert
yield self.bullseye
@property
def tot_offset(self) -> timedelta:
@@ -523,6 +529,7 @@ class StrikeFlightPlan(FormationFlightPlan):
nav_from: List[FlightWaypoint]
land: FlightWaypoint
divert: Optional[FlightWaypoint]
bullseye: FlightWaypoint
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
yield self.takeoff
@@ -537,6 +544,7 @@ class StrikeFlightPlan(FormationFlightPlan):
yield self.land
if self.divert is not None:
yield self.divert
yield self.bullseye
@property
def package_speed_waypoints(self) -> Set[FlightWaypoint]:
@@ -641,6 +649,7 @@ class SweepFlightPlan(LoiterFlightPlan):
nav_from: List[FlightWaypoint]
land: FlightWaypoint
divert: Optional[FlightWaypoint]
bullseye: FlightWaypoint
lead_time: timedelta
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
@@ -653,6 +662,7 @@ class SweepFlightPlan(LoiterFlightPlan):
yield self.land
if self.divert is not None:
yield self.divert
yield self.bullseye
@property
def tot_waypoint(self) -> Optional[FlightWaypoint]:
@@ -704,6 +714,7 @@ class AwacsFlightPlan(LoiterFlightPlan):
nav_from: List[FlightWaypoint]
land: FlightWaypoint
divert: Optional[FlightWaypoint]
bullseye: FlightWaypoint
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
yield self.takeoff
@@ -713,6 +724,7 @@ class AwacsFlightPlan(LoiterFlightPlan):
yield self.land
if self.divert is not None:
yield self.divert
yield self.bullseye
@property
def mission_start_time(self) -> Optional[timedelta]:
@@ -746,6 +758,7 @@ class AirliftFlightPlan(FlightPlan):
nav_to_home: List[FlightWaypoint]
land: FlightWaypoint
divert: Optional[FlightWaypoint]
bullseye: FlightWaypoint
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
yield self.takeoff
@@ -758,6 +771,7 @@ class AirliftFlightPlan(FlightPlan):
yield self.land
if self.divert is not None:
yield self.divert
yield self.bullseye
@property
def tot_waypoint(self) -> Optional[FlightWaypoint]:
@@ -1053,6 +1067,7 @@ class FlightPlanBuilder:
),
land=builder.land(flight.arrival),
divert=builder.divert(flight.divert),
bullseye=builder.bullseye(),
hold=start,
hold_duration=timedelta(hours=4),
)
@@ -1151,6 +1166,7 @@ class FlightPlanBuilder:
patrol_end=end,
land=builder.land(flight.arrival),
divert=builder.divert(flight.divert),
bullseye=builder.bullseye(),
)
def generate_sweep(self, flight: Flight) -> SweepFlightPlan:
@@ -1187,6 +1203,7 @@ class FlightPlanBuilder:
sweep_end=end,
land=builder.land(flight.arrival),
divert=builder.divert(flight.divert),
bullseye=builder.bullseye(),
)
def generate_transport(self, flight: Flight) -> AirliftFlightPlan:
@@ -1238,6 +1255,7 @@ class FlightPlanBuilder:
),
land=builder.land(flight.arrival),
divert=builder.divert(flight.divert),
bullseye=builder.bullseye(),
)
def racetrack_for_objective(
@@ -1389,6 +1407,7 @@ class FlightPlanBuilder:
patrol_end=end,
land=builder.land(flight.arrival),
divert=builder.divert(flight.divert),
bullseye=builder.bullseye(),
)
def generate_dead(
@@ -1517,6 +1536,7 @@ class FlightPlanBuilder:
),
land=builder.land(flight.arrival),
divert=builder.divert(flight.divert),
bullseye=builder.bullseye(),
)
def generate_cas(self, flight: Flight) -> CasFlightPlan:
@@ -1562,6 +1582,7 @@ class FlightPlanBuilder:
patrol_end=builder.egress(egress, location),
land=builder.land(flight.arrival),
divert=builder.divert(flight.divert),
bullseye=builder.bullseye(),
)
@staticmethod
@@ -1696,6 +1717,7 @@ class FlightPlanBuilder:
),
land=builder.land(flight.arrival),
divert=builder.divert(flight.divert),
bullseye=builder.bullseye(),
)
def _retreating_rendezvous_point(self, attack_transition: Point) -> Point:

View File

@@ -35,6 +35,9 @@ class Loadout:
new_pylons = dict(self.pylons)
for pylon_number, weapon in self.pylons.items():
if weapon is None:
del new_pylons[pylon_number]
continue
if not weapon.available_on(date):
pylon = Pylon.for_aircraft(unit_type, pylon_number)
for fallback in weapon.fallbacks:
@@ -44,6 +47,8 @@ class Loadout:
continue
new_pylons[pylon_number] = fallback
break
else:
del new_pylons[pylon_number]
return Loadout(f"{self.name} ({date.year})", new_pylons, date)
@classmethod

View File

@@ -50,6 +50,7 @@ class WaypointBuilder:
self.threat_zones = game.threat_zone_for(not player)
self.navmesh = game.navmesh_for(player)
self.targets = targets
self._bullseye = game.bullseye_for(player)
@property
def is_helo(self) -> bool:
@@ -145,6 +146,19 @@ class WaypointBuilder:
waypoint.only_for_player = True
return waypoint
def bullseye(self) -> FlightWaypoint:
waypoint = FlightWaypoint(
FlightWaypointType.BULLSEYE,
self._bullseye.position.x,
self._bullseye.position.y,
meters(0),
)
waypoint.pretty_name = "Bullseye"
waypoint.description = "Bullseye"
waypoint.name = "BULLSEYE"
waypoint.only_for_player = True
return waypoint
def hold(self, position: Point) -> FlightWaypoint:
waypoint = FlightWaypoint(
FlightWaypointType.LOITER,