mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix helicopters at airfields breaking generation.
Helipads at airfields don't work well right now because they are not counted as additional parking, but we should still allow them to take off from the airfield parking. Follow up work would be to fix the parking problem and allow adding helipads to airfields, or maybe to just "ground" start helicopters at airfields so they take off from parking rather than the runway. May fix https://github.com/dcs-liberation/dcs_liberation/issues/1890
This commit is contained in:
parent
f95795d547
commit
2499276b2a
@ -5,7 +5,7 @@ from typing import Any, Union
|
|||||||
from dcs import Mission, Point
|
from dcs import Mission, Point
|
||||||
from dcs.country import Country
|
from dcs.country import Country
|
||||||
from dcs.mission import StartType as DcsStartType
|
from dcs.mission import StartType as DcsStartType
|
||||||
from dcs.planes import Su_33, F_14A
|
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 Airport, NoParkingSlotError
|
from dcs.terrain import Airport, NoParkingSlotError
|
||||||
@ -14,7 +14,7 @@ from dcs.unitgroup import FlyingGroup, ShipGroup, StaticGroup
|
|||||||
from game.ato import Flight
|
from game.ato import Flight
|
||||||
from game.ato.flightstate import InFlight
|
from game.ato.flightstate import InFlight
|
||||||
from game.ato.starttype import StartType
|
from game.ato.starttype import StartType
|
||||||
from game.theater import Airfield, ControlPoint, NavalControlPoint, OffMapSpawn
|
from game.theater import Airfield, ControlPoint, Fob, NavalControlPoint, OffMapSpawn
|
||||||
from game.utils import meters
|
from game.utils import meters
|
||||||
from gen.flights.traveltime import GroundSpeed
|
from gen.flights.traveltime import GroundSpeed
|
||||||
from gen.naming import namegen
|
from gen.naming import namegen
|
||||||
@ -101,17 +101,18 @@ class FlightGroupSpawner:
|
|||||||
f"{carrier_group.__class__.__name__}, expected a ShipGroup"
|
f"{carrier_group.__class__.__name__}, expected a ShipGroup"
|
||||||
)
|
)
|
||||||
return self._generate_at_group(name, carrier_group)
|
return self._generate_at_group(name, carrier_group)
|
||||||
else:
|
elif isinstance(cp, Fob):
|
||||||
# If the flight is an helicopter flight, then prioritize dedicated
|
if not self.flight.unit_type.helicopter:
|
||||||
# helipads
|
|
||||||
if self.flight.unit_type.helicopter:
|
|
||||||
return self._generate_at_cp_helipad(name, cp)
|
|
||||||
|
|
||||||
if not isinstance(cp, Airfield):
|
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
f"Attempted to spawn at airfield for non-airfield {cp}"
|
f"Cannot spawn fixed-wing aircraft at {cp} because it is a FOB"
|
||||||
)
|
)
|
||||||
|
return self._generate_at_cp_helipad(name, cp)
|
||||||
|
elif isinstance(cp, Airfield):
|
||||||
return self._generate_at_airport(name, cp.airport)
|
return self._generate_at_airport(name, cp.airport)
|
||||||
|
else:
|
||||||
|
raise NotImplementedError(
|
||||||
|
f"Aircraft spawn behavior not implemented for {cp} ({cp.__class__})"
|
||||||
|
)
|
||||||
except NoParkingSlotError:
|
except NoParkingSlotError:
|
||||||
# Generated when there is no place on Runway or on Parking Slots
|
# Generated when there is no place on Runway or on Parking Slots
|
||||||
logging.warning(
|
logging.warning(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user