mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Migrate The Channel to YAML.
This commit is contained in:
parent
0afc4d2af6
commit
18f1048dc4
@ -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
|
from typing import Any, Dict, Tuple, Type
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from packaging.version import Version
|
from packaging.version import Version
|
||||||
@ -15,7 +15,6 @@ from game.profiling import logged_duration
|
|||||||
from game.theater import (
|
from game.theater import (
|
||||||
ConflictTheater,
|
ConflictTheater,
|
||||||
FalklandsTheater,
|
FalklandsTheater,
|
||||||
TheChannelTheater,
|
|
||||||
)
|
)
|
||||||
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
|
||||||
@ -110,8 +109,7 @@ class Campaign:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def load_theater(self, advanced_iads: bool) -> ConflictTheater:
|
def load_theater(self, advanced_iads: bool) -> ConflictTheater:
|
||||||
theaters = {
|
theaters: dict[str, Type[ConflictTheater]] = {
|
||||||
"The Channel": TheChannelTheater,
|
|
||||||
"Falklands": FalklandsTheater,
|
"Falklands": FalklandsTheater,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -2,14 +2,12 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import math
|
import math
|
||||||
from pathlib import Path
|
|
||||||
from typing import Iterator, List, Optional, TYPE_CHECKING, Tuple
|
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 (
|
from dcs.terrain import (
|
||||||
falklands,
|
falklands,
|
||||||
thechannel,
|
|
||||||
)
|
)
|
||||||
from dcs.terrain.terrain import Terrain
|
from dcs.terrain.terrain import Terrain
|
||||||
from shapely import geometry, ops
|
from shapely import geometry, ops
|
||||||
@ -17,7 +15,7 @@ from shapely import geometry, ops
|
|||||||
from .daytimemap import DaytimeMap
|
from .daytimemap import DaytimeMap
|
||||||
from .frontline import FrontLine
|
from .frontline import FrontLine
|
||||||
from .iadsnetwork.iadsnetwork import IadsNetwork
|
from .iadsnetwork.iadsnetwork import IadsNetwork
|
||||||
from .landmap import Landmap, load_landmap, poly_contains
|
from .landmap import Landmap, poly_contains
|
||||||
from .seasonalconditions import SeasonalConditions
|
from .seasonalconditions import SeasonalConditions
|
||||||
from ..utils import Heading
|
from ..utils import Heading
|
||||||
|
|
||||||
@ -241,27 +239,6 @@ class ConflictTheater:
|
|||||||
return Heading.from_degrees(position.heading_between_point(conflict_center))
|
return Heading.from_degrees(position.heading_between_point(conflict_center))
|
||||||
|
|
||||||
|
|
||||||
class TheChannelTheater(ConflictTheater):
|
|
||||||
terrain = thechannel.TheChannel()
|
|
||||||
landmap = load_landmap(Path("resources/channellandmap.p"))
|
|
||||||
daytime_map = DaytimeMap(
|
|
||||||
dawn=(datetime.time(hour=6), datetime.time(hour=8)),
|
|
||||||
day=(datetime.time(hour=10), datetime.time(hour=17)),
|
|
||||||
dusk=(datetime.time(hour=17), 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=2))
|
|
||||||
|
|
||||||
@property
|
|
||||||
def seasonal_conditions(self) -> SeasonalConditions:
|
|
||||||
from .seasonalconditions.thechannel import CONDITIONS
|
|
||||||
|
|
||||||
return CONDITIONS
|
|
||||||
|
|
||||||
|
|
||||||
class FalklandsTheater(ConflictTheater):
|
class FalklandsTheater(ConflictTheater):
|
||||||
terrain = falklands.Falklands()
|
terrain = falklands.Falklands()
|
||||||
|
|
||||||
|
|||||||
@ -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=20.0,
|
|
||||||
winter_avg_temperature=0.0,
|
|
||||||
temperature_day_night_difference=5.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,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
40
resources/theaters/the channel/info.yaml
Normal file
40
resources/theaters/the channel/info.yaml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
name: The Channel
|
||||||
|
pydcs_name: TheChannel
|
||||||
|
timezone: +2
|
||||||
|
daytime:
|
||||||
|
dawn: [6, 8]
|
||||||
|
day: [10, 17]
|
||||||
|
dusk: [17, 18]
|
||||||
|
night: [0, 5]
|
||||||
|
climate:
|
||||||
|
day_night_temperature_difference: 5.0
|
||||||
|
seasons:
|
||||||
|
winter:
|
||||||
|
average_pressure: 29.72 # TODO: Find real-world data
|
||||||
|
average_temperature: 0.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: 20.0
|
||||||
|
weather:
|
||||||
|
thunderstorm: 1
|
||||||
|
raining: 10
|
||||||
|
cloudy: 35
|
||||||
|
clear: 55
|
||||||
|
fall:
|
||||||
|
weather:
|
||||||
|
thunderstorm: 1
|
||||||
|
raining: 30
|
||||||
|
cloudy: 50
|
||||||
|
clear: 20
|
||||||
|
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 2.1 MiB |
Loading…
x
Reference in New Issue
Block a user