Port Persian Gulf to yaml.

This commit is contained in:
Dan Albert
2022-09-07 16:07:39 -07:00
committed by Raffson
parent 401a0ae557
commit f3f067830f
6 changed files with 41 additions and 62 deletions

View File

@@ -18,7 +18,6 @@ from game.theater import (
MarianaIslandsTheater,
NevadaTheater,
NormandyTheater,
PersianGulfTheater,
SyriaTheater,
TheChannelTheater,
)
@@ -117,7 +116,6 @@ class Campaign:
def load_theater(self, advanced_iads: bool) -> ConflictTheater:
theaters = {
"Nevada": NevadaTheater,
"Persian Gulf": PersianGulfTheater,
"Normandy": NormandyTheater,
"The Channel": TheChannelTheater,
"Syria": SyriaTheater,

View File

@@ -12,7 +12,6 @@ from dcs.terrain import (
marianaislands,
nevada,
normandy,
persiangulf,
syria,
thechannel,
)
@@ -246,27 +245,6 @@ class ConflictTheater:
return Heading.from_degrees(position.heading_between_point(conflict_center))
class PersianGulfTheater(ConflictTheater):
terrain = persiangulf.PersianGulf()
landmap = load_landmap(Path("resources/gulflandmap.p"))
daytime_map = DaytimeMap(
dawn=(datetime.time(hour=6), datetime.time(hour=8)),
day=(datetime.time(hour=8), datetime.time(hour=16)),
dusk=(datetime.time(hour=16), datetime.time(hour=18)),
night=(datetime.time(hour=0), datetime.time(hour=5)),
)
@property
def timezone(self) -> datetime.timezone:
return datetime.timezone(datetime.timedelta(hours=4))
@property
def seasonal_conditions(self) -> SeasonalConditions:
from .seasonalconditions.persiangulf import CONDITIONS
return CONDITIONS
class NevadaTheater(ConflictTheater):
terrain = nevada.Nevada()
landmap = load_landmap(Path("resources/nevlandmap.p"))

View File

@@ -1,37 +0,0 @@
from .seasonalconditions import SeasonalConditions, Season, WeatherTypeChances
CONDITIONS = SeasonalConditions(
summer_avg_pressure=29.98, # TODO: Find real-world data
winter_avg_pressure=29.80, # TODO: Find real-world data
summer_avg_temperature=32.5,
winter_avg_temperature=15.0,
temperature_day_night_difference=2.0,
weather_type_chances={
# TODO: Find real-world data for all these values
Season.Winter: WeatherTypeChances(
# Winter there is some rain in PG (Dubai)
thunderstorm=1,
raining=15,
cloudy=40,
clear_skies=45,
),
Season.Spring: WeatherTypeChances(
thunderstorm=1,
raining=2,
cloudy=28,
clear_skies=70,
),
Season.Summer: WeatherTypeChances(
thunderstorm=1,
raining=1,
cloudy=18,
clear_skies=80,
),
Season.Fall: WeatherTypeChances(
thunderstorm=1,
raining=2,
cloudy=28,
clear_skies=70,
),
},
)

View File

@@ -66,7 +66,7 @@ class TheaterLoader:
with self.descriptor_path.open() as descriptor_file:
data = yaml.safe_load(descriptor_file)
return YamlTheater(
TERRAINS_BY_NAME[data["name"]],
TERRAINS_BY_NAME[data.get("pydcs_name", data["name"])],
load_landmap(self.descriptor_path.with_name("landmap.p")),
datetime.timezone(datetime.timedelta(hours=data["timezone"])),
self._load_seasonal_conditions(data["climate"]),