fixed naval intercept crash; fixed wrong targets order; fixed initial waypoint being WP #1; m2k a2g ccip; fixed time being time zone offset ahead; lowered rain weather chance

This commit is contained in:
Vasyl Horbachenko 2018-10-13 04:41:18 +03:00
parent 4fc766a524
commit 397f9a58cb
9 changed files with 21 additions and 16 deletions

View File

@ -371,7 +371,7 @@ PLANE_PAYLOAD_OVERRIDES = {
M_2000C: {
CAP: "Combat Air Patrol",
GroundAttack: "MK-82 Heavy Strike",
GroundAttack: "MK-82S Heavy Strike",
},
MiG_21Bis: {

View File

@ -50,7 +50,7 @@ class NavalInterceptionOperation(Operation):
self.briefinggen.title = "Naval Intercept"
if self.game.player == self.attacker_name:
self.briefinggen.description = "Destroy supply transport ships. Lowers target strength. Be advised that your flight will not attack anything until you explicitly tell them so by comms menu."
for unit_type, count in self.targets:
for unit_type, count in self.targets.items():
self.briefinggen.append_target("{} ({})".format(db.unit_type_name(unit_type), count))
else:
self.briefinggen.description = "Protect supply transport ships."

View File

@ -46,7 +46,7 @@ class StrikeOperation(Operation):
if global_cp == self.from_cp and not self.is_quick:
self.attackers_starting_position = ship
targets = [] # type: typing.List[typing.Tuple[str, Point]]
targets = [] # type: typing.List[typing.Tuple[str, str, Point]]
category_counters = {} # type: typing.Dict[str, int]
processed_groups = []
for object in self.to_cp.ground_objects:
@ -56,16 +56,16 @@ class StrikeOperation(Operation):
processed_groups.append(object.group_identifier)
category_counters[object.category] = category_counters.get(object.category, 0) + 1
markpoint_name = "{}{}".format(object.name_abbrev, category_counters[object.category])
targets.append((markpoint_name, object.position))
targets.append((str(object), markpoint_name, object.position))
targets.sort(key=lambda x: self.from_cp.position.distance_to_point(x[1]))
targets.sort(key=lambda x: self.from_cp.position.distance_to_point(x[2]))
for (name, markpoint_name) in targets:
for (name, markpoint_name, _) in targets:
self.briefinggen.append_waypoint("TARGET {} (TP {})".format(str(name), markpoint_name))
planes_flights = {k: v for k, v in self.strikegroup.items() if k in plane_map.values()}
self.airgen.generate_ground_attack_strikegroup(*assigned_units_split(planes_flights),
targets=targets,
targets=[(mp, pos) for (n, mp, pos) in targets],
at=self.attackers_starting_position)
heli_flights = {k: v for k, v in self.strikegroup.items() if k in helicopters.helicopter_map.values()}
@ -74,7 +74,7 @@ class StrikeOperation(Operation):
for farp, dict in zip(self.groundobjectgen.generate_farps(sum([x[0] for x in heli_flights.values()])),
db.assignedunits_split_to_count(heli_flights, self.groundobjectgen.FARP_CAPACITY)):
self.airgen.generate_ground_attack_strikegroup(*assigned_units_split(dict),
targets=targets,
targets=[(mp, pos) for (n, mp, pos) in targets],
at=farp,
escort=len(planes_flights) == 0)

View File

@ -58,6 +58,6 @@ class BriefingGenerator:
if self.waypoints:
description += "\n\nWAYPOINTS:"
for i, descr in enumerate(self.waypoints):
description += "\n#{}: {}".format(i+1, descr)
description += "\n#{}: {}".format(i, descr)
self.m.set_description_text(description)

View File

@ -166,7 +166,7 @@ class Conflict:
if ground_position:
return ground_position, _opposite_heading(attack_heading)
else:
print("Coudn't find frontline position between {} and {}!".format(from_cp, to_cp))
logging.warning("Coudn't find frontline position between {} and {}!".format(from_cp, to_cp))
return position, _opposite_heading(attack_heading)

View File

@ -30,9 +30,9 @@ RANDOM_TIME = {
RANDOM_WEATHER = {
1: 0, # heavy rain
2: 10, # rain
3: 20, # dynamic
4: 30, # clear
2: 5, # rain
3: 15, # dynamic
4: 40, # clear
5: 100, # random
}
@ -49,7 +49,8 @@ class EnviromentGenerator:
self.game = game
def _gen_random_time(self):
start_time = datetime.fromtimestamp(1527206400)
start_time = datetime.strptime('May 25 2018 12:00AM', '%b %d %Y %I:%M%p')
time_range = None
for k, v in RANDOM_TIME.items():
if self.game.settings.night_disabled and k == "night":
@ -60,6 +61,11 @@ class EnviromentGenerator:
break
start_time += timedelta(hours=random.randint(*time_range))
logging.info("time - {}, slot - {}, night skipped - {}".format(
str(start_time),
str(time_range),
self.game.settings.night_disabled))
self.mission.start_time = start_time
def _gen_random_weather(self):

Binary file not shown.

View File

@ -90,7 +90,6 @@ class OverviewCanvas:
if cp.captured and not connected_cp.captured and Conflict.has_frontline_between(cp, connected_cp):
frontline = Conflict.frontline_vector(cp, connected_cp, self.game.theater)
if not frontline:
print(cp, connected_cp)
continue
frontline_pos, heading, distance = frontline

View File

@ -163,7 +163,7 @@ class Debriefing:
self.destroyed_objects.append(str(group.name))
self._dead_units.remove(identifier)
print("debriefing: unsatistied ids: {}".format(self._dead_units))
logging.info("debriefing: unsatistied ids: {}".format(self._dead_units))
self.alive_units = {
player.name: {k: v - self.destroyed_units[player.name].get(k, 0) for k, v in player_units.items()},