mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Bingo & Joker Fuel for Flight Plans (#480)
Add bingo and joker fuel information to the kneeboard.
This commit is contained in:
parent
45ce28f9bf
commit
66ee5f5392
@ -293,12 +293,19 @@ class FlightData:
|
|||||||
#: Map of radio frequencies to their assigned radio and channel, if any.
|
#: Map of radio frequencies to their assigned radio and channel, if any.
|
||||||
frequency_to_channel_map: Dict[RadioFrequency, ChannelAssignment]
|
frequency_to_channel_map: Dict[RadioFrequency, ChannelAssignment]
|
||||||
|
|
||||||
|
#: Bingo fuel value in lbs.
|
||||||
|
bingo_fuel: Optional[int]
|
||||||
|
|
||||||
|
joker_fuel: Optional[int]
|
||||||
|
|
||||||
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: timedelta, 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,
|
||||||
|
bingo_fuel: Optional[int],
|
||||||
|
joker_fuel: Optional[int]) -> None:
|
||||||
self.package = package
|
self.package = package
|
||||||
self.flight_type = flight_type
|
self.flight_type = flight_type
|
||||||
self.units = units
|
self.units = units
|
||||||
@ -311,6 +318,8 @@ class FlightData:
|
|||||||
self.waypoints = waypoints
|
self.waypoints = waypoints
|
||||||
self.intra_flight_channel = intra_flight_channel
|
self.intra_flight_channel = intra_flight_channel
|
||||||
self.frequency_to_channel_map = {}
|
self.frequency_to_channel_map = {}
|
||||||
|
self.bingo_fuel = bingo_fuel
|
||||||
|
self.joker_fuel = joker_fuel
|
||||||
self.callsign = create_group_callsign_from_unit(self.units[0])
|
self.callsign = create_group_callsign_from_unit(self.units[0])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -777,7 +786,9 @@ class AircraftConflictGenerator:
|
|||||||
divert=divert,
|
divert=divert,
|
||||||
# Waypoints are added later, after they've had their TOTs set.
|
# Waypoints are added later, after they've had their TOTs set.
|
||||||
waypoints=[],
|
waypoints=[],
|
||||||
intra_flight_channel=channel
|
intra_flight_channel=channel,
|
||||||
|
bingo_fuel=flight.flight_plan.bingo_fuel,
|
||||||
|
joker_fuel=flight.flight_plan.joker_fuel
|
||||||
))
|
))
|
||||||
|
|
||||||
# Special case so Su 33 carrier take off
|
# Special case so Su 33 carrier take off
|
||||||
|
|||||||
@ -28,7 +28,7 @@ from game.theater import (
|
|||||||
TheaterGroundObject,
|
TheaterGroundObject,
|
||||||
)
|
)
|
||||||
from game.theater.theatergroundobject import EwrGroundObject
|
from game.theater.theatergroundobject import EwrGroundObject
|
||||||
from game.utils import nm_to_meter
|
from game.utils import nm_to_meter, meter_to_nm
|
||||||
from .closestairfields import ObjectiveDistanceCache
|
from .closestairfields import ObjectiveDistanceCache
|
||||||
from .flight import Flight, FlightType, FlightWaypoint, FlightWaypointType
|
from .flight import Flight, FlightType, FlightWaypoint, FlightWaypointType
|
||||||
from .traveltime import GroundSpeed, TravelTime
|
from .traveltime import GroundSpeed, TravelTime
|
||||||
@ -69,6 +69,8 @@ class FlightPlan:
|
|||||||
"""A list of all waypoints in the flight plan, in order."""
|
"""A list of all waypoints in the flight plan, in order."""
|
||||||
return list(self.iter_waypoints())
|
return list(self.iter_waypoints())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
|
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
|
||||||
"""Iterates over all waypoints in the flight plan, in order."""
|
"""Iterates over all waypoints in the flight plan, in order."""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
@ -115,6 +117,38 @@ class FlightPlan:
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def bingo_fuel(self) -> int:
|
||||||
|
"""Bingo fuel value for the FlightPlan
|
||||||
|
"""
|
||||||
|
distance_to_arrival = meter_to_nm(self.max_distance_from(self.flight.arrival))
|
||||||
|
|
||||||
|
bingo = 1000 # Minimum Emergency Fuel
|
||||||
|
bingo += 500 # Visual Traffic
|
||||||
|
bingo += 15 * distance_to_arrival
|
||||||
|
|
||||||
|
# TODO: Per aircraft tweaks.
|
||||||
|
|
||||||
|
if self.flight.divert is not None:
|
||||||
|
bingo += 10 * meter_to_nm(self.max_distance_from(self.flight.divert))
|
||||||
|
|
||||||
|
return round(bingo / 100) * 100
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def joker_fuel(self) -> int:
|
||||||
|
"""Joker fuel value for the FlightPlan
|
||||||
|
"""
|
||||||
|
return self.bingo_fuel + 1000
|
||||||
|
|
||||||
|
|
||||||
|
def max_distance_from(self, cp: ControlPoint) -> int:
|
||||||
|
"""Returns the farthest waypoint of the flight plan from a ControlPoint.
|
||||||
|
:arg cp The ControlPoint to measure distance from.
|
||||||
|
"""
|
||||||
|
if not self.waypoints:
|
||||||
|
return 0
|
||||||
|
return max([cp.position.distance_to_point(w.position) for w in self.waypoints])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def tot_offset(self) -> timedelta:
|
def tot_offset(self) -> timedelta:
|
||||||
"""This flight's offset from the package's TOT.
|
"""This flight's offset from the package's TOT.
|
||||||
|
|||||||
@ -230,28 +230,37 @@ class BriefingPage(KneeboardPage):
|
|||||||
"#", "Action", "Alt", "Dist", "GSPD", "Time", "Departure"
|
"#", "Action", "Alt", "Dist", "GSPD", "Time", "Departure"
|
||||||
])
|
])
|
||||||
|
|
||||||
writer.heading("Comm Ladder")
|
flight_plan_builder
|
||||||
comms = []
|
writer.table([
|
||||||
|
["{}lbs".format(self.flight.bingo_fuel), "{}lbs".format(self.flight.joker_fuel)]
|
||||||
|
], ['Bingo', 'Joker'])
|
||||||
|
|
||||||
|
# Package Section
|
||||||
|
writer.heading("Comm ladder")
|
||||||
|
comm_ladder = []
|
||||||
for comm in self.comms:
|
for comm in self.comms:
|
||||||
comms.append([comm.name, self.format_frequency(comm.freq)])
|
comm_ladder.append([comm.name, '', '', '', self.format_frequency(comm.freq)])
|
||||||
writer.table(comms, headers=["Name", "UHF"])
|
|
||||||
|
|
||||||
writer.heading("AWACS")
|
|
||||||
awacs = []
|
|
||||||
for a in self.awacs:
|
for a in self.awacs:
|
||||||
awacs.append([a.callsign, self.format_frequency(a.freq)])
|
comm_ladder.append([
|
||||||
writer.table(awacs, headers=["Callsign", "UHF"])
|
a.callsign,
|
||||||
|
'AWACS',
|
||||||
writer.heading("Tankers")
|
'',
|
||||||
tankers = []
|
'',
|
||||||
|
self.format_frequency(a.freq)
|
||||||
|
])
|
||||||
for tanker in self.tankers:
|
for tanker in self.tankers:
|
||||||
tankers.append([
|
comm_ladder.append([
|
||||||
tanker.callsign,
|
tanker.callsign,
|
||||||
|
"Tanker",
|
||||||
tanker.variant,
|
tanker.variant,
|
||||||
str(tanker.tacan),
|
str(tanker.tacan),
|
||||||
self.format_frequency(tanker.freq),
|
self.format_frequency(tanker.freq),
|
||||||
])
|
])
|
||||||
writer.table(tankers, headers=["Callsign", "Type", "TACAN", "UHF"])
|
|
||||||
|
|
||||||
|
writer.table(comm_ladder, headers=["Callsign","Task", "Type", "TACAN", "FREQ"])
|
||||||
|
|
||||||
|
|
||||||
writer.heading("JTAC")
|
writer.heading("JTAC")
|
||||||
jtacs = []
|
jtacs = []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user