mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2026-11-28 03:32:23 +03:00
Add mass and range to E:D Shipyard and Coriolis.
Means that these files can be directly loaded into ETN.
This commit is contained in:
1 parent
f685cecc85
commit
2995d7401e
11 files changed
+169
-11
No files matched your search
+18
-1
@@ -1,3 +1,5 @@
|
||||
import cPickle
|
||||
from os.path import join
|
||||
import time
|
||||
|
||||
import companion
|
||||
@@ -209,6 +211,10 @@ internal_map = {
|
||||
}
|
||||
|
||||
|
||||
# Module mass, FSD data etc
|
||||
moduledata = cPickle.load(open(join(config.respath, 'modules.p'), 'rb'))
|
||||
|
||||
|
||||
# Given a module description from the Companion API returns a description of the module in the form of a
|
||||
# dict { category, name, [mount], [guidance], [ship], rating, class } using the same terms found in the
|
||||
# English langauge game. For fitted modules, dict also includes { enabled, priority }.
|
||||
@@ -319,8 +325,19 @@ def lookup(module, ship_map):
|
||||
if 'on' in module and 'priority' in module:
|
||||
new['enabled'], new['priority'] = module['on'], module['priority'] # priority is zero-based
|
||||
|
||||
# Extra module data
|
||||
key = (new['name'], 'ship' in new and companion.ship_map.get(name[0]) or None, new['class'], new['rating'])
|
||||
if __debug__:
|
||||
assert key in moduledata, key
|
||||
m = moduledata.get(key, {})
|
||||
if new['name'] == 'Frame Shift Drive':
|
||||
assert 'mass' in m and 'optmass' in m and 'maxfuel' in m and 'fuelmul' in m and 'fuelpower' in m, m
|
||||
else:
|
||||
assert 'mass' in m, m
|
||||
new.update(moduledata.get(key, {}))
|
||||
|
||||
# check we've filled out mandatory fields
|
||||
for thing in ['category', 'name', 'class', 'rating']:
|
||||
for thing in ['category', 'name', 'class', 'rating']: # Don't consider mass etc as mandatory
|
||||
if not new.get(thing): raise AssertionError('%s: failed to set %s' % (module['id'], thing))
|
||||
if new['category'] == 'hardpoint' and not new.get('mount'):
|
||||
raise AssertionError('%s: failed to set %s' % (module['id'], 'mount'))
|
||||
|
||||
Reference in new issue
Block a user