Compare commits

...

2 Commits

12 changed files with 29 additions and 23 deletions

View File

@@ -371,6 +371,7 @@ PLANE_PAYLOAD_OVERRIDES = {
M_2000C: {
CAP: "Combat Air Patrol",
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:
@@ -54,18 +54,18 @@ class StrikeOperation(Operation):
continue
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))
self.briefinggen.append_target(str(object))
self.briefinggen.append_waypoint("TARGET {} (TP {})".format(str(object), markpoint_name))
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:
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

@@ -9,11 +9,11 @@ from dcs.task import *
from dcs.terrain.terrain import NoParkingSlotError
TANKER_DISTANCE = 15000
TANKER_ALT = 10000
TANKER_ALT = 6000
TANKER_HEADING_OFFSET = 45
AWACS_DISTANCE = 150000
AWACS_ALT = 10000
AWACS_ALT = 15000
class AirSupportConflictGenerator:

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):
@@ -85,7 +91,7 @@ class EnviromentGenerator:
self.mission.weather.clouds_thickness = random.randint(*WEATHER_CLOUD_THICKNESS)
wind_direction = random.randint(0, 360)
wind_speed = random.randint(0, 13)
wind_speed = random.randint(0, 4)
self.mission.weather.wind_at_ground = Wind(wind_direction, wind_speed)
self.mission.weather.wind_at_2000 = Wind(wind_direction, wind_speed * 2)
self.mission.weather.wind_at_8000 = Wind(wind_direction, wind_speed * 3)

View File

@@ -24,7 +24,7 @@ class GroundObjectsGenerator:
center = self.conflict.center
heading = self.conflict.heading - 90
else:
center, heading = self.conflict.frontline_position(self.conflict.from_cp, self.conflict.to_cp)
center, heading = self.conflict.frontline_position(self.conflict.theater, self.conflict.from_cp, self.conflict.to_cp)
heading -= 90
position = self.conflict.find_ground_position(center.point_from_heading(heading, FARP_FRONTLINE_DISTANCE), heading)

View File

@@ -112,10 +112,10 @@ class TriggersGenerator:
for unit in group.units:
push_trigger.add_condition(UnitAltitudeHigherAGL(unit.id, PUSH_TRIGGER_ACTIVATION_AGL))
if group.units[0].is_human():
if not group.units[0].is_human():
push_trigger.add_action(AITaskPush(group.id, 1))
message_string = self.mission.string("Task force is in the air, proceed with the objective (activate waypoint 3).")
message_string = self.mission.string("Task force is in the air, proceed with the objective.")
push_trigger.add_action(MessageToAll(message_string, clearview=True))
push_trigger.add_action(SetFlagValue())

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()},