Migrate Falklands to YAML.

All theaters are now moddable.
This commit is contained in:
Dan Albert 2022-09-07 16:39:47 -07:00 committed by Raffson
parent ac0f24f94f
commit c43d84bdae
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
6 changed files with 44 additions and 77 deletions

View File

@ -5,7 +5,7 @@ import logging
from collections.abc import Iterator
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Dict, Tuple, Type
from typing import Any, Dict, Tuple
import yaml
from packaging.version import Version
@ -14,7 +14,6 @@ from game import persistency
from game.profiling import logged_duration
from game.theater import (
ConflictTheater,
FalklandsTheater,
)
from game.theater.iadsnetwork.iadsnetwork import IadsNetwork
from game.theater.theaterloader import TheaterLoader
@ -109,14 +108,7 @@ class Campaign:
)
def load_theater(self, advanced_iads: bool) -> ConflictTheater:
theaters: dict[str, Type[ConflictTheater]] = {
"Falklands": FalklandsTheater,
}
try:
theater = theaters[self.data["theater"]]
t = theater()
except KeyError:
t = TheaterLoader(self.data["theater"].lower()).load()
t = TheaterLoader(self.data["theater"].lower()).load()
try:
miz = self.data["miz"]

View File

@ -6,9 +6,6 @@ from typing import Iterator, List, Optional, TYPE_CHECKING, Tuple
from uuid import UUID
from dcs.mapping import Point
from dcs.terrain import (
falklands,
)
from dcs.terrain.terrain import Terrain
from shapely import geometry, ops
@ -237,30 +234,3 @@ class ConflictTheater:
)
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

View File

@ -1 +0,0 @@
from .seasonalconditions import *

View File

@ -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,
),
},
)

View 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