Encapsulate DB.js in angular constants to help testing

This commit is contained in:
Colin McLeod
2015-05-04 21:54:36 -07:00
parent c297bb6e8e
commit bf04a2cc19
8 changed files with 14 additions and 12 deletions

View File

@@ -1,5 +1,4 @@
angular.module('shipyard').service('Components', ['lodash', 'ComponentSet', function (_, ComponentSet) {
var C = DB.components;
angular.module('shipyard').service('Components', ['lodash', 'ComponentsDB', 'ShipsDB', 'ComponentSet', function (_, C, Ships, ComponentSet) {
this.cargoScoop = function() {
return { name: 'Cargo Scoop', class: 1, rating: 'H', power: 0.6};
@@ -38,7 +37,7 @@ angular.module('shipyard').service('Components', ['lodash', 'ComponentSet', func
};
this.forShip = function (shipId) {
var ship = DB.ships[shipId];
var ship = Ships[shipId];
return new ComponentSet(C, ship.properties.mass, ship.slots.common, ship.slots.internal[0], ship.slots.hardpoints[0]);
};