Add support for some extra loadout types.

Also fixes the bug that @Starfire13 spotted in Khopa/dcs_liberation#744.
This commit is contained in:
Simon Clark 2021-01-07 13:37:16 +00:00
parent a81890e844
commit 7085bce6d4
2 changed files with 11 additions and 9 deletions

View File

@ -1026,22 +1026,23 @@ resources/payloads/UNIT_TYPE.lua file. A Flight has no concept of a PyDCS task,
used here. This is used in the payload editor, for setting the default loadout of an object. used here. This is used in the payload editor, for setting the default loadout of an object.
The left element is the FlightType name, and the right element is a tuple containing what is used in the lua file. The left element is the FlightType name, and the right element is a tuple containing what is used in the lua file.
Some aircraft differ from the standard loadout names, so those have been included here too. Some aircraft differ from the standard loadout names, so those have been included here too.
The priority goes from first to last - the first element in the tuple will be tried first, then the second, etc.
""" """
EXPANDED_TASK_PAYLOAD_OVERRIDE = { EXPANDED_TASK_PAYLOAD_OVERRIDE = {
"TARCAP": ("CAP", "CAP HEAVY"), "TARCAP": ("CAP HEAVY", "CAP"),
"BARCAP": ("CAP", "CAP HEAVY"), "BARCAP": ("CAP HEAVY", "CAP"),
"CAS": ("CAS","CAS MAVERICK F"), "CAS": ("CAS MAVERICK F", "CAS"),
"INTERCEPTION": ("CAP", "CAP HEAVY"), "INTERCEPTION": ("CAP HEAVY", "CAP"),
"STRIKE": ("STRIKE"), "STRIKE": ("STRIKE"),
"ANTISHIP": ("ANTISHIP"), "ANTISHIP": ("ANTISHIP"),
"SEAD": ("SEAD"), "SEAD": ("SEAD"),
"DEAD": ("SEAD"), "DEAD": ("SEAD"),
"ESCORT": ("CAP", "CAP HEAVY"), "ESCORT": ("CAP HEAVY", "CAP"),
"BAI": ("CAS","CAS MAVERICK F"), "BAI": ( "BAI", "CAS MAVERICK F", "CAS"),
"SWEEP": ("CAP", "CAP HEAVY"), "SWEEP": ("CAP HEAVY", "CAP"),
"OCA_RUNWAY": ("STRIKE"), "OCA_RUNWAY": ("OCA","RUNWAY_ATTACK","STRIKE"),
"OCA_AIRCRAFT": ("CAS","CAS MAVERICK F") "OCA_AIRCRAFT": ("CAS MAVERICK F", "CAS")
} }
PLANE_PAYLOAD_OVERRIDES: Dict[Type[PlaneType], Dict[Type[Task], str]] = { PLANE_PAYLOAD_OVERRIDES: Dict[Type[PlaneType], Dict[Type[Task], str]] = {

View File

@ -46,6 +46,7 @@ class QPylonEditor(QComboBox):
def default_loadout(self, pylon: Pylon) -> None: def default_loadout(self, pylon: Pylon) -> None:
self.flight.unit_type.load_payloads() self.flight.unit_type.load_payloads()
pylon_default_weapon = None pylon_default_weapon = None
loadout = None
# Iterate through each possible payload type for a given aircraft. # Iterate through each possible payload type for a given aircraft.
# Some aircraft have custom loadouts that in aren't the standard set. # Some aircraft have custom loadouts that in aren't the standard set.
for payload_override in db.EXPANDED_TASK_PAYLOAD_OVERRIDE.get(self.flight.flight_type.name): for payload_override in db.EXPANDED_TASK_PAYLOAD_OVERRIDE.get(self.flight.flight_type.name):