From 647529f35f37651739d1a2ae36456c7c845227f6 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Wed, 7 Sep 2022 16:11:38 -0700 Subject: [PATCH] Migrate Syria to yaml. --- game/campaignloader/campaign.py | 2 - game/theater/conflicttheater.py | 22 ---------- game/theater/seasonalconditions/syria.py | 36 ---------------- resources/theaters/syria/info.yaml | 39 ++++++++++++++++++ .../syria/landmap.p} | Bin 5 files changed, 39 insertions(+), 60 deletions(-) delete mode 100644 game/theater/seasonalconditions/syria.py create mode 100644 resources/theaters/syria/info.yaml rename resources/{syrialandmap.p => theaters/syria/landmap.p} (100%) diff --git a/game/campaignloader/campaign.py b/game/campaignloader/campaign.py index f72a4553..b5802cce 100644 --- a/game/campaignloader/campaign.py +++ b/game/campaignloader/campaign.py @@ -18,7 +18,6 @@ from game.theater import ( MarianaIslandsTheater, NevadaTheater, NormandyTheater, - SyriaTheater, TheChannelTheater, ) from game.theater.iadsnetwork.iadsnetwork import IadsNetwork @@ -118,7 +117,6 @@ class Campaign: "Nevada": NevadaTheater, "Normandy": NormandyTheater, "The Channel": TheChannelTheater, - "Syria": SyriaTheater, "MarianaIslands": MarianaIslandsTheater, "Falklands": FalklandsTheater, } diff --git a/game/theater/conflicttheater.py b/game/theater/conflicttheater.py index e6600331..8031cd1a 100644 --- a/game/theater/conflicttheater.py +++ b/game/theater/conflicttheater.py @@ -12,7 +12,6 @@ from dcs.terrain import ( marianaislands, nevada, normandy, - syria, thechannel, ) from dcs.terrain.terrain import Terrain @@ -308,27 +307,6 @@ class TheChannelTheater(ConflictTheater): return CONDITIONS -class SyriaTheater(ConflictTheater): - terrain = syria.Syria() - landmap = load_landmap(Path("resources/syrialandmap.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=3)) - - @property - def seasonal_conditions(self) -> SeasonalConditions: - from .seasonalconditions.syria import CONDITIONS - - return CONDITIONS - - class MarianaIslandsTheater(ConflictTheater): terrain = marianaislands.MarianaIslands() diff --git a/game/theater/seasonalconditions/syria.py b/game/theater/seasonalconditions/syria.py deleted file mode 100644 index d405abc8..00000000 --- a/game/theater/seasonalconditions/syria.py +++ /dev/null @@ -1,36 +0,0 @@ -from .seasonalconditions import SeasonalConditions, Season, WeatherTypeChances - -CONDITIONS = SeasonalConditions( - summer_avg_pressure=29.98, # TODO: Find real-world data - winter_avg_pressure=29.86, # TODO: Find real-world data - summer_avg_temperature=28.5, - winter_avg_temperature=10.0, - temperature_day_night_difference=8.0, - weather_type_chances={ - # TODO: Find real-world data for all these values - Season.Winter: WeatherTypeChances( - thunderstorm=1, - raining=25, - cloudy=35, - clear_skies=40, - ), - Season.Spring: WeatherTypeChances( - thunderstorm=1, - raining=10, - cloudy=30, - clear_skies=60, - ), - Season.Summer: WeatherTypeChances( - thunderstorm=1, - raining=5, - cloudy=30, - clear_skies=65, - ), - Season.Fall: WeatherTypeChances( - thunderstorm=1, - raining=15, - cloudy=35, - clear_skies=50, - ), - }, -) diff --git a/resources/theaters/syria/info.yaml b/resources/theaters/syria/info.yaml new file mode 100644 index 00000000..2b3eec9e --- /dev/null +++ b/resources/theaters/syria/info.yaml @@ -0,0 +1,39 @@ +--- +name: Syria +timezone: +3 +daytime: + dawn: [6, 8] + day: [8, 16] + dusk: [16, 18] + night: [0, 5] +climate: + day_night_temperature_difference: 8.0 + seasons: + winter: + average_pressure: 29.86 # TODO: Find real-world data + average_temperature: 10.0 + weather: + thunderstorm: 1 + raining: 25 + cloudy: 35 + clear: 40 + spring: + weather: + thunderstorm: 1 + raining: 10 + cloudy: 30 + clear: 60 + summer: + average_pressure: 29.98 # TODO: Find real-world data + average_temperature: 28.5 + weather: + thunderstorm: 1 + raining: 5 + cloudy: 30 + clear: 65 + fall: + weather: + thunderstorm: 1 + raining: 15 + cloudy: 35 + clear: 50 diff --git a/resources/syrialandmap.p b/resources/theaters/syria/landmap.p similarity index 100% rename from resources/syrialandmap.p rename to resources/theaters/syria/landmap.p