diff --git a/game/operation/operation.py b/game/operation/operation.py index 4b2457f3..69166f0e 100644 --- a/game/operation/operation.py +++ b/game/operation/operation.py @@ -64,7 +64,7 @@ class Operation: def initialize(self, mission: Mission, conflict: Conflict): self.current_mission = mission self.conflict = conflict - self.airgen = AircraftConflictGenerator(mission, conflict, self.game.settings) + self.airgen = AircraftConflictGenerator(mission, conflict, self.game.settings, self.game) self.shipgen = ShipGenerator(mission, conflict) self.airsupportgen = AirSupportConflictGenerator(mission, conflict, self.game) self.triggersgen = TriggersGenerator(mission, conflict, self.game) @@ -198,8 +198,6 @@ class Operation: self.briefinggen.append_frequency("AWACS", "133 MHz AM") self.briefinggen.append_frequency("Flight", "251 MHz AM") - if self.departure_cp.is_global or self.conflict.to_cp.is_global: - self.briefinggen.append_frequency("Carrier", "20X/ICLS CHAN1") # Generate the briefing self.briefinggen.generate() diff --git a/gen/aircraft.py b/gen/aircraft.py index 39f1cd7f..f7d8422c 100644 --- a/gen/aircraft.py +++ b/gen/aircraft.py @@ -46,8 +46,9 @@ INTERCEPT_MAX_DISTANCE = 200000 class AircraftConflictGenerator: escort_targets = [] # type: typing.List[typing.Tuple[FlyingGroup, int]] - def __init__(self, mission: Mission, conflict: Conflict, settings: Settings): + def __init__(self, mission: Mission, conflict: Conflict, settings: Settings, game): self.m = mission + self.game = game self.settings = settings self.conflict = conflict self.escort_targets = [] @@ -457,7 +458,12 @@ class AircraftConflictGenerator: for point in flight.points: group.add_waypoint(Point(point.x,point.y), point.alt) for t in point.targets: - group.points[i].tasks.append(Bombing(t.position)) + if hasattr(t, "obj_name"): + buildings = self.game.theater.find_ground_objects_by_obj_name(t.obj_name) + for building in buildings: + group.points[i].tasks.append(Bombing(building.position)) + else: + group.points[i].tasks.append(Bombing(t.position)) i = i + 1 diff --git a/gen/briefinggen.py b/gen/briefinggen.py index f73ca73f..b794f3b9 100644 --- a/gen/briefinggen.py +++ b/gen/briefinggen.py @@ -57,11 +57,7 @@ class BriefingGenerator: self.description += "-"*50 + "\n" for planner in self.game.planners.values(): - for flight in planner.cap_flights: - self.add_flight_description(flight) - for flight in planner.cas_flights: - self.add_flight_description(flight) - for flight in planner.sead_flights: + for flight in planner.flights: self.add_flight_description(flight) if self.freqs: @@ -82,7 +78,6 @@ class BriefingGenerator: self.description += "X" self.description += " " + str(cp.tacanI) + "\n" - self.m.set_description_text(self.description) diff --git a/resources/tools/generate_loadout_check.py b/resources/tools/generate_loadout_check.py index d5e43258..3d86d329 100644 --- a/resources/tools/generate_loadout_check.py +++ b/resources/tools/generate_loadout_check.py @@ -9,7 +9,7 @@ dcs.planes.FlyingType.payload_dirs = [os.path.join(os.path.dirname(os.path.realp mis = dcs.Mission(dcs.terrain.PersianGulf()) pos = dcs.terrain.PersianGulf().khasab().position -airgen = AircraftConflictGenerator(mis, None, None) +airgen = AircraftConflictGenerator(mis, None, None, None) for t, uts in db.UNIT_BY_TASK.items(): if t != dcs.task.CAP and t != dcs.task.CAS: diff --git a/theater/conflicttheater.py b/theater/conflicttheater.py index 9dd258ea..ddd11dc1 100644 --- a/theater/conflicttheater.py +++ b/theater/conflicttheater.py @@ -72,6 +72,14 @@ class ConflictTheater: self.controlpoints.append(point) + def find_ground_objects_by_obj_name(self, obj_name): + found = [] + for cp in self.controlpoints: + for g in cp.ground_objects: + if g.obj_name == obj_name: + found.append(g) + return found + def is_in_sea(self, point: Point) -> bool: if not self.landmap: return False diff --git a/theater/controlpoint.py b/theater/controlpoint.py index d5ae27a8..90aa213c 100644 --- a/theater/controlpoint.py +++ b/theater/controlpoint.py @@ -170,3 +170,10 @@ class ControlPoint: return closest_radial + def find_ground_objects_by_obj_name(self, obj_name): + found = [] + for g in self.ground_objects: + if g.obj_name == obj_name: + found.append(g) + return found +