mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Spawn idle aircraft at helipads
Applicable for helicopters at airbases & both helicopters and LHA-capable aircraft at FOBs
This commit is contained in:
parent
737df98988
commit
e86fc60b41
@ -52,6 +52,7 @@
|
||||
* **[New Game Wizard]** Automatically invert factions when 'Invert Map' is selected.
|
||||
* **[Flight Plans]** Added "SEAD Sweep" flight plan, which basically reintroduces the legacy "SEAD Escort" flight plan where the flight will engage whatever it can find without actually escorting the primary flight.
|
||||
* **[Flight Plans]** Added SEAD capability to F-16A MLU and SEAD Escort & SEAD to F-16A.
|
||||
* **[Mission Generation]** Spawn unused helicopters or LHA-capable aircraft at helipads at FOBs
|
||||
|
||||
## Fixes
|
||||
* **[New Game Wizard]** Settings would not persist when going back to a previous page (obsolete due to overhaul).
|
||||
|
||||
@ -172,9 +172,13 @@ class Flight(SidcDescribable, RadioFrequencyContainer, TacanContainer):
|
||||
def unit_type(self) -> AircraftType:
|
||||
return self.squadron.aircraft
|
||||
|
||||
@property
|
||||
def is_lha(self) -> bool:
|
||||
return self.unit_type.lha_capable
|
||||
|
||||
@property
|
||||
def is_helo(self) -> bool:
|
||||
return self.unit_type.dcs_unit_type.helicopter
|
||||
return self.unit_type.helicopter
|
||||
|
||||
@property
|
||||
def is_hercules(self) -> bool:
|
||||
|
||||
@ -29,6 +29,7 @@ from game.settings import Settings
|
||||
from game.theater.controlpoint import (
|
||||
Airfield,
|
||||
ControlPoint,
|
||||
Fob,
|
||||
)
|
||||
from game.unitmap import UnitMap
|
||||
from .aircraftpainter import AircraftPainter
|
||||
@ -156,10 +157,11 @@ class AircraftGenerator:
|
||||
self, player_country: Country, enemy_country: Country
|
||||
) -> None:
|
||||
for control_point in self.game.theater.controlpoints:
|
||||
if not isinstance(control_point, Airfield):
|
||||
if not (
|
||||
isinstance(control_point, Airfield) or isinstance(control_point, Fob)
|
||||
):
|
||||
continue
|
||||
|
||||
faction = self.game.coalition_for(control_point.captured).faction
|
||||
if control_point.captured:
|
||||
country = player_country
|
||||
else:
|
||||
@ -173,7 +175,9 @@ class AircraftGenerator:
|
||||
break
|
||||
|
||||
def _spawn_unused_for(self, squadron: Squadron, country: Country) -> None:
|
||||
assert isinstance(squadron.location, Airfield)
|
||||
assert isinstance(squadron.location, Airfield) or isinstance(
|
||||
squadron.location, Fob
|
||||
)
|
||||
for _ in range(squadron.untasked_aircraft):
|
||||
# Creating a flight even those this isn't a fragged mission lets us
|
||||
# reuse the existing debriefing code.
|
||||
@ -198,6 +202,7 @@ class AircraftGenerator:
|
||||
self.ground_spawns,
|
||||
self.mission_data,
|
||||
).create_idle_aircraft()
|
||||
if group:
|
||||
AircraftPainter(flight, group).apply_livery()
|
||||
self.unit_map.add_aircraft(group, flight)
|
||||
|
||||
|
||||
@ -10,7 +10,13 @@ from dcs.planes import F_14A, Su_33
|
||||
from dcs.point import PointAction
|
||||
from dcs.ships import KUZNECOW
|
||||
from dcs.terrain import NoParkingSlotError
|
||||
from dcs.unitgroup import FlyingGroup, ShipGroup, StaticGroup
|
||||
from dcs.unitgroup import (
|
||||
FlyingGroup,
|
||||
ShipGroup,
|
||||
StaticGroup,
|
||||
HelicopterGroup,
|
||||
PlaneGroup,
|
||||
)
|
||||
|
||||
from game.ato import Flight
|
||||
from game.ato.flightstate import InFlight
|
||||
@ -91,14 +97,23 @@ class FlightGroupSpawner:
|
||||
self.flight.group_id = grp.id
|
||||
return grp
|
||||
|
||||
def create_idle_aircraft(self) -> FlyingGroup[Any]:
|
||||
assert isinstance(self.flight.squadron.location, Airfield)
|
||||
airfield = self.flight.squadron.location
|
||||
def create_idle_aircraft(self) -> Optional[FlyingGroup[Any]]:
|
||||
group = None
|
||||
if (
|
||||
self.flight.is_helo
|
||||
or self.flight.is_lha
|
||||
and isinstance(self.flight.squadron.location, Fob)
|
||||
):
|
||||
group = self._generate_at_cp_helipad(
|
||||
name=namegen.next_aircraft_name(self.country, self.flight),
|
||||
cp=self.flight.squadron.location,
|
||||
)
|
||||
elif isinstance(self.flight.squadron.location, Airfield):
|
||||
group = self._generate_at_airfield(
|
||||
name=namegen.next_aircraft_name(self.country, self.flight),
|
||||
airfield=airfield,
|
||||
airfield=self.flight.squadron.location,
|
||||
)
|
||||
|
||||
if group:
|
||||
group.uncontrolled = True
|
||||
return group
|
||||
|
||||
@ -330,6 +345,10 @@ class FlightGroupSpawner:
|
||||
if isinstance(cp, Airfield):
|
||||
return self._generate_at_airfield(name, cp)
|
||||
else:
|
||||
if isinstance(group, HelicopterGroup):
|
||||
self.country.helicopter_group.remove(group)
|
||||
elif isinstance(group, PlaneGroup):
|
||||
self.country.plane_group.remove(group)
|
||||
return None
|
||||
return group
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user