From 109408587259a8e453ccb202400dc0bb6c7e850a Mon Sep 17 00:00:00 2001 From: bgreman <47828384+bgreman@users.noreply.github.com> Date: Thu, 22 Jul 2021 15:30:46 -0400 Subject: [PATCH] Fixes #1449 and updates another area where the Heading class can apply (#1451) --- game/weather.py | 10 +++++----- gen/groundobjectsgen.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/game/weather.py b/game/weather.py index 952335bd..2594ed91 100644 --- a/game/weather.py +++ b/game/weather.py @@ -12,7 +12,7 @@ from dcs.weather import CloudPreset, Weather as PydcsWeather, Wind from game.savecompat import has_save_compat_for from game.settings import Settings -from game.utils import Distance, meters, interpolate, Pressure, inches_hg +from game.utils import Distance, Heading, meters, interpolate, Pressure, inches_hg if TYPE_CHECKING: from game.theater import ConflictTheater @@ -149,7 +149,7 @@ class Weather: @staticmethod def random_wind(minimum: int, maximum: int) -> WindConditions: - wind_direction = random.randint(0, 360) + wind_direction = Heading.random() at_0m_factor = 1 at_2000m_factor = 2 at_8000m_factor = 3 @@ -157,9 +157,9 @@ class Weather: return WindConditions( # Always some wind to make the smoke move a bit. - at_0m=Wind(wind_direction, max(1, base_wind * at_0m_factor)), - at_2000m=Wind(wind_direction, base_wind * at_2000m_factor), - at_8000m=Wind(wind_direction, base_wind * at_8000m_factor), + at_0m=Wind(wind_direction.degrees, max(1, base_wind * at_0m_factor)), + at_2000m=Wind(wind_direction.degrees, base_wind * at_2000m_factor), + at_8000m=Wind(wind_direction.degrees, base_wind * at_8000m_factor), ) @staticmethod diff --git a/gen/groundobjectsgen.py b/gen/groundobjectsgen.py index 69d76998..4efcfb92 100644 --- a/gen/groundobjectsgen.py +++ b/gen/groundobjectsgen.py @@ -425,7 +425,7 @@ class GenericCarrierGenerator(GenericGroundObjectGenerator[GenericCarrierGroundO return ship def steam_into_wind(self, group: ShipGroup) -> Optional[Heading]: - wind = self.game.conditions.weather.wind.at_0m.direction + wind = self.game.conditions.weather.wind.at_0m brc = Heading.from_degrees(wind.direction).opposite # Aim for 25kts over the deck. carrier_speed = knots(25) - mps(wind.speed)