mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Reload terrain and airports in migrator
This commit is contained in:
parent
86e4f45152
commit
c262bb3681
@ -5,13 +5,14 @@ from datetime import timedelta
|
|||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from dcs.countries import countries_by_name
|
from dcs.countries import countries_by_name
|
||||||
|
from dcs.terrain import Airport, Terrain
|
||||||
|
|
||||||
from game.ato import FlightType
|
from game.ato import FlightType
|
||||||
from game.ato.flightplans.formation import FormationLayout
|
from game.ato.flightplans.formation import FormationLayout
|
||||||
from game.ato.flightplans.waypointbuilder import WaypointBuilder
|
from game.ato.flightplans.waypointbuilder import WaypointBuilder
|
||||||
from game.ato.packagewaypoints import PackageWaypoints
|
from game.ato.packagewaypoints import PackageWaypoints
|
||||||
from game.data.doctrine import MODERN_DOCTRINE, COLDWAR_DOCTRINE, WWII_DOCTRINE
|
from game.data.doctrine import MODERN_DOCTRINE, COLDWAR_DOCTRINE, WWII_DOCTRINE
|
||||||
from game.theater import ParkingType, SeasonalConditions
|
from game.theater import ParkingType, SeasonalConditions, Airfield
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from game import Game
|
from game import Game
|
||||||
@ -40,6 +41,7 @@ class Migrator:
|
|||||||
self._release_untasked_flights()
|
self._release_untasked_flights()
|
||||||
self._update_weather()
|
self._update_weather()
|
||||||
self._update_tgos()
|
self._update_tgos()
|
||||||
|
self._reload_terrain()
|
||||||
|
|
||||||
def _update_doctrine(self) -> None:
|
def _update_doctrine(self) -> None:
|
||||||
doctrines = [
|
doctrines = [
|
||||||
@ -104,6 +106,8 @@ class Migrator:
|
|||||||
faulty_beacon = [x for x in beacons if x.id == "airfield20_0"]
|
faulty_beacon = [x for x in beacons if x.id == "airfield20_0"]
|
||||||
if faulty_beacon:
|
if faulty_beacon:
|
||||||
beacons.remove([x for x in beacons if x.id == "airfield20_0"][0])
|
beacons.remove([x for x in beacons if x.id == "airfield20_0"][0])
|
||||||
|
if isinstance(cp, Airfield) and issubclass(cp.airport.__class__, Airport):
|
||||||
|
cp.airport = cp.airport.__class__(self.game.theater.terrain) # type: ignore
|
||||||
|
|
||||||
def _update_flight_plan(self, f: Flight) -> None:
|
def _update_flight_plan(self, f: Flight) -> None:
|
||||||
layout = f.flight_plan.layout
|
layout = f.flight_plan.layout
|
||||||
@ -239,3 +243,8 @@ class Migrator:
|
|||||||
for go in self.game.theater.ground_objects:
|
for go in self.game.theater.ground_objects:
|
||||||
try_set_attr(go, "task", None)
|
try_set_attr(go, "task", None)
|
||||||
try_set_attr(go, "hide_on_mfd", False)
|
try_set_attr(go, "hide_on_mfd", False)
|
||||||
|
|
||||||
|
def _reload_terrain(self) -> None:
|
||||||
|
t = self.game.theater.terrain
|
||||||
|
if issubclass(t.__class__, Terrain):
|
||||||
|
self.game.theater.terrain = type(t)() # type: ignore
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user