From 8f4094ee9874ade6918ea668ecc8de1ccf6c48ce Mon Sep 17 00:00:00 2001 From: Vasyl Horbachenko Date: Mon, 22 Oct 2018 02:13:38 +0300 Subject: [PATCH] number of fixes --- game/operation/strike.py | 2 ++ gen/armor.py | 10 ++++++---- gen/environmentgen.py | 4 ++-- gen/groundobjectsgen.py | 3 +++ gen/triggergen.py | 5 ++++- theater/caucasus.py | 1 - ui/eventresultsmenu.py | 2 ++ 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/game/operation/strike.py b/game/operation/strike.py index b368ed8a..9c158f13 100644 --- a/game/operation/strike.py +++ b/game/operation/strike.py @@ -8,6 +8,8 @@ class StrikeOperation(Operation): escort = None # type: db.AssignedUnitsDict interceptors = None # type: db.AssignedUnitsDict + trigger_radius = TRIGGER_RADIUS_ALL_MAP + def setup(self, strikegroup: db.AssignedUnitsDict, escort: db.AssignedUnitsDict, diff --git a/gen/armor.py b/gen/armor.py index 35fb049c..de547111 100644 --- a/gen/armor.py +++ b/gen/armor.py @@ -20,6 +20,8 @@ FRONTLINE_CAS_FIGHTS_COUNT = 4, 8 FRONTLINE_CAS_GROUP_MIN = 1, 2 FRONTLINE_CAS_PADDING = 12000 +FIGHT_DISTANCE = 1500 + class ArmorConflictGenerator: def __init__(self, mission: Mission, conflict: Conflict): @@ -56,8 +58,8 @@ class ArmorConflictGenerator: def _generate_fight_at(self, attackers: db.ArmorDict, defenders: db.ArmorDict, position: Point): if attackers: - attack_pos = position.point_from_heading(self.conflict.heading - 90, 8000) - attack_dest = position.point_from_heading(self.conflict.heading + 90, 25000) + attack_pos = position.point_from_heading(self.conflict.heading - 90, FIGHT_DISTANCE) + attack_dest = position.point_from_heading(self.conflict.heading + 90, FIGHT_DISTANCE * 2) for type, count in attackers.items(): self._generate_group( side=self.conflict.attackers_side, @@ -68,8 +70,8 @@ class ArmorConflictGenerator: ) if defenders: - def_pos = position.point_from_heading(self.conflict.heading + 90, 4000) - def_dest = position.point_from_heading(self.conflict.heading - 90, 25000) + def_pos = position.point_from_heading(self.conflict.heading + 90, FIGHT_DISTANCE) + def_dest = position.point_from_heading(self.conflict.heading - 90, FIGHT_DISTANCE * 2) for type, count in defenders.items(): self._generate_group( side=self.conflict.defenders_side, diff --git a/gen/environmentgen.py b/gen/environmentgen.py index abfc0cf0..fb0600ef 100644 --- a/gen/environmentgen.py +++ b/gen/environmentgen.py @@ -127,9 +127,9 @@ class EnviromentGenerator: # sometimes clouds are randomized way too low and need to be fixed self.mission.weather.clouds_base = max(self.mission.weather.clouds_base, WEATHER_CLOUD_BASE_MIN) - if self.mission.weather.wind_at_ground == 0: + if self.mission.weather.wind_at_ground.speed == 0: # frontline smokes look silly w/o any wind - self.mission.weather.wind_at_ground = random.randint(1, 2) + self._generate_wind(1) def generate(self) -> EnvironmentSettings: self._gen_random_time() diff --git a/gen/groundobjectsgen.py b/gen/groundobjectsgen.py index b21a3116..dfb27b7f 100644 --- a/gen/groundobjectsgen.py +++ b/gen/groundobjectsgen.py @@ -28,6 +28,9 @@ class GroundObjectsGenerator: heading -= 90 position = self.conflict.find_ground_position(center.point_from_heading(heading, FARP_FRONTLINE_DISTANCE), heading) + if not position: + return + for i, _ in enumerate(range(0, number_of_units, self.FARP_CAPACITY)): position = position.point_from_heading(0, i * 275) diff --git a/gen/triggergen.py b/gen/triggergen.py index d01b2fdb..d22b0fa1 100644 --- a/gen/triggergen.py +++ b/gen/triggergen.py @@ -28,6 +28,7 @@ TRIGGER_RADIUS_MINIMUM = 20000 TRIGGER_RADIUS_SMALL = 50000 TRIGGER_RADIUS_MEDIUM = 100000 TRIGGER_RADIUS_LARGE = 150000 +TRIGGER_RADIUS_ALL_MAP = 3000000 class Silence(Option): @@ -53,14 +54,16 @@ class TriggersGenerator: vehicle_group.late_activation = True activate_by_trigger.append(vehicle_group) + """ conflict_distance = player_cp.position.distance_to_point(self.conflict.position) minimum_radius = max(conflict_distance - TRIGGER_MIN_DISTANCE_FROM_START, TRIGGER_RADIUS_MINIMUM) if minimum_radius < 0: minimum_radius = 0 result_radius = min(minimum_radius, radius) + """ - activation_trigger_zone = self.mission.triggers.add_triggerzone(self.conflict.position, result_radius, name="Activation zone") + activation_trigger_zone = self.mission.triggers.add_triggerzone(self.conflict.position, radius, name="Activation zone") activation_trigger = TriggerOnce(Event.NoEvent, "Activation trigger") activation_trigger.add_condition(PartOfCoalitionInZone(player_coalition, activation_trigger_zone.id)) activation_trigger.add_condition(FlagIsTrue()) diff --git a/theater/caucasus.py b/theater/caucasus.py index cf1b98d1..51922926 100644 --- a/theater/caucasus.py +++ b/theater/caucasus.py @@ -33,7 +33,6 @@ class CaucasusTheater(ConflictTheater): gelendzhik = ControlPoint.from_airport(caucasus.Gelendzhik, COAST_DR_E, SIZE_BIG, 1.1) maykop = ControlPoint.from_airport(caucasus.Maykop_Khanskaya, LAND, SIZE_LARGE, IMPORTANCE_HIGH) krasnodar = ControlPoint.from_airport(caucasus.Krasnodar_Center, LAND, SIZE_LARGE, IMPORTANCE_HIGH) - novorossiysk = ControlPoint.from_airport(caucasus.Novorossiysk, COAST_DR_E, SIZE_BIG, 1.2) krymsk = ControlPoint.from_airport(caucasus.Krymsk, LAND, SIZE_LARGE, 1.2) anapa = ControlPoint.from_airport(caucasus.Anapa_Vityazevo, LAND, SIZE_LARGE, IMPORTANCE_HIGH) diff --git a/ui/eventresultsmenu.py b/ui/eventresultsmenu.py index 2424f9f5..68c25c21 100644 --- a/ui/eventresultsmenu.py +++ b/ui/eventresultsmenu.py @@ -54,6 +54,7 @@ class EventResultsMenu(Menu): pg.start(10) row += 1 + """ Label(self.frame, text="Cheat operation results: ", **STYLES["strong"]).grid(column=0, row=row, columnspan=2, sticky=NSEW, pady=5) @@ -69,6 +70,7 @@ class EventResultsMenu(Menu): Button(self.frame, text="some player losses", command=self.simulate_result(0.8, 0), **STYLES["btn-warning"]).grid(column=1, row=row, padx=5, pady=5) row += 1 + """ else: row = 0