From dc100c889aaf2c05caf78c745420048b30848287 Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Wed, 2 Sep 2015 16:26:41 +0100 Subject: [PATCH] Add Cargo Hatch to Coriolis export. --- coriolis.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/coriolis.py b/coriolis.py index 691ef88e..db80897a 100644 --- a/coriolis.py +++ b/coriolis.py @@ -21,9 +21,9 @@ slot_map = { 'Slot' : 'internal', } -# Map draft EDDN outfitting to Coriolis +# Map draft E:D Shipyard & EDDN outfitting to Coriolis # https://raw.githubusercontent.com/jamesremuscat/EDDN/master/schemas/outfitting-v1.0-draft.json -# http://cdn.coriolis.io/schemas/ship-loadout/1.json +# http://cdn.coriolis.io/schemas/ship-loadout/2.json ship_map = dict(companion.ship_map) ship_map['Asp'] = 'Asp Explorer' @@ -37,6 +37,7 @@ category_map = { standard_map = OrderedDict([ # in output order ('Armour', 'bulkheads'), + (None, 'cargoHatch'), # not available in the Companion API data ('Power Plant', 'powerPlant'), ('Thrusters', 'thrusters'), ('Frame Shift Drive', 'frameShiftDrive'), @@ -90,6 +91,7 @@ def export(data): ('internal', []), ])), ]) + maxpri = 0 # Correct module ordering relies on the fact that "Slots" in the data are correctly ordered alphabetically. # Correct hardpoint ordering additionally relies on the fact that "Huge" < "Large" < "Medium" < "Small" @@ -115,6 +117,7 @@ def export(data): ('enabled', module['enabled']), ('priority', module['priority']+1), # make 1-based ]) + maxpri = max(maxpri, thing['priority']) if module['name'] in bulkheads: # Bulkheads are just strings @@ -149,6 +152,12 @@ def export(data): except: if __debug__: raise + # Cargo Hatch status is not available in the data - fake something up + loadout['components']['standard']['cargoHatch'] = OrderedDict([ + ('enabled', True), + ('priority', maxpri), + ]) + # Construct description string = json.dumps(loadout, indent=2)