UI changes, added utilitiy services, persistance, serialization

This commit is contained in:
Colin McLeod
2015-05-01 01:14:29 -07:00
parent f736a078ec
commit 51ac98d10f
82 changed files with 2709 additions and 2516 deletions

View File

@@ -0,0 +1,35 @@
angular.module('shipyard').service('Components', ['lodash', 'ComponentSet', function (_, ComponentSet) {
var C = DB.components;
this.cargoScoop = function() {
return { name: 'Cargo Scoop', class: 1, rating: 'H', power: 0.6};
}
this.common = function (typeIndex, componentId) {
return C.common[typeIndex][componentId];
};
this.hardpoints = function(id) {
var c = _.find(C.hardpoints, function(o) {
return o[id];
})
return c[id];
};
this.internal = function(id) {
var c = _.find(C.internal, function(o) {
return o[id];
})
return c[id];
};
this.bulkheads = function(shipId, bulkheadsId) {
return C.bulkheads[shipId][bulkheadsId];
};
this.forShip = function (shipId) {
var ship = DB.ships[shipId];
return new ComponentSet(C, ship.properties.mass, ship.slots.common, ship.slots.internal[0], ship.slots.hardpoints[0]);
};
}]);