diff --git a/service/port.py b/service/port.py index bf0699eb3..e4b40d2d6 100644 --- a/service/port.py +++ b/service/port.py @@ -615,10 +615,14 @@ class Port(object): @staticmethod def exportDna(fit): dna = str(fit.shipID) + subsystems = [] # EVE cares which order you put these in mods = OrderedDict() charges = OrderedDict() for mod in fit.modules: if not mod.isEmpty: + if mod.slot == Slot.SUBSYSTEM: + subsystems.append(mod) + continue if not mod.itemID in mods: mods[mod.itemID] = 0 mods[mod.itemID] += 1 @@ -632,6 +636,9 @@ class Port(object): for mod in mods: dna += ":{0};{1}".format(mod, mods[mod]) + for subsystem in sorted(subsystems, key=lambda mod: mod.getModifiedItemAttr("subSystemSlot")): + dna += ":{0};1".format(subsystem.itemID) + for drone in fit.drones: dna += ":{0};{1}".format(drone.itemID, drone.amount) @@ -674,10 +681,17 @@ class Port(object): continue slot = module.slot - if not slot in slotNum: - slotNum[slot] = 0 - slotId = slotNum[slot] - slotNum[slot] += 1 + + if slot == Slot.SUBSYSTEM: + # Order of subsystem matters based on this attr. See GH issue #130 + slotId = module.getModifiedItemAttr("subSystemSlot") - 124 + else: + if not slot in slotNum: + slotNum[slot] = 0 + + slotId = slotNum[slot] + slotNum[slot] += 1 + hardware = doc.createElement("hardware") hardware.setAttribute("type", module.item.name) slotName = Slot.getName(slot).lower()