Don't show red support units on blue kneeboards.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1080
This commit is contained in:
Dan Albert 2021-05-20 17:24:02 -07:00
parent e12e2c4b0b
commit e795e96bfb
4 changed files with 35 additions and 13 deletions

View File

@ -171,13 +171,16 @@ class Operation:
gen.add_dynamic_runway(dynamic_runway)
for tanker in airsupportgen.air_support.tankers:
gen.add_tanker(tanker)
if tanker.blue:
gen.add_tanker(tanker)
for aewc in airsupportgen.air_support.awacs:
gen.add_awacs(aewc)
if aewc.blue:
gen.add_awacs(aewc)
for jtac in jtacs:
gen.add_jtac(jtac)
if jtac.blue:
gen.add_jtac(jtac)
for flight in airgen.flights:
gen.add_flight(flight)
@ -453,7 +456,7 @@ class Operation:
for tanker in airsupportgen.air_support.tankers:
luaData["Tankers"][tanker.callsign] = {
"dcsGroupName": tanker.dcsGroupName,
"dcsGroupName": tanker.group_name,
"callsign": tanker.callsign,
"variant": tanker.variant,
"radio": tanker.freq.mhz,
@ -463,14 +466,14 @@ class Operation:
if airsupportgen.air_support.awacs:
for awacs in airsupportgen.air_support.awacs:
luaData["AWACs"][awacs.callsign] = {
"dcsGroupName": awacs.dcsGroupName,
"dcsGroupName": awacs.group_name,
"callsign": awacs.callsign,
"radio": awacs.freq.mhz,
}
for jtac in jtacs:
luaData["JTACs"][jtac.callsign] = {
"dcsGroupName": jtac.dcsGroupName,
"dcsGroupName": jtac.group_name,
"callsign": jtac.callsign,
"zone": jtac.region,
"dcsUnit": jtac.unit_name,

View File

@ -815,12 +815,13 @@ class AircraftConflictGenerator:
self.air_support.awacs.append(
AwacsInfo(
dcsGroupName=str(group.name),
group_name=str(group.name),
callsign=callsign,
freq=channel,
depature_location=flight.departure.name,
end_time=flight.flight_plan.mission_departure_time,
start_time=flight.flight_plan.mission_start_time,
blue=flight.departure.captured,
)
)

View File

@ -35,23 +35,25 @@ AWACS_ALT = 13000
class AwacsInfo:
"""AWACS information for the kneeboard."""
dcsGroupName: str
group_name: str
callsign: str
freq: RadioFrequency
depature_location: Optional[str]
start_time: Optional[timedelta]
end_time: Optional[timedelta]
blue: bool
@dataclass
class TankerInfo:
"""Tanker information for the kneeboard."""
dcsGroupName: str
group_name: str
callsign: str
variant: str
freq: RadioFrequency
tacan: TacanChannel
blue: bool
@dataclass
@ -165,7 +167,14 @@ class AirSupportConflictGenerator:
tanker_group.points[0].tasks.append(SetImmortalCommand(True))
self.air_support.tankers.append(
TankerInfo(str(tanker_group.name), callsign, variant, freq, tacan)
TankerInfo(
str(tanker_group.name),
callsign,
variant,
freq,
tacan,
blue=True,
)
)
if not self.game.settings.disable_legacy_aewc:
@ -196,12 +205,13 @@ class AirSupportConflictGenerator:
self.air_support.awacs.append(
AwacsInfo(
dcsGroupName=str(awacs_flight.name),
group_name=str(awacs_flight.name),
callsign=callsign_for_support_unit(awacs_flight),
freq=freq,
depature_location=None,
start_time=None,
end_time=None,
blue=True,
)
)
else:

View File

@ -68,11 +68,12 @@ INFANTRY_GROUP_SIZE = 5
class JtacInfo:
"""JTAC information."""
dcsGroupName: str
group_name: str
unit_name: str
callsign: str
region: str
code: str
blue: bool
# TODO: Radio info? Type?
@ -196,7 +197,14 @@ class GroundConflictGenerator:
# Note: Will need to change if we ever add ground based JTAC.
callsign = callsign_for_support_unit(jtac)
self.jtacs.append(
JtacInfo(str(jtac.name), n, callsign, frontline, str(code))
JtacInfo(
str(jtac.name),
n,
callsign,
frontline,
str(code),
blue=True,
)
)
def gen_infantry_group_for_group(