mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +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
|
friendly: bool
|
||||||
|
|
||||||
#: Number of seconds after mission start the flight is set to depart.
|
#: Number of seconds after mission start the flight is set to depart.
|
||||||
departure_delay: int
|
departure_delay: timedelta
|
||||||
|
|
||||||
#: Arrival airport.
|
#: Arrival airport.
|
||||||
arrival: RunwayData
|
arrival: RunwayData
|
||||||
@ -250,7 +250,7 @@ class FlightData:
|
|||||||
|
|
||||||
def __init__(self, package: Package, flight_type: FlightType,
|
def __init__(self, package: Package, flight_type: FlightType,
|
||||||
units: List[FlyingUnit], size: int, friendly: bool,
|
units: List[FlyingUnit], size: int, friendly: bool,
|
||||||
departure_delay: int, departure: RunwayData,
|
departure_delay: timedelta, departure: RunwayData,
|
||||||
arrival: RunwayData, divert: Optional[RunwayData],
|
arrival: RunwayData, divert: Optional[RunwayData],
|
||||||
waypoints: List[FlightWaypoint],
|
waypoints: List[FlightWaypoint],
|
||||||
intra_flight_channel: RadioFrequency) -> None:
|
intra_flight_channel: RadioFrequency) -> None:
|
||||||
@ -278,10 +278,6 @@ class FlightData:
|
|||||||
"""Returns the type of aircraft in this flight."""
|
"""Returns the type of aircraft in this flight."""
|
||||||
return self.units[0].unit_type
|
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:
|
def num_radio_channels(self, radio_id: int) -> int:
|
||||||
"""Returns the number of preset channels for the given radio."""
|
"""Returns the number of preset channels for the given radio."""
|
||||||
# Note: pydcs only initializes the radio presets for client slots.
|
# Note: pydcs only initializes the radio presets for client slots.
|
||||||
@ -1065,6 +1061,9 @@ class AircraftConflictGenerator:
|
|||||||
# And setting *our* waypoint TOT causes the takeoff time to show up in
|
# And setting *our* waypoint TOT causes the takeoff time to show up in
|
||||||
# the player's kneeboard.
|
# the player's kneeboard.
|
||||||
waypoint.tot = estimator.takeoff_time_for_flight(flight)
|
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
|
@staticmethod
|
||||||
def should_activate_late(flight: Flight) -> bool:
|
def should_activate_late(flight: Flight) -> bool:
|
||||||
|
|||||||
@ -232,13 +232,13 @@ class MissionInfoGenerator:
|
|||||||
|
|
||||||
class BriefingGenerator(MissionInfoGenerator):
|
class BriefingGenerator(MissionInfoGenerator):
|
||||||
|
|
||||||
def __init__(self, mission: Mission, game: "Game"):
|
def __init__(self, mission: Mission, game: Game):
|
||||||
super().__init__(mission, game)
|
super().__init__(mission, game)
|
||||||
self.allied_flights_by_departure: Dict[str, List[FlightData]] = {}
|
self.allied_flights_by_departure: Dict[str, List[FlightData]] = {}
|
||||||
env = Environment(
|
env = Environment(
|
||||||
loader=FileSystemLoader("resources/briefing/templates"),
|
loader=FileSystemLoader("resources/briefing/templates"),
|
||||||
autoescape=select_autoescape(
|
autoescape=select_autoescape(
|
||||||
disabled_extensions=("txt"),
|
disabled_extensions=("txt",),
|
||||||
default_for_string=True,
|
default_for_string=True,
|
||||||
default=True,
|
default=True,
|
||||||
)
|
)
|
||||||
@ -267,7 +267,7 @@ class BriefingGenerator(MissionInfoGenerator):
|
|||||||
for flight in self.flights:
|
for flight in self.flights:
|
||||||
if not flight.client_units and flight.friendly:
|
if not flight.client_units and flight.friendly:
|
||||||
name = flight.departure.airfield_name
|
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)
|
self.allied_flights_by_departure[name].append(flight)
|
||||||
else:
|
else:
|
||||||
self.allied_flights_by_departure[name] = [flight]
|
self.allied_flights_by_departure[name] = [flight]
|
||||||
|
|||||||
@ -25,7 +25,7 @@ Planned ally flights:
|
|||||||
{{ dep }}
|
{{ dep }}
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
{% for flight in allied_flights_by_departure[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 %}
|
{% endfor %}
|
||||||
|
|
||||||
Carriers and FARPs:
|
Carriers and FARPs:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user