Briefing generation changed to match new flight. Include info for all flight containing client slots;

This commit is contained in:
Khopa 2019-11-21 19:56:26 +01:00
parent bba51c6a23
commit 6598e034c1
2 changed files with 39 additions and 22 deletions

View File

@ -18,6 +18,7 @@ class BriefingGenerator:
self.m = mission
self.conflict = conflict
self.game = game
self.description = ""
self.freqs = []
self.targets = []
@ -32,32 +33,44 @@ class BriefingGenerator:
def append_waypoint(self, description: str):
self.waypoints.append(description)
def add_flight_description(self, flight):
if flight.client_count <= 0:
return
flight_unit_name = db.unit_type_name(flight.unit_type)
self.description += 2 * "\n" + "-" * 50 + "\n"
self.description += flight_unit_name + " x " + str(flight.count) + 2 * "\n"
self.description += "# 0 -- TAKEOFF : Take off"
for i, wpt in enumerate(flight.points):
self.description += "#" + str(1+i) + " -- " + wpt.name + " : " + wpt.description + "\n"
self.description += "# " + str(len(flight.points)) + " -- RTB"
self.description += "-" * 50 + "\n"
def generate(self):
self.waypoints.insert(0, "INITIAL")
self.waypoints.append("RTB")
self.waypoints.append("RTB Landing")
description = ""
self.description = ""
if self.title:
description += self.title
self.description += "DCS Liberation turn #" + str(self.game.turn) + "\n"
self.description += "-"*50 + "\n"
if self.description:
description += "\n\n" + self.description
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:
self.add_flight_description(flight)
if self.freqs:
description += "\n\nCOMMS:"
self.description += "\n\nComms Frequencies:\n"
self.description += "-" * 50 + "\n"
for name, freq in self.freqs:
description += "\n{}: {}".format(name, freq)
self.description += "\n{}: {}".format(name, freq)
if self.targets:
description += "\n\nTARGETS:"
for i, (name, tp) in enumerate(self.targets):
description += "\n#{} {} {}".format(i+1, name, "(TP {})".format(tp) if tp else "")
if self.waypoints:
description += "\n\nWAYPOINTS:"
for i, descr in enumerate(self.waypoints):
description += "\n#{}: {}".format(i, descr)
self.m.set_description_text(self.description)
self.m.set_description_text(description)

View File

@ -134,6 +134,7 @@ class FlightPlanner:
for ground_object in self.from_cp.ground_objects:
if ground_object.group_id not in patrolled and not ground_object.airbase_group:
point = FlightWaypoint(ground_object.position.x, ground_object.position.y, patrol_alt)
point.name = "Patrol point"
point.description = "Patrol #" + str(len(flight.points))
flight.points.append(point)
patrolled.append(ground_object.group_id)
@ -178,15 +179,18 @@ class FlightPlanner:
flight.targets.append(center)
ingress_point = FlightWaypoint(ingress.x, ingress.y, 1000)
ingress_point.description = "INGRESS CAS"
ingress_point.name = "INGRESS"
ingress_point.description = "Ingress into CAS area"
flight.points.append(ingress_point)
center_point = FlightWaypoint(center.x, center.y, 1000)
center_point.description = "PROVIDE CAS"
center_point.description = "Provide CAS"
center_point.name = "CAS"
flight.points.append(center_point)
egress_point = FlightWaypoint(egress.x, egress.y, 1000)
egress_point.description = "EGRESS FROM CAS AREA"
egress_point.description = "Egress from CAS area"
egress_point.name = "EGRESS"
flight.points.append(egress_point)
self.cas_flights.append(flight)