diff --git a/game/db.py b/game/db.py index a920d2c4..3fa8bc8f 100644 --- a/game/db.py +++ b/game/db.py @@ -1024,23 +1024,24 @@ COMMON_OVERRIDE = { This is a list of mappings from the FlightType of a Flight to the type of payload defined in the resources/payloads/UNIT_TYPE.lua file. A Flight has no concept of a PyDCS task, so COMMON_OVERRIDE cannot be 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 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. """ EXPANDED_TASK_PAYLOAD_OVERRIDE = { - "TARCAP": "CAP", - "BARCAP": "CAP", - "CAS": "CAS", - "INTERCEPTION": "CAP", - "STRIKE": "STRIKE", - "ANTISHIP": "ANTISHIP", - "SEAD": "SEAD", - "DEAD": "SEAD", - "ESCORT": "CAP", - "BAI": "CAS", - "SWEEP": "CAP", - "OCA_RUNWAY": "STRIKE", - "OCA_AIRCRAFT": "CAS" + "TARCAP": ("CAP", "CAP HEAVY"), + "BARCAP": ("CAP", "CAP HEAVY"), + "CAS": ("CAS","CAS MAVERICK F"), + "INTERCEPTION": ("CAP", "CAP HEAVY"), + "STRIKE": ("STRIKE"), + "ANTISHIP": ("ANTISHIP"), + "SEAD": ("SEAD"), + "DEAD": ("SEAD"), + "ESCORT": ("CAP", "CAP HEAVY"), + "BAI": ("CAS","CAS MAVERICK F"), + "SWEEP": ("CAP", "CAP HEAVY"), + "OCA_RUNWAY": ("STRIKE"), + "OCA_AIRCRAFT": ("CAS","CAS MAVERICK F") } PLANE_PAYLOAD_OVERRIDES: Dict[Type[PlaneType], Dict[Type[Task], str]] = { diff --git a/qt_ui/windows/mission/flight/payload/QPylonEditor.py b/qt_ui/windows/mission/flight/payload/QPylonEditor.py index 623523a1..4d67aa1e 100644 --- a/qt_ui/windows/mission/flight/payload/QPylonEditor.py +++ b/qt_ui/windows/mission/flight/payload/QPylonEditor.py @@ -45,11 +45,16 @@ class QPylonEditor(QComboBox): def default_loadout(self, pylon: Pylon) -> None: self.flight.unit_type.load_payloads() - loadout = self.flight.unit_type.loadout_by_name(db.EXPANDED_TASK_PAYLOAD_OVERRIDE.get(self.flight.flight_type.name)) pylon_default_weapon = None - for i in loadout: - if i[0] == self.pylon.number: - pylon_default_weapon = i[1]["clsid"] + # Iterate through each possible payload type for a given aircraft. + # 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): + if loadout is None: + loadout = self.flight.unit_type.loadout_by_name(payload_override) + if loadout is not None: + for i in loadout: + if i[0] == self.pylon.number: + pylon_default_weapon = i[1]["clsid"] if pylon_default_weapon is not None: self.setCurrentText(weapons_data.weapon_ids.get(pylon_default_weapon).get("name")) else: