mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Migrate Falklands to YAML.
All theaters are now moddable.
This commit is contained in:
parent
18f1048dc4
commit
49001bb558
@ -5,7 +5,7 @@ import logging
|
|||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, Tuple, Type
|
from typing import Any, Dict, Tuple
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from packaging.version import Version
|
from packaging.version import Version
|
||||||
@ -14,7 +14,6 @@ from game import persistency
|
|||||||
from game.profiling import logged_duration
|
from game.profiling import logged_duration
|
||||||
from game.theater import (
|
from game.theater import (
|
||||||
ConflictTheater,
|
ConflictTheater,
|
||||||
FalklandsTheater,
|
|
||||||
)
|
)
|
||||||
from game.theater.iadsnetwork.iadsnetwork import IadsNetwork
|
from game.theater.iadsnetwork.iadsnetwork import IadsNetwork
|
||||||
from game.theater.theaterloader import TheaterLoader
|
from game.theater.theaterloader import TheaterLoader
|
||||||
@ -109,14 +108,7 @@ class Campaign:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def load_theater(self, advanced_iads: bool) -> ConflictTheater:
|
def load_theater(self, advanced_iads: bool) -> ConflictTheater:
|
||||||
theaters: dict[str, Type[ConflictTheater]] = {
|
t = TheaterLoader(self.data["theater"].lower()).load()
|
||||||
"Falklands": FalklandsTheater,
|
|
||||||
}
|
|
||||||
try:
|
|
||||||
theater = theaters[self.data["theater"]]
|
|
||||||
t = theater()
|
|
||||||
except KeyError:
|
|
||||||
t = TheaterLoader(self.data["theater"].lower()).load()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
miz = self.data["miz"]
|
miz = self.data["miz"]
|
||||||
|
|||||||
@ -6,9 +6,6 @@ from typing import Iterator, List, Optional, TYPE_CHECKING, Tuple
|
|||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from dcs.mapping import Point
|
from dcs.mapping import Point
|
||||||
from dcs.terrain import (
|
|
||||||
falklands,
|
|
||||||
)
|
|
||||||
from dcs.terrain.terrain import Terrain
|
from dcs.terrain.terrain import Terrain
|
||||||
from shapely import geometry, ops
|
from shapely import geometry, ops
|
||||||
|
|
||||||
@ -237,30 +234,3 @@ class ConflictTheater:
|
|||||||
)
|
)
|
||||||
|
|
||||||
return Heading.from_degrees(position.heading_between_point(conflict_center))
|
return Heading.from_degrees(position.heading_between_point(conflict_center))
|
||||||
|
|
||||||
|
|
||||||
class FalklandsTheater(ConflictTheater):
|
|
||||||
terrain = falklands.Falklands()
|
|
||||||
|
|
||||||
# TODO: https://github.com/dcs-liberation/dcs_liberation/issues/2242
|
|
||||||
landmap = None
|
|
||||||
|
|
||||||
# TODO: https://github.com/dcs-liberation/dcs_liberation/issues/2242
|
|
||||||
daytime_map = DaytimeMap(
|
|
||||||
dawn=(datetime.time(hour=6), datetime.time(hour=9)),
|
|
||||||
day=(datetime.time(hour=9), datetime.time(hour=18)),
|
|
||||||
dusk=(datetime.time(hour=18), datetime.time(hour=20)),
|
|
||||||
night=(datetime.time(hour=0), datetime.time(hour=5)),
|
|
||||||
)
|
|
||||||
|
|
||||||
# TODO: https://github.com/dcs-liberation/dcs_liberation/issues/2242
|
|
||||||
@property
|
|
||||||
def timezone(self) -> datetime.timezone:
|
|
||||||
return datetime.timezone(datetime.timedelta(hours=4))
|
|
||||||
|
|
||||||
# TODO: https://github.com/dcs-liberation/dcs_liberation/issues/2242
|
|
||||||
@property
|
|
||||||
def seasonal_conditions(self) -> SeasonalConditions:
|
|
||||||
from .seasonalconditions.caucasus import CONDITIONS
|
|
||||||
|
|
||||||
return CONDITIONS
|
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
from .seasonalconditions import *
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
from .seasonalconditions import SeasonalConditions, Season, WeatherTypeChances
|
|
||||||
|
|
||||||
CONDITIONS = SeasonalConditions(
|
|
||||||
summer_avg_pressure=30.02, # TODO: Find real-world data
|
|
||||||
winter_avg_pressure=29.72, # TODO: Find real-world data
|
|
||||||
summer_avg_temperature=22.5,
|
|
||||||
winter_avg_temperature=3.0,
|
|
||||||
temperature_day_night_difference=6.0,
|
|
||||||
weather_type_chances={
|
|
||||||
# TODO: Find real-world data for all these values
|
|
||||||
Season.Winter: WeatherTypeChances(
|
|
||||||
thunderstorm=1,
|
|
||||||
raining=20,
|
|
||||||
cloudy=60,
|
|
||||||
clear_skies=20,
|
|
||||||
),
|
|
||||||
Season.Spring: WeatherTypeChances(
|
|
||||||
thunderstorm=1,
|
|
||||||
raining=20,
|
|
||||||
cloudy=40,
|
|
||||||
clear_skies=40,
|
|
||||||
),
|
|
||||||
Season.Summer: WeatherTypeChances(
|
|
||||||
thunderstorm=1,
|
|
||||||
raining=10,
|
|
||||||
cloudy=35,
|
|
||||||
clear_skies=55,
|
|
||||||
),
|
|
||||||
Season.Fall: WeatherTypeChances(
|
|
||||||
thunderstorm=1,
|
|
||||||
raining=30,
|
|
||||||
cloudy=50,
|
|
||||||
clear_skies=20,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
42
resources/theaters/falklands/info.yaml
Normal file
42
resources/theaters/falklands/info.yaml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
name: Falklands
|
||||||
|
# TODO: https://github.com/dcs-liberation/dcs_liberation/issues/2242
|
||||||
|
timezone: +4
|
||||||
|
# TODO: https://github.com/dcs-liberation/dcs_liberation/issues/2242
|
||||||
|
daytime:
|
||||||
|
dawn: [6, 9]
|
||||||
|
day: [9, 18]
|
||||||
|
dusk: [18, 20]
|
||||||
|
night: [0, 5]
|
||||||
|
# TODO: https://github.com/dcs-liberation/dcs_liberation/issues/2242
|
||||||
|
climate:
|
||||||
|
day_night_temperature_difference: 6.0
|
||||||
|
seasons:
|
||||||
|
winter:
|
||||||
|
average_pressure: 29.72 # TODO: Find real-world data
|
||||||
|
average_temperature: 3.0
|
||||||
|
weather:
|
||||||
|
thunderstorm: 1
|
||||||
|
raining: 20
|
||||||
|
cloudy: 60
|
||||||
|
clear: 20
|
||||||
|
spring:
|
||||||
|
weather:
|
||||||
|
thunderstorm: 1
|
||||||
|
raining: 20
|
||||||
|
cloudy: 40
|
||||||
|
clear: 40
|
||||||
|
summer:
|
||||||
|
average_pressure: 30.02 # TODO: Find real-world data
|
||||||
|
average_temperature: 22.5
|
||||||
|
weather:
|
||||||
|
thunderstorm: 1
|
||||||
|
raining: 10
|
||||||
|
cloudy: 35
|
||||||
|
clear: 55
|
||||||
|
fall:
|
||||||
|
weather:
|
||||||
|
thunderstorm: 1
|
||||||
|
raining: 30
|
||||||
|
cloudy: 50
|
||||||
|
clear: 20
|
||||||
Loading…
x
Reference in New Issue
Block a user