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.
|
* **[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 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.
|
* **[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
|
## Fixes
|
||||||
* **[New Game Wizard]** Settings would not persist when going back to a previous page (obsolete due to overhaul).
|
* **[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:
|
def unit_type(self) -> AircraftType:
|
||||||
return self.squadron.aircraft
|
return self.squadron.aircraft
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_lha(self) -> bool:
|
||||||
|
return self.unit_type.lha_capable
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_helo(self) -> bool:
|
def is_helo(self) -> bool:
|
||||||
return self.unit_type.dcs_unit_type.helicopter
|
return self.unit_type.helicopter
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_hercules(self) -> bool:
|
def is_hercules(self) -> bool:
|
||||||
|
|||||||
@ -29,6 +29,7 @@ from game.settings import Settings
|
|||||||
from game.theater.controlpoint import (
|
from game.theater.controlpoint import (
|
||||||
Airfield,
|
Airfield,
|
||||||
ControlPoint,
|
ControlPoint,
|
||||||
|
Fob,
|
||||||
)
|
)
|
||||||
from game.unitmap import UnitMap
|
from game.unitmap import UnitMap
|
||||||
from .aircraftpainter import AircraftPainter
|
from .aircraftpainter import AircraftPainter
|
||||||
@ -156,10 +157,11 @@ class AircraftGenerator:
|
|||||||
self, player_country: Country, enemy_country: Country
|
self, player_country: Country, enemy_country: Country
|
||||||
) -> None:
|
) -> None:
|
||||||
for control_point in self.game.theater.controlpoints:
|
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
|
continue
|
||||||
|
|
||||||
faction = self.game.coalition_for(control_point.captured).faction
|
|
||||||
if control_point.captured:
|
if control_point.captured:
|
||||||
country = player_country
|
country = player_country
|
||||||
else:
|
else:
|
||||||
@ -173,7 +175,9 @@ class AircraftGenerator:
|
|||||||
break
|
break
|
||||||
|
|
||||||
def _spawn_unused_for(self, squadron: Squadron, country: Country) -> None:
|
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):
|
for _ in range(squadron.untasked_aircraft):
|
||||||
# Creating a flight even those this isn't a fragged mission lets us
|
# Creating a flight even those this isn't a fragged mission lets us
|
||||||
# reuse the existing debriefing code.
|
# reuse the existing debriefing code.
|
||||||
@ -198,8 +202,9 @@ class AircraftGenerator:
|
|||||||
self.ground_spawns,
|
self.ground_spawns,
|
||||||
self.mission_data,
|
self.mission_data,
|
||||||
).create_idle_aircraft()
|
).create_idle_aircraft()
|
||||||
AircraftPainter(flight, group).apply_livery()
|
if group:
|
||||||
self.unit_map.add_aircraft(group, flight)
|
AircraftPainter(flight, group).apply_livery()
|
||||||
|
self.unit_map.add_aircraft(group, flight)
|
||||||
|
|
||||||
def create_and_configure_flight(
|
def create_and_configure_flight(
|
||||||
self, flight: Flight, country: Country, dynamic_runways: Dict[str, RunwayData]
|
self, flight: Flight, country: Country, dynamic_runways: Dict[str, RunwayData]
|
||||||
|
|||||||
@ -10,7 +10,13 @@ from dcs.planes import F_14A, Su_33
|
|||||||
from dcs.point import PointAction
|
from dcs.point import PointAction
|
||||||
from dcs.ships import KUZNECOW
|
from dcs.ships import KUZNECOW
|
||||||
from dcs.terrain import NoParkingSlotError
|
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 import Flight
|
||||||
from game.ato.flightstate import InFlight
|
from game.ato.flightstate import InFlight
|
||||||
@ -91,15 +97,24 @@ class FlightGroupSpawner:
|
|||||||
self.flight.group_id = grp.id
|
self.flight.group_id = grp.id
|
||||||
return grp
|
return grp
|
||||||
|
|
||||||
def create_idle_aircraft(self) -> FlyingGroup[Any]:
|
def create_idle_aircraft(self) -> Optional[FlyingGroup[Any]]:
|
||||||
assert isinstance(self.flight.squadron.location, Airfield)
|
group = None
|
||||||
airfield = self.flight.squadron.location
|
if (
|
||||||
group = self._generate_at_airfield(
|
self.flight.is_helo
|
||||||
name=namegen.next_aircraft_name(self.country, self.flight),
|
or self.flight.is_lha
|
||||||
airfield=airfield,
|
and isinstance(self.flight.squadron.location, Fob)
|
||||||
)
|
):
|
||||||
|
group = self._generate_at_cp_helipad(
|
||||||
group.uncontrolled = True
|
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=self.flight.squadron.location,
|
||||||
|
)
|
||||||
|
if group:
|
||||||
|
group.uncontrolled = True
|
||||||
return group
|
return group
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -330,6 +345,10 @@ class FlightGroupSpawner:
|
|||||||
if isinstance(cp, Airfield):
|
if isinstance(cp, Airfield):
|
||||||
return self._generate_at_airfield(name, cp)
|
return self._generate_at_airfield(name, cp)
|
||||||
else:
|
else:
|
||||||
|
if isinstance(group, HelicopterGroup):
|
||||||
|
self.country.helicopter_group.remove(group)
|
||||||
|
elif isinstance(group, PlaneGroup):
|
||||||
|
self.country.plane_group.remove(group)
|
||||||
return None
|
return None
|
||||||
return group
|
return group
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user