weather min cloud base; minor updates

This commit is contained in:
Vasyl Horbachenko 2018-06-21 04:39:37 +03:00
parent 73cf5c635f
commit 1a491bb814
4 changed files with 21 additions and 3 deletions

View File

@ -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:

View File

@ -3,3 +3,4 @@ class Settings:
player_skill = "Good"
enemy_skill = "Average"
only_player_takeoff = False
night_disabled = False

View File

@ -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)

View File

@ -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