Randomize mission temperature and pressure.

This commit is contained in:
Magnus Wolffelt
2021-07-15 22:34:09 +02:00
committed by GitHub
parent 56b17dfbcf
commit d25befabdd
3 changed files with 71 additions and 5 deletions

View File

@@ -2,7 +2,7 @@ from typing import Optional
from dcs.mission import Mission
from game.weather import Clouds, Fog, Conditions, WindConditions
from game.weather import Clouds, Fog, Conditions, WindConditions, AtmosphericConditions
class EnvironmentGenerator:
@@ -10,6 +10,11 @@ class EnvironmentGenerator:
self.mission = mission
self.conditions = conditions
def set_atmospheric(self, atmospheric: AtmosphericConditions) -> None:
inch_to_mm = 25.400002776728
self.mission.weather.qnh = atmospheric.qnh_inches_mercury * inch_to_mm
self.mission.weather.season_temperature = atmospheric.temperature_celsius
def set_clouds(self, clouds: Optional[Clouds]) -> None:
if clouds is None:
return
@@ -32,6 +37,7 @@ class EnvironmentGenerator:
def generate(self) -> None:
self.mission.start_time = self.conditions.start_time
self.set_atmospheric(self.conditions.weather.atmospheric)
self.set_clouds(self.conditions.weather.clouds)
self.set_fog(self.conditions.weather.fog)
self.set_wind(self.conditions.weather.wind)