Skip to content

Commit

Permalink
Ramon Airbase hack (dcs-retribution#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
MetalStormGhost authored May 8, 2024
1 parent 0ab7dd2 commit 04e60fb
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
33 changes: 32 additions & 1 deletion game/missiongenerator/aircraft/flightgroupspawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
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,
Expand Down Expand Up @@ -131,6 +131,16 @@ def create_idle_aircraft(self) -> Optional[FlyingGroup[Any]]:
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,
Expand Down Expand Up @@ -214,6 +224,20 @@ def generate_flight_at_departure(self) -> FlyingGroup[Any]:
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:
Expand All @@ -236,6 +260,13 @@ def _check_nevatim_hack(self, cp: ControlPoint) -> bool:
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)
Expand Down
6 changes: 3 additions & 3 deletions game/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 04e60fb

Please sign in to comment.