mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Port Persian Gulf to yaml.
This commit is contained in:
parent
401a0ae557
commit
f3f067830f
@ -18,7 +18,6 @@ from game.theater import (
|
|||||||
MarianaIslandsTheater,
|
MarianaIslandsTheater,
|
||||||
NevadaTheater,
|
NevadaTheater,
|
||||||
NormandyTheater,
|
NormandyTheater,
|
||||||
PersianGulfTheater,
|
|
||||||
SyriaTheater,
|
SyriaTheater,
|
||||||
TheChannelTheater,
|
TheChannelTheater,
|
||||||
)
|
)
|
||||||
@ -117,7 +116,6 @@ class Campaign:
|
|||||||
def load_theater(self, advanced_iads: bool) -> ConflictTheater:
|
def load_theater(self, advanced_iads: bool) -> ConflictTheater:
|
||||||
theaters = {
|
theaters = {
|
||||||
"Nevada": NevadaTheater,
|
"Nevada": NevadaTheater,
|
||||||
"Persian Gulf": PersianGulfTheater,
|
|
||||||
"Normandy": NormandyTheater,
|
"Normandy": NormandyTheater,
|
||||||
"The Channel": TheChannelTheater,
|
"The Channel": TheChannelTheater,
|
||||||
"Syria": SyriaTheater,
|
"Syria": SyriaTheater,
|
||||||
|
|||||||
@ -12,7 +12,6 @@ from dcs.terrain import (
|
|||||||
marianaislands,
|
marianaislands,
|
||||||
nevada,
|
nevada,
|
||||||
normandy,
|
normandy,
|
||||||
persiangulf,
|
|
||||||
syria,
|
syria,
|
||||||
thechannel,
|
thechannel,
|
||||||
)
|
)
|
||||||
@ -246,27 +245,6 @@ class ConflictTheater:
|
|||||||
return Heading.from_degrees(position.heading_between_point(conflict_center))
|
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):
|
class NevadaTheater(ConflictTheater):
|
||||||
terrain = nevada.Nevada()
|
terrain = nevada.Nevada()
|
||||||
landmap = load_landmap(Path("resources/nevlandmap.p"))
|
landmap = load_landmap(Path("resources/nevlandmap.p"))
|
||||||
|
|||||||
@ -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,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
@ -66,7 +66,7 @@ class TheaterLoader:
|
|||||||
with self.descriptor_path.open() as descriptor_file:
|
with self.descriptor_path.open() as descriptor_file:
|
||||||
data = yaml.safe_load(descriptor_file)
|
data = yaml.safe_load(descriptor_file)
|
||||||
return YamlTheater(
|
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")),
|
load_landmap(self.descriptor_path.with_name("landmap.p")),
|
||||||
datetime.timezone(datetime.timedelta(hours=data["timezone"])),
|
datetime.timezone(datetime.timedelta(hours=data["timezone"])),
|
||||||
self._load_seasonal_conditions(data["climate"]),
|
self._load_seasonal_conditions(data["climate"]),
|
||||||
|
|||||||
40
resources/theaters/persian gulf/info.yaml
Normal file
40
resources/theaters/persian gulf/info.yaml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
name: Persian Gulf
|
||||||
|
pydcs_name: PersianGulf
|
||||||
|
timezone: +4
|
||||||
|
daytime:
|
||||||
|
dawn: [6, 8]
|
||||||
|
day: [8, 16]
|
||||||
|
dusk: [16, 18]
|
||||||
|
night: [0, 5]
|
||||||
|
climate:
|
||||||
|
day_night_temperature_difference: 2.0
|
||||||
|
seasons:
|
||||||
|
winter:
|
||||||
|
average_pressure: 29.80 # TODO: Find real-world data
|
||||||
|
average_temperature: 15.0
|
||||||
|
weather:
|
||||||
|
thunderstorm: 1
|
||||||
|
raining: 15
|
||||||
|
cloudy: 40
|
||||||
|
clear: 45
|
||||||
|
spring:
|
||||||
|
weather:
|
||||||
|
thunderstorm: 1
|
||||||
|
raining: 2
|
||||||
|
cloudy: 28
|
||||||
|
clear: 70
|
||||||
|
summer:
|
||||||
|
average_pressure: 29.98 # TODO: Find real-world data
|
||||||
|
average_temperature: 32.5
|
||||||
|
weather:
|
||||||
|
thunderstorm: 1
|
||||||
|
raining: 1
|
||||||
|
cloudy: 18
|
||||||
|
clear: 80
|
||||||
|
fall:
|
||||||
|
weather:
|
||||||
|
thunderstorm: 1
|
||||||
|
raining: 2
|
||||||
|
cloudy: 28
|
||||||
|
clear: 70
|
||||||
Loading…
x
Reference in New Issue
Block a user