From 1a491bb8149f31641c8e1fc9860b0fe36a6b8d71 Mon Sep 17 00:00:00 2001 From: Vasyl Horbachenko Date: Thu, 21 Jun 2018 04:39:37 +0300 Subject: [PATCH] weather min cloud base; minor updates --- game/event/intercept.py | 4 +++- game/settings.py | 1 + gen/settingsgen.py | 10 ++++++++++ ui/configurationmenu.py | 9 +++++++-- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/game/event/intercept.py b/game/event/intercept.py index ea95757c..3758832b 100644 --- a/game/event/intercept.py +++ b/game/event/intercept.py @@ -6,6 +6,7 @@ from dcs.vehicles import * from game import db from game.operation.intercept import InterceptOperation +from theater.conflicttheater import * from userdata.debriefing import Debriefing from .event import Event @@ -38,7 +39,8 @@ class InterceptEvent(Event): if self.attacker_name == self.game.player: if self.is_successfull(debriefing): - self.to_cp.base.affect_strength(-self.STRENGTH_INFLUENCE) + for _, cp in self.game.theater.conflicts(True): + cp.base.affect_strength(-self.STRENGTH_INFLUENCE) else: self.from_cp.base.affect_strength(-self.STRENGTH_INFLUENCE) else: diff --git a/game/settings.py b/game/settings.py index 1b969ef0..35109dcc 100644 --- a/game/settings.py +++ b/game/settings.py @@ -3,3 +3,4 @@ class Settings: player_skill = "Good" enemy_skill = "Average" only_player_takeoff = False + night_disabled = False diff --git a/gen/settingsgen.py b/gen/settingsgen.py index e5daaeaa..06951fd5 100644 --- a/gen/settingsgen.py +++ b/gen/settingsgen.py @@ -22,6 +22,8 @@ PUSH_TRIGGER_SIZE = 3000 REGROUP_ZONE_DISTANCE = 12000 REGROUP_ALT = 5000 +CLOUDS_BASE_MIN = 4000 + RANDOM_TIME = { "night": 5, "dusk": 30, @@ -46,6 +48,9 @@ class SettingsGenerator: start_time = datetime.combine(datetime.today(), time()) time_range = None for k, v in RANDOM_TIME.items(): + if self.game.settings.night_disabled and k == "night": + continue + if random.randint(0, 100) <= v: time_range = self.game.theater.daytime_map[k] break @@ -71,6 +76,9 @@ class SettingsGenerator: elif weather_type == 3: pass + if self.mission.weather.clouds_density > 0: + self.mission.weather.clouds_base = max(self.mission.weather.clouds_base, CLOUDS_BASE_MIN) + def _gen_activation_trigger(self, player_coalition: str, enemy_coalition: str): activate_by_trigger = [] for coalition_name, coalition in self.mission.coalition.items(): @@ -101,6 +109,8 @@ class SettingsGenerator: for country in coalition.countries.values(): if coalition_name == player_coalition: for plane_group in country.plane_group: + if plane_group.task == AWACS.name: + continue regroup_heading = self.conflict.to_cp.position.heading_between_point(self.conflict.from_cp.position) pos1 = plane_group.position.point_from_heading(regroup_heading, REGROUP_ZONE_DISTANCE) diff --git a/ui/configurationmenu.py b/ui/configurationmenu.py index c20e8f51..c52e8a59 100644 --- a/ui/configurationmenu.py +++ b/ui/configurationmenu.py @@ -17,10 +17,14 @@ class ConfigurationMenu(Menu): self.takeoff_var = BooleanVar() self.takeoff_var.set(self.game.settings.only_player_takeoff) + self.night_var = BooleanVar() + self.night_var.set(self.game.settings.night_disabled) + def dismiss(self): self.game.settings.player_skill = self.player_skill_var.get() self.game.settings.enemy_skill = self.enemy_skill_var.get() self.game.settings.only_player_takeoff = self.takeoff_var.get() + self.game.settings.night_disabled = self.night_var.get() super(ConfigurationMenu, self).dismiss() def display(self): @@ -33,9 +37,10 @@ class ConfigurationMenu(Menu): OptionMenu(self.frame, self.enemy_skill_var, "Average", "Good", "High", "Excellent").grid(row=1, column=1) Checkbutton(self.frame, text="Takeoff only for player group", variable=self.takeoff_var).grid(row=2, column=0, columnspan=2) + Checkbutton(self.frame, text="Disable night missions", variable=self.night_var).grid(row=3, column=0, columnspan=2) - Button(self.frame, text="Back", command=self.dismiss).grid(row=3, column=0, columnspan=1) - Button(self.frame, text="Cheat +200m", command=self.cheat_money).grid(row=4, column=0) + Button(self.frame, text="Back", command=self.dismiss).grid(row=4, column=0, columnspan=1) + Button(self.frame, text="Cheat +200m", command=self.cheat_money).grid(row=5, column=0) def cheat_money(self): self.game.budget += 200