From a4145154afcf2db14fe9ccc4e689888327e8a6b0 Mon Sep 17 00:00:00 2001 From: Vasyl Horbachenko Date: Thu, 14 Jun 2018 19:24:13 +0300 Subject: [PATCH] updated weather generation - now including rain --- .idea/dcs_pmcliberation.iml | 2 +- .idea/misc.xml | 2 +- gen/envsettingsgen.py | 24 +++++++++++++++++++++++- ui/overviewcanvas.py | 2 +- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.idea/dcs_pmcliberation.iml b/.idea/dcs_pmcliberation.iml index 9eedabcf..1f377c84 100644 --- a/.idea/dcs_pmcliberation.iml +++ b/.idea/dcs_pmcliberation.iml @@ -4,7 +4,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index e524f659..65531ca9 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/gen/envsettingsgen.py b/gen/envsettingsgen.py index 53bef2d9..9987f91a 100644 --- a/gen/envsettingsgen.py +++ b/gen/envsettingsgen.py @@ -14,6 +14,12 @@ RANDOM_TIME = { "day": 100, } +RANDOM_WEATHER = { + 0: 0, # thunderstorm + 1: 5, # heavy rain + 2: 15, # rain + 3: 35, # random dynamic +} class EnvironmentSettingsGenerator: def __init__(self, mission: Mission, game): @@ -29,7 +35,23 @@ class EnvironmentSettingsGenerator: break self.mission.random_daytime(time_period) - self.mission.weather.random(self.mission.start_time, self.mission.terrain) + + weather_roll = random.randint(0, 100) + weather_type = None + for k, v in RANDOM_TIME.items(): + if v >= weather_roll: + weather_type = k + break + + if weather_type == 0: + self.mission.weather.random_thunderstorm() + elif weather_type == 1: + self.mission.weather.heavy_rain() + elif weather_type == 2: + self.mission.weather.heavy_rain() + self.mission.weather.enable_fog = False + elif weather_type == 3: + self.mission.weather.random(self.mission.start_time, self.mission.terrain) for cp in self.game.theater.controlpoints: if cp.is_global: diff --git a/ui/overviewcanvas.py b/ui/overviewcanvas.py index 2aa12ebb..d8a5d131 100644 --- a/ui/overviewcanvas.py +++ b/ui/overviewcanvas.py @@ -68,7 +68,7 @@ class OverviewCanvas: for cp in self.game.theater.controlpoints: coords = self.cp_coordinates(cp) - arc_size = 28 * math.pow(cp.importance, 1) + arc_size = 22 * math.pow(cp.importance, 1) extent = max(cp.base.strength * 180, 10) start = (180 - extent) / 2 color = cp.captured and 'blue' or 'red'