Ramon Airbase hack (#309)

This commit is contained in:
MetalStormGhost 2024-05-08 22:52:12 +03:00 committed by GitHub
parent 0ab7dd2f15
commit 04e60fb08d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 36 additions and 4 deletions

View File

@ -10,6 +10,7 @@
* **[Campaign Setup]** Allow adjustments to naval TGOs (except carriers) on turn 0
* **[Campaign Design]** Ability to configure specific carrier names & types in campaign's yaml file
* **[Mission Generation]** Ability to inject custom kneeboards
* **[Options]** Extend option (so it can be disabled when fixed in DCS) to force air-starts (except for the slots that work) at Ramon Airbase, similar to the Nevatim fix in Retribution 1.3.0
## Fixes
* **[UI/UX]** A-10A flights can be edited again.

View File

@ -19,7 +19,7 @@ from dcs.planes import (
from dcs.point import PointAction
from dcs.ships import KUZNECOW
from dcs.terrain import NoParkingSlotError, Sinai, ParkingSlot
from dcs.terrain.sinai.airports import Nevatim
from dcs.terrain.sinai.airports import Nevatim, Ramon_Airbase
from dcs.unitgroup import (
FlyingGroup,
ShipGroup,
@ -131,6 +131,16 @@ class FlightGroupSpawner:
for slot in cp.dcs_airport.free_parking_slots(ac_type)
if slot.slot_name in [str(n) for n in range(55, 66)]
]
elif self._check_ramon_airbase_hack(cp):
ac_type = self.flight.unit_type.dcs_unit_type
slots = [
slot
for slot in cp.dcs_airport.free_parking_slots(ac_type)
if slot.slot_name
not in [
str(n) for n in [1, 2, 3, 4, 5, 6, 13, 14, 15, 16, 17, 18, 61]
]
]
group = self._generate_at_airfield(
name=namegen.next_aircraft_name(self.country, self.flight),
airfield=cp,
@ -214,6 +224,20 @@ class FlightGroupSpawner:
if slot.slot_name in [str(n) for n in range(55, 66)]
]
return self._generate_at_airfield(name, cp, slots)
elif self._check_ramon_airbase_hack(cp):
# TODO: get rid of the ramon airbase hack once fixed in DCS...
slots = [
slot
for slot in cp.dcs_airport.free_parking_slots(
self.flight.squadron.aircraft.dcs_unit_type
)
if slot.slot_name
not in [
str(n)
for n in [1, 2, 3, 4, 5, 6, 13, 14, 15, 16, 17, 18, 61]
]
]
return self._generate_at_airfield(name, cp, slots)
else:
return self._generate_at_airfield(name, cp)
else:
@ -236,6 +260,13 @@ class FlightGroupSpawner:
nevatim_hack &= isinstance(cp.dcs_airport, Nevatim)
return nevatim_hack
def _check_ramon_airbase_hack(self, cp: ControlPoint) -> bool:
# TODO: get rid of the ramon airbase hack once fixed in DCS...
ramon_airbase_hack = self.flight.coalition.game.settings.nevatim_parking_fix
ramon_airbase_hack &= isinstance(self.mission.terrain, Sinai)
ramon_airbase_hack &= isinstance(cp.dcs_airport, Ramon_Airbase)
return ramon_airbase_hack
def generate_mid_mission(self) -> FlyingGroup[Any]:
assert isinstance(self.flight.state, InFlight)
name = namegen.next_aircraft_name(self.country, self.flight)

View File

@ -740,13 +740,13 @@ class Settings:
),
)
nevatim_parking_fix: bool = boolean_option(
"Force air-starts for all aircraft at Nevatim",
"Force air-starts for aircraft at Nevatim and Ramon Airbase inoperable parking slots",
page=MISSION_GENERATOR_PAGE,
section=GAMEPLAY_SECTION,
default=True, # TODO: set to False or remove this when DCS is fixed
detail=(
"Air-starts forced for all aircraft at Nevatim except parking slots "
"55 till 65, since those are the only ones that work."
"Air-starts forced for all aircraft at Nevatim and Ramon Airbase except parking slots "
"which are known to work as of DCS World 2.9.4.53990."
),
)
# Mission specific