mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix departure time in the kneeboard.
We don't have the departure time set until after we create the initial FlightData object. Populate the value after it is determined. Fixes https://github.com/Khopa/dcs_liberation/issues/290
This commit is contained in:
parent
5ba633c8a1
commit
eff9c77c9a
@ -228,7 +228,7 @@ class FlightData:
|
||||
friendly: bool
|
||||
|
||||
#: Number of seconds after mission start the flight is set to depart.
|
||||
departure_delay: int
|
||||
departure_delay: timedelta
|
||||
|
||||
#: Arrival airport.
|
||||
arrival: RunwayData
|
||||
@ -250,7 +250,7 @@ class FlightData:
|
||||
|
||||
def __init__(self, package: Package, flight_type: FlightType,
|
||||
units: List[FlyingUnit], size: int, friendly: bool,
|
||||
departure_delay: int, departure: RunwayData,
|
||||
departure_delay: timedelta, departure: RunwayData,
|
||||
arrival: RunwayData, divert: Optional[RunwayData],
|
||||
waypoints: List[FlightWaypoint],
|
||||
intra_flight_channel: RadioFrequency) -> None:
|
||||
@ -277,10 +277,6 @@ class FlightData:
|
||||
def aircraft_type(self) -> FlyingType:
|
||||
"""Returns the type of aircraft in this flight."""
|
||||
return self.units[0].unit_type
|
||||
|
||||
@property
|
||||
def departure_delay_delta(self) -> timedelta:
|
||||
return timedelta(seconds=self.departure_delay)
|
||||
|
||||
def num_radio_channels(self, radio_id: int) -> int:
|
||||
"""Returns the number of preset channels for the given radio."""
|
||||
@ -1065,6 +1061,9 @@ class AircraftConflictGenerator:
|
||||
# And setting *our* waypoint TOT causes the takeoff time to show up in
|
||||
# the player's kneeboard.
|
||||
waypoint.tot = estimator.takeoff_time_for_flight(flight)
|
||||
# And finally assign it to the FlightData info so it shows correctly in
|
||||
# the briefing.
|
||||
self.flights[-1].departure_delay = start_time
|
||||
|
||||
@staticmethod
|
||||
def should_activate_late(flight: Flight) -> bool:
|
||||
|
||||
@ -232,13 +232,13 @@ class MissionInfoGenerator:
|
||||
|
||||
class BriefingGenerator(MissionInfoGenerator):
|
||||
|
||||
def __init__(self, mission: Mission, game: "Game"):
|
||||
def __init__(self, mission: Mission, game: Game):
|
||||
super().__init__(mission, game)
|
||||
self.allied_flights_by_departure: Dict[str, List[FlightData]] = {}
|
||||
env = Environment(
|
||||
loader=FileSystemLoader("resources/briefing/templates"),
|
||||
autoescape=select_autoescape(
|
||||
disabled_extensions=("txt"),
|
||||
disabled_extensions=("txt",),
|
||||
default_for_string=True,
|
||||
default=True,
|
||||
)
|
||||
@ -267,7 +267,7 @@ class BriefingGenerator(MissionInfoGenerator):
|
||||
for flight in self.flights:
|
||||
if not flight.client_units and flight.friendly:
|
||||
name = flight.departure.airfield_name
|
||||
if name in self.allied_flights_by_departure.keys(): # where else can we get this?
|
||||
if name in self.allied_flights_by_departure: # where else can we get this?
|
||||
self.allied_flights_by_departure[name].append(flight)
|
||||
else:
|
||||
self.allied_flights_by_departure[name] = [flight]
|
||||
|
||||
@ -25,7 +25,7 @@ Planned ally flights:
|
||||
{{ dep }}
|
||||
---------------------------------------------------
|
||||
{% for flight in allied_flights_by_departure[dep] %}
|
||||
{{ flight.flight_type.name }} {{ flight.units[0].type }} x {{flight.size}}, departing in {{ flight.departure_delay_delta }}, {{ flight.package.target.name}}{% endfor %}
|
||||
{{ flight.flight_type.name }} {{ flight.units[0].type }} x {{flight.size}}, departing in {{ flight.departure_delay }}, {{ flight.package.target.name}}{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
Carriers and FARPs:
|
||||
@ -42,7 +42,7 @@ AWACS:
|
||||
{% for i in awacs %}{{ i.callsign }} -- Freq : {{i.freq.mhz}}
|
||||
{% endfor %}
|
||||
|
||||
JTACS [F-10 Menu] :
|
||||
JTACS [F-10 Menu] :
|
||||
====================
|
||||
{% for jtac in jtacs %}Frontline {{ jtac.region }} -- Code : {{ jtac.code }}
|
||||
{% endfor %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user