mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 22:55:35 +00:00
Massive refactor for 3rd party import
This commit is contained in:
@@ -32,7 +32,7 @@ angular.module('shipyard', ['ngLodash'])
|
||||
|
||||
// Internal
|
||||
fs: 'Fuel Scoop',
|
||||
sc: 'Scanners',
|
||||
sc: 'Scanner',
|
||||
am: 'Auto Field-Maintenance Unit',
|
||||
cr: 'Cargo Rack',
|
||||
fi: 'FSD Interdictor',
|
||||
@@ -69,7 +69,10 @@ angular.module('shipyard', ['ngLodash'])
|
||||
.value('MountMap', {
|
||||
'F': 'Fixed',
|
||||
'G': 'Gimballed',
|
||||
'T': 'Turret'
|
||||
'T': 'Turret',
|
||||
'Fixed': 'F',
|
||||
'Gimballed': 'G',
|
||||
'Turret': 'T'
|
||||
})
|
||||
.value('shipSize', [
|
||||
'N/A',
|
||||
|
||||
@@ -32,6 +32,41 @@ angular.module('shipyard').service('Components', ['lodash', 'ComponentsDB', 'Shi
|
||||
return null;
|
||||
};
|
||||
|
||||
this.findInternalId = function(groupName, clss, rating, name) {
|
||||
var group = C.internal[groupName];
|
||||
|
||||
if (!group) {
|
||||
throw 'Invalid internal group: ' + groupName;
|
||||
}
|
||||
|
||||
for (var i = 0, l = group.length; i < l; i++) {
|
||||
if (group[i].class == clss && group[i].rating == rating && ((!name && !group[i].name) || group[i].name == name)) {
|
||||
return group[i].id;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
this.findHardpointId = function(groupName, clss, rating, name, mode, missile) {
|
||||
var group = C.hardpoints[groupName];
|
||||
|
||||
if (!group) {
|
||||
throw 'Invalid hardpoint group: ' + groupName;
|
||||
}
|
||||
|
||||
for (var i = 0, l = group.length; i < l; i++) {
|
||||
if (group[i].class == clss && group[i].rating == rating && group[i].mode == mode
|
||||
&& ((!name && !group[i].name) || group[i].name == name)
|
||||
&& ((!missile && !group[i].missile) || group[i].missile == missile)
|
||||
) {
|
||||
return group[i].id;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Looks up the bulkhead component for a specific ship and bulkhead
|
||||
* @param {string} shipId Unique ship Id/Key
|
||||
@@ -42,6 +77,10 @@ angular.module('shipyard').service('Components', ['lodash', 'ComponentsDB', 'Shi
|
||||
return C.bulkheads[shipId][bulkheadsId];
|
||||
};
|
||||
|
||||
this.bulkheadIndex = function(bulkheadName) {
|
||||
return ['Lightweight Alloy', 'Reinforced Alloy', 'Military Grade Composite', 'Mirrored Surface Composite', 'Reactive Surface Composite'].indexOf(bulkheadName);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new ComponentSet that contains all available components
|
||||
* that the specified ship is eligible to use.
|
||||
|
||||
Reference in New Issue
Block a user