Rename common to standard for consistency

This commit is contained in:
Colin McLeod
2015-10-22 20:19:41 -07:00
parent f4bf09eaab
commit d8633a8411
51 changed files with 561 additions and 525 deletions

View File

@@ -9,7 +9,7 @@ angular.module('app').controller('ImportController', ['lodash', '$rootScope', '$
var textBuildRegex = new RegExp('^\\[([\\w \\-]+)\\]\n');
var lineRegex = new RegExp('^([\\dA-Z]{1,2}): (\\d)([A-I])[/]?([FGT])?([SD])? ([\\w\\- ]+)');
var mountMap = { 'H': 4, 'L': 3, 'M': 2, 'S': 1, 'U': 0 };
var commonMap = { 'RB': 0, 'TM': 1, 'FH': 2, 'EC': 3, 'PC': 4, 'SS': 5, 'FS': 6 };
var standardMap = { 'RB': 0, 'TM': 1, 'FH': 2, 'EC': 3, 'PC': 4, 'SS': 5, 'FS': 6 };
var bhMap = { 'lightweight alloy': 0, 'reinforced alloy': 1, 'military grade composite': 2, 'mirrored surface composite': 3, 'reactive surface composite': 4 };
function isEmptySlot(slot) {
@@ -137,7 +137,7 @@ angular.module('app').controller('ImportController', ['lodash', '$rootScope', '$
var name = parts[6].trim();
var slot, group;
if (isNaN(typeSize)) { // Common or Hardpoint
if (isNaN(typeSize)) { // Standard or Hardpoint
if (typeSize.length == 1) { // Hardpoint
var slotClass = mountMap[typeSize];
@@ -162,12 +162,12 @@ angular.module('app').controller('ImportController', ['lodash', '$rootScope', '$
ship.useBulkhead(bhId, true);
} else if (commonMap[typeSize] != undefined) {
var commonIndex = commonMap[typeSize];
} else if (standardMap[typeSize] != undefined) {
var standardIndex = standardMap[typeSize];
if (ship.common[commonIndex].maxClass < cl) { throw name + ' exceeds max class for the ' + ship.name; }
if (ship.standard[standardIndex].maxClass < cl) { throw name + ' exceeds max class for the ' + ship.name; }
ship.use(ship.common[commonIndex], cl + rating, Components.common(commonIndex, cl + rating), true);
ship.use(ship.standard[standardIndex], cl + rating, Components.standard(standardIndex, cl + rating), true);
} else {
throw 'Unknown component: "' + line + '"';

View File

@@ -16,13 +16,13 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
$scope.ships = Ships;
$rootScope.title = ship.name + ($scope.buildName ? ' - ' + $scope.buildName : '');
$scope.ship = ship;
$scope.pp = ship.common[0]; // Power Plant
$scope.th = ship.common[1]; // Thruster
$scope.fsd = ship.common[2]; // Frame Shrift Drive
$scope.ls = ship.common[3]; // Life Support
$scope.pd = ship.common[4]; // Power Distributor
$scope.ss = ship.common[5]; // Sensors
$scope.ft = ship.common[6]; // Fuel Tank
$scope.pp = ship.standard[0]; // Power Plant
$scope.th = ship.standard[1]; // Thruster
$scope.fsd = ship.standard[2]; // Frame Shrift Drive
$scope.ls = ship.standard[3]; // Life Support
$scope.pd = ship.standard[4]; // Power Distributor
$scope.ss = ship.standard[5]; // Sensors
$scope.ft = ship.standard[6]; // Fuel Tank
$scope.hps = ship.hardpoints;
$scope.internal = ship.internal;
$scope.costList = ship.costList;
@@ -166,7 +166,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
} else if (type == 'h') {
ship.use(slot, id, Components.hardpoints(id));
} else if (type == 'c') {
ship.use(slot, id, Components.common(ship.common.indexOf(slot), id));
ship.use(slot, id, Components.standard(ship.standard.indexOf(slot), id));
} else if (type == 'i') {
ship.use(slot, id, Components.internal(id));
} else if (type == 'b') {
@@ -204,12 +204,12 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
* Optimize for the lower mass build that can still boost and power the ship
* without power management.
*/
$scope.optimizeCommon = function() {
updateState(Serializer.fromShip(ship.useLightestCommon()));
$scope.optimizeStandard = function() {
updateState(Serializer.fromShip(ship.useLightestStandard()));
};
$scope.useCommon = function(rating) {
updateState(Serializer.fromShip(ship.useCommon(rating)));
$scope.useStandard = function(rating) {
updateState(Serializer.fromShip(ship.useStandard(rating)));
};
$scope.useHardpoint = function(group, mount, clobber, missile) {
@@ -274,12 +274,12 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
var id = Components.findInternalId('cr', slot.maxClass, 'E');
ship.use(slot, id, Components.internal(id));
});
ship.useLightestCommon();
ship.useLightestStandard();
updateState(Serializer.fromShip(ship));
};
/**
* Optimize common and internal components, hardpoints for exploration
* Optimize standard and internal components, hardpoints for exploration
*/
$scope.optimizeExplorer = function() {
var intLength = ship.internal.length,
@@ -338,7 +338,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
}
}
ship.useLightestCommon({ pd: '1D', ppRating: 'A' });
ship.useLightestStandard({ pd: '1D', ppRating: 'A' });
updateState(Serializer.fromShip(ship));
};
@@ -527,7 +527,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
}
}
for (var g in { common: 1, internal: 1, hardpoints: 1 }) {
for (var g in { standard: 1, internal: 1, hardpoints: 1 }) {
var retroSlotGroup = retrofitShip[g];
var slotGroup = ship[g];
for (i = 0, l = slotGroup.length; i < l; i++) {
@@ -558,7 +558,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
var costs = $scope.ammoList = [];
var total = 0, i, l, item, q, limpets = 0, scoop = false;
for (var g in { common: 1, internal: 1, hardpoints: 1 }) {
for (var g in { standard: 1, internal: 1, hardpoints: 1 }) {
var slotGroup = ship[g];
for (i = 0, l = slotGroup.length; i < l; i++) {
if (slotGroup[i].id) {

View File

@@ -1,4 +1,4 @@
angular.module('app').controller('ShipyardController', ['$rootScope', '$scope', 'ShipsDB', 'Ship', 'Components', function($rootScope, $scope, ShipsDB, Ship, Components) {
angular.module('app').controller('ShipyardController', ['$rootScope', '$scope', 'ShipsDB', 'Ship', 'Components', function($rootScope, $scope, ShipsDB, Ship, Components) {
$rootScope.title = 'Coriolis - Shipyard';
$scope.shipPredicate = 'properties.name';
$scope.shipDesc = false;
@@ -31,7 +31,7 @@ angular.module('app').controller('ShipyardController', ['$rootScope', '$scope',
summary.retailCost = ship.totalCost; // Record Stock/Default/retail cost
ship.optimizeMass({ pd: '1D' }); // Optimize Mass with 1D PD for maximum possible jump range
summary.maxJumpRange = ship.unladenRange; // Record Jump Range
ship.optimizeMass({ th: ship.common[1].maxClass + 'A' }); // Optmize mass with Max Thrusters
ship.optimizeMass({ th: ship.standard[1].maxClass + 'A' }); // Optmize mass with Max Thrusters
summary.topSpeed = ship.topSpeed;
summary.topBoost = ship.topBoost;

View File

@@ -6,7 +6,7 @@ angular.module('app').directive('componentSelect', ['$translate', function($tran
var prevClass = null, prevRating = null;
for (var i = 0; i < opts.length; i++) {
var o = opts[i];
var id = o.id || (o.class + o.rating); // Common components' ID is their class and rating
var id = o.id || (o.class + o.rating); // Standard components' ID is their class and rating
if (i > 0 && opts.length > 3 && o.class != prevClass && (o.rating != prevRating || o.mode) && o.grp != 'pa') {
list.push('<br/>');

View File

@@ -16,7 +16,7 @@ angular.module('app').service('Serializer', ['lodash', 'GroupMap', 'MountMap', '
var data = [
ship.bulkheads.id,
_.map(ship.common, mapGroup, power),
_.map(ship.standard, mapGroup, power),
_.map(ship.hardpoints, mapGroup, power),
_.map(ship.internal, mapGroup, power),
'.',
@@ -36,7 +36,7 @@ angular.module('app').service('Serializer', ['lodash', 'GroupMap', 'MountMap', '
* @param {string} dataString The string to deserialize
*/
this.toShip = function(ship, dataString) {
var common = new Array(ship.common.length),
var standard = new Array(ship.standard.length),
hardpoints = new Array(ship.hardpoints.length),
internal = new Array(ship.internal.length),
parts = dataString.split('.'),
@@ -52,12 +52,12 @@ angular.module('app').service('Serializer', ['lodash', 'GroupMap', 'MountMap', '
priorities = LZString.decompressFromBase64(parts[2].replace(/-/g, '/')).split('');
}
decodeToArray(code, internal, decodeToArray(code, hardpoints, decodeToArray(code, common, 1)));
decodeToArray(code, internal, decodeToArray(code, hardpoints, decodeToArray(code, standard, 1)));
ship.buildWith(
{
bulkheads: code.charAt(0) * 1,
common: common,
standard: standard,
hardpoints: hardpoints,
internal: internal
},
@@ -67,7 +67,7 @@ angular.module('app').service('Serializer', ['lodash', 'GroupMap', 'MountMap', '
};
this.toDetailedBuild = function(buildName, ship, code) {
var standard = ship.common,
var standard = ship.standard,
hardpoints = ship.hardpoints,
internal = ship.internal;
@@ -128,7 +128,7 @@ angular.module('app').service('Serializer', ['lodash', 'GroupMap', 'MountMap', '
throw 'Invalid bulkheads: ' + standard.bulkheads;
}
var common = _.map(
var standardIds = _.map(
['powerPlant', 'thrusters', 'frameShiftDrive', 'lifeSupport', 'powerDistributor', 'sensors', 'fuelTank'],
function(c) {
if (!standard[c].class || !standard[c].rating) {
@@ -156,7 +156,7 @@ angular.module('app').service('Serializer', ['lodash', 'GroupMap', 'MountMap', '
_.map(comps.utility, function(c) { return (!c || c.enabled === undefined) ? true : c.enabled * 1; }),
_.map(comps.internal, function(c) { return (!c || c.enabled === undefined) ? true : c.enabled * 1; }));
ship.buildWith({ bulkheads: bulkheads, common: common, hardpoints: hardpoints, internal: internal }, priorities, enabled);
ship.buildWith({ bulkheads: bulkheads, standard: standardIds, hardpoints: hardpoints, internal: internal }, priorities, enabled);
return ship;
};

View File

@@ -13,28 +13,28 @@ angular.module('shipyard').factory('ComponentSet', ['lodash', function(_) {
return maxClass;
}
function ComponentSet(components, mass, maxCommonArr, maxInternal, maxHardPoint) {
function ComponentSet(components, mass, maxStandardArr, maxInternal, maxHardPoint) {
this.mass = mass;
this.common = {};
this.standard = {};
this.internal = {};
this.hardpoints = {};
this.hpClass = {};
this.intClass = {};
this.common[0] = filter(components.common[0], maxCommonArr[0], 0, mass); // Power Plant
this.common[2] = filter(components.common[2], maxCommonArr[2], 0, mass); // FSD
this.common[4] = filter(components.common[4], maxCommonArr[4], 0, mass); // Power Distributor
this.common[6] = filter(components.common[6], maxCommonArr[6], 0, mass); // Fuel Tank
this.standard[0] = filter(components.standard[0], maxStandardArr[0], 0, mass); // Power Plant
this.standard[2] = filter(components.standard[2], maxStandardArr[2], 0, mass); // FSD
this.standard[4] = filter(components.standard[4], maxStandardArr[4], 0, mass); // Power Distributor
this.standard[6] = filter(components.standard[6], maxStandardArr[6], 0, mass); // Fuel Tank
// Thrusters, filter components by class only (to show full list of ratings for that class)
var minThrusterClass = _.reduce(components.common[1], function(minClass, thruster) {
var minThrusterClass = _.reduce(components.standard[1], function(minClass, thruster) {
return (thruster.maxmass >= mass && thruster.class < minClass) ? thruster.class : minClass;
}, maxCommonArr[1]);
this.common[1] = filter(components.common[1], maxCommonArr[1], minThrusterClass, 0); // Thrusters
}, maxStandardArr[1]);
this.standard[1] = filter(components.standard[1], maxStandardArr[1], minThrusterClass, 0); // Thrusters
// Slots where component class must be equal to slot class
this.common[3] = filter(components.common[3], maxCommonArr[3], maxCommonArr[3], 0); // Life Supprt
this.common[5] = filter(components.common[5], maxCommonArr[5], maxCommonArr[5], mass); // Sensors
this.standard[3] = filter(components.standard[3], maxStandardArr[3], maxStandardArr[3], 0); // Life Supprt
this.standard[5] = filter(components.standard[5], maxStandardArr[5], maxStandardArr[5], mass); // Sensors
for (var h in components.hardpoints) {
this.hardpoints[h] = filter(components.hardpoints[h], maxHardPoint, 0, mass);
@@ -94,7 +94,7 @@ angular.module('shipyard').factory('ComponentSet', ['lodash', function(_) {
}
ComponentSet.prototype.lightestPowerDist = function(boostEnergy) {
var pds = this.common[4];
var pds = this.standard[4];
var pd = pds[0];
for (var i = 1; i < pds.length; i++) {
@@ -106,7 +106,7 @@ angular.module('shipyard').factory('ComponentSet', ['lodash', function(_) {
};
ComponentSet.prototype.lightestThruster = function(ladenMass) {
var ths = this.common[1];
var ths = this.standard[1];
var th = ths[0];
for (var i = 1; i < ths.length; i++) {
@@ -129,7 +129,7 @@ angular.module('shipyard').factory('ComponentSet', ['lodash', function(_) {
};
ComponentSet.prototype.lightestPowerPlant = function(powerUsed, rating) {
var pps = this.common[0];
var pps = this.standard[0];
var pp = null;
for (var i = 0; i < pps.length; i++) {

View File

@@ -20,7 +20,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
*
* @param {string} id Unique ship Id / Key
* @param {object} properties Basic ship properties such as name, manufacturer, mass, etc
* @param {object} slots Collection of slot groups (standard/common, internal, hardpoints) with their max class size.
* @param {object} slots Collection of slot groups (standard/standard, internal, hardpoints) with their max class size.
*/
function Ship(id, properties, slots) {
this.id = id;
@@ -32,7 +32,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
for (var slotType in slots) { // Initialize all slots
var slotGroup = slots[slotType];
var group = this[slotType] = []; // Initialize Slot group (Common, Hardpoints, Internal)
var group = this[slotType] = []; // Initialize Slot group (Standard, Hardpoints, Internal)
for (var i = 0; i < slotGroup.length; i++) {
if (typeof slotGroup[i] == 'object') {
group.push({ id: null, c: null, incCost: true, maxClass: slotGroup[i].class, eligible: slotGroup[i].eligible });
@@ -44,18 +44,18 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
// Make a Ship 'slot'/item similar to other slots
this.c = { incCost: true, type: 'SHIP', discountedCost: this.hullCost, c: { name: this.name, cost: this.hullCost } };
this.costList = _.union(this.internal, this.common, this.hardpoints);
this.costList = _.union(this.internal, this.standard, this.hardpoints);
this.costList.push(this.bulkheads); // Add The bulkheads
this.costList.unshift(this.c); // Add the ship itself to the list
this.powerList = _.union(this.internal, this.hardpoints);
this.powerList.unshift(this.cargoHatch);
this.powerList.unshift(this.common[1]); // Add Thrusters
this.powerList.unshift(this.common[5]); // Add Sensors
this.powerList.unshift(this.common[4]); // Add Power Distributor
this.powerList.unshift(this.common[3]); // Add Life Support
this.powerList.unshift(this.common[2]); // Add FSD
this.powerList.unshift(this.common[0]); // Add Power Plant
this.powerList.unshift(this.standard[1]); // Add Thrusters
this.powerList.unshift(this.standard[5]); // Add Sensors
this.powerList.unshift(this.standard[4]); // Add Power Distributor
this.powerList.unshift(this.standard[3]); // Add Life Support
this.powerList.unshift(this.standard[2]); // Add FSD
this.powerList.unshift(this.standard[0]); // Add Power Plant
this.shipCostMultiplier = 1;
this.componentCostMultiplier = 1;
@@ -99,7 +99,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
* @return {number} Jump range in Light Years
*/
Ship.prototype.getJumpRangeForMass = function(mass, fuel) {
return calcJumpRange(mass, this.common[2].c, fuel);
return calcJumpRange(mass, this.standard[2].c, fuel);
};
/**
@@ -160,10 +160,10 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
*/
Ship.prototype.buildWith = function(comps, priorities, enabled) {
var internal = this.internal,
common = this.common,
standard = this.standard,
hps = this.hardpoints,
bands = this.priorityBands,
cl = common.length,
cl = standard.length,
i, l;
// Reset Cumulative stats
@@ -193,20 +193,20 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
}
for (i = 0; i < cl; i++) {
common[i].cat = 0;
common[i].enabled = enabled ? enabled[i + 1] * 1 : true;
common[i].priority = priorities && priorities[i + 1] ? priorities[i + 1] * 1 : 0;
common[i].type = 'SYS';
common[i].c = common[i].id = null; // Resetting 'old' component if there was one
common[i].discountedCost = 0;
standard[i].cat = 0;
standard[i].enabled = enabled ? enabled[i + 1] * 1 : true;
standard[i].priority = priorities && priorities[i + 1] ? priorities[i + 1] * 1 : 0;
standard[i].type = 'SYS';
standard[i].c = standard[i].id = null; // Resetting 'old' component if there was one
standard[i].discountedCost = 0;
if (comps) {
this.use(common[i], comps.common[i], Components.common(i, comps.common[i]), true);
this.use(standard[i], comps.standard[i], Components.standard(i, comps.standard[i]), true);
}
}
common[1].type = 'ENG'; // Thrusters
common[2].type = 'ENG'; // FSD
standard[1].type = 'ENG'; // Thrusters
standard[2].type = 'ENG'; // FSD
cl++; // Increase accounts for Cargo Scoop
for (i = 0, l = hps.length; i < l; i++) {
@@ -283,10 +283,10 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
/**
* Optimize for the lower mass build that can still boost and power the ship
* without power management.
* @param {object} c Common Component overrides
* @param {object} c Standard Component overrides
*/
Ship.prototype.optimizeMass = function(c) {
return this.emptyHardpoints().emptyInternal().useLightestCommon(c);
return this.emptyHardpoints().emptyInternal().useLightestStandard(c);
};
Ship.prototype.setCostIncluded = function(item, included) {
@@ -322,7 +322,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
* Updates the ship's cumulative and aggregated stats based on the component change.
*/
Ship.prototype.updateStats = function(slot, n, old, preventUpdate) {
var powerChange = slot == this.common[0];
var powerChange = slot == this.standard[0];
if (old) { // Old component now being removed
switch (old.grp) {
@@ -410,14 +410,14 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
prevDeployed = band.deployedSum = prevDeployed + band.deployed + band.retracted;
}
this.powerAvailable = this.common[0].c.pGen;
this.powerAvailable = this.standard[0].c.pGen;
this.powerRetracted = prevRetracted;
this.powerDeployed = prevDeployed;
return this;
};
Ship.prototype.updateTopSpeed = function() {
var speeds = calcSpeed(this.unladenMass + this.fuelCapacity, this.speed, this.boost, this.common[1].c, this.pipSpeed);
var speeds = calcSpeed(this.unladenMass + this.fuelCapacity, this.speed, this.boost, this.standard[1].c, this.pipSpeed);
this.topSpeed = speeds['4 Pips'];
this.topBoost = speeds.boost;
return this;
@@ -433,7 +433,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
* Jump Range and total range calculations
*/
Ship.prototype.updateJumpStats = function() {
var fsd = this.common[2].c; // Frame Shift Drive;
var fsd = this.standard[2].c; // Frame Shift Drive;
this.unladenRange = calcJumpRange(this.unladenMass + fsd.maxfuel, fsd, this.fuelCapacity); // Include fuel weight for jump
this.fullTankRange = calcJumpRange(this.unladenMass + this.fuelCapacity, fsd, this.fuelCapacity); // Full Tanke
this.ladenRange = calcJumpRange(this.ladenMass, fsd, this.fuelCapacity);
@@ -493,37 +493,37 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
};
/**
* [useCommon description]
* [useStandard description]
* @param {[type]} rating [description]
* @return {[type]} [description]
*/
Ship.prototype.useCommon = function(rating) {
for (var i = this.common.length - 1; i--; ) { // All except Fuel Tank
var id = this.common[i].maxClass + rating;
this.use(this.common[i], id, Components.common(i, id));
Ship.prototype.useStandard = function(rating) {
for (var i = this.standard.length - 1; i--; ) { // All except Fuel Tank
var id = this.standard[i].maxClass + rating;
this.use(this.standard[i], id, Components.standard(i, id));
}
return this;
};
/**
* Use the lightest common components unless otherwise specified
* Use the lightest standard components unless otherwise specified
* @param {object} c Component overrides
*/
Ship.prototype.useLightestCommon = function(c) {
Ship.prototype.useLightestStandard = function(c) {
c = c || {};
var common = this.common,
var standard = this.standard,
pd = c.pd || this.availCS.lightestPowerDist(this.boostEnergy), // Find lightest Power Distributor that can still boost;
fsd = c.fsd || common[2].maxClass + 'A',
ls = c.ls || common[3].maxClass + 'D',
s = c.s || common[5].maxClass + 'D',
fsd = c.fsd || standard[2].maxClass + 'A',
ls = c.ls || standard[3].maxClass + 'D',
s = c.s || standard[5].maxClass + 'D',
updated;
this.useBulkhead(0)
.use(common[2], fsd, Components.common(2, fsd)) // FSD
.use(common[3], ls, Components.common(3, ls)) // Life Support
.use(common[5], s, Components.common(5, s)) // Sensors
.use(common[4], pd, Components.common(4, pd)); // Power Distributor
.use(standard[2], fsd, Components.standard(2, fsd)) // FSD
.use(standard[3], ls, Components.standard(3, ls)) // Life Support
.use(standard[5], s, Components.standard(5, s)) // Sensors
.use(standard[4], pd, Components.standard(4, pd)); // Power Distributor
// Thrusters and Powerplant must be determined after all other components are mounted
// Loop at least once to determine absolute lightest PD and TH
@@ -531,15 +531,15 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
updated = false;
// Find lightest Thruster that still works for the ship at max mass
var th = c.th || this.availCS.lightestThruster(this.ladenMass);
if (th != common[1].id) {
this.use(common[1], th, Components.common(1, th));
if (th != standard[1].id) {
this.use(standard[1], th, Components.standard(1, th));
updated = true;
}
// Find lightest Power plant that can power the ship
var pp = c.pp || this.availCS.lightestPowerPlant(Math.max(this.powerRetracted, this.powerDeployed), c.ppRating);
if (pp != common[0].id) {
this.use(common[0], pp, Components.common(0, pp));
if (pp != standard[0].id) {
this.use(standard[0], pp, Components.standard(0, pp));
updated = true;
}
} while (updated);

View File

@@ -20,7 +20,7 @@ angular.module('shipyard', ['ngLodash'])
.constant('SizeMap', ['', 'small', 'medium', 'large', 'capital'])
// Map to lookup group labels/names for component grp, used for JSON Serialization
.constant('GroupMap', {
// Common
// Standard
pp: 'Power Plant',
t: 'Thrusters',
fsd: 'Frame Shift Drive',

View File

@@ -10,8 +10,8 @@ angular.module('shipyard').service('Components', ['lodash', 'ComponentsDB', 'Shi
return { name: 'Cargo Hatch', class: 1, rating: 'H', power: 0.6 };
};
this.common = function(typeIndex, componentId) {
return C.common[typeIndex][componentId];
this.standard = function(typeIndex, componentId) {
return C.standard[typeIndex][componentId];
};
this.hardpoints = function(id) {
@@ -175,7 +175,7 @@ angular.module('shipyard').service('Components', ['lodash', 'ComponentsDB', 'Shi
this.forShip = function(shipId) {
var ship = Ships[shipId];
var maxInternal = isNaN(ship.slots.internal[0]) ? ship.slots.internal[0].class : ship.slots.internal[0];
return new ComponentSet(C, ship.minMassFilter || ship.properties.hullMass + 5, ship.slots.common, maxInternal, ship.slots.hardpoints[0]);
return new ComponentSet(C, ship.minMassFilter || ship.properties.hullMass + 5, ship.slots.standard, maxInternal, ship.slots.hardpoints[0]);
};
}]);