diff --git a/app/js/controllers/controller-ship.js b/app/js/controllers/controller-ship.js index 5a8b1a40..352b4df6 100644 --- a/app/js/controllers/controller-ship.js +++ b/app/js/controllers/controller-ship.js @@ -4,7 +4,6 @@ angular.module('app') $scope.ship = ShipFactory($scope.shipId, DB.ships[$scope.shipId]); $scope.availCS = Components.forShip($scope.shipId); - // for debugging window.ship = $scope.ship; window.availcs = $scope.availCS; diff --git a/app/js/directives/directive-component-details.js b/app/js/directives/directive-component-details.js deleted file mode 100644 index 72a4f7a6..00000000 --- a/app/js/directives/directive-component-details.js +++ /dev/null @@ -1,11 +0,0 @@ -angular.module('app').directive('componentDetails', [function () { - return { - restrict: 'E', - scope:{ - c: '=', - lbl: '=', - opts: '=' - }, - templateUrl: 'views/component.html' - }; -}]); \ No newline at end of file diff --git a/app/js/directives/directive--list-cost.js b/app/js/directives/directive-list-cost.js similarity index 100% rename from app/js/directives/directive--list-cost.js rename to app/js/directives/directive-list-cost.js diff --git a/app/js/directives/directive-list-power.js b/app/js/directives/directive-list-power.js index 02fa42ea..5d187f27 100644 --- a/app/js/directives/directive-list-power.js +++ b/app/js/directives/directive-list-power.js @@ -9,8 +9,8 @@ angular.module('app') link: function (scope, element, attributes) { scope.$r = $r; - scope.toggle = function(component) { - component.enabled = !component.enabled; + scope.toggle = function(slot) { + slot.enabled = !slot.enabled; scope.ship.updateTotals(); } } diff --git a/app/js/directives/directive-slot-details.js b/app/js/directives/directive-slot-details.js new file mode 100644 index 00000000..5759c0c3 --- /dev/null +++ b/app/js/directives/directive-slot-details.js @@ -0,0 +1,11 @@ +angular.module('app').directive('slotDetails', function () { + return { + restrict: 'A', + scope:{ + c: '=', + lbl: '=', + opts: '=' + }, + templateUrl: 'views/slot.html' + }; +}); \ No newline at end of file diff --git a/app/js/shipyard/factory-components.js b/app/js/shipyard/factory-components.js index 52d8e529..1415bd61 100644 --- a/app/js/shipyard/factory-components.js +++ b/app/js/shipyard/factory-components.js @@ -1,29 +1,30 @@ -angular.module('shipyard').factory('components', ['lodash', 'commonMap','commonArray', function (_, CMap) { +angular.module('shipyard').factory('components', ['lodash', function (_) { var C = DB.components; function ComponentSet(shipId) { var ship = DB.ships[shipId]; - var maxInternal = ship.componentCapacity.internal[0]; + var maxInternal = ship.slotCap.internal[0]; this.mass = ship.mass; this.common = {}; this.internal = {}; - this.hardpoints = filter(C.hardpoints, ship.componentCapacity.hardpoints[0], 0, ship.mass); + this.hardpoints = filter(C.hardpoints, ship.slotCap.hardpoints[0], 0, ship.mass); this.bulkheads = C.bulkheads[shipId]; this.hpClass = {}; this.intClass = {}; for (var i = 0; i < C.common.length; i ++) { - var max = ship.componentCapacity.common[i]; + var max = ship.slotCap.common[i]; switch (i) { + // Slots where component class must be equal to slot class case 3: // Life Support case 5: // Sensors this.common[i] = filter(C.common[i], max, max, ship.mass); break; + // Other slots can have a component of class lower than the slot class default: this.common[i] = filter(C.common[i], max, 0, ship.mass); } - } for(var g in C.internal) { @@ -54,9 +55,7 @@ angular.module('shipyard').factory('components', ['lodash', 'commonMap','commonA function filter (data, maxClass, minClass, mass) { var set = {}; _.forEach(data, function (c,id) { - if (c.class <= maxClass && c.class >= minClass - && (c.maxmass === undefined || mass <= c.maxmass) ) { - //&& (c.minmass === undefined || mass >= c.minmass) ) { // Min mass needs fixed + if (c.class <= maxClass && c.class >= minClass && (c.maxmass === undefined || mass <= c.maxmass) ) { set[id] = c; } }); diff --git a/app/js/shipyard/factory-ship.js b/app/js/shipyard/factory-ship.js index 6365aa7b..fdb700f1 100644 --- a/app/js/shipyard/factory-ship.js +++ b/app/js/shipyard/factory-ship.js @@ -15,7 +15,7 @@ angular.module('shipyard').factory('ShipFactory', ['components', 'lodash', funct angular.forEach(shipData,function(o,k){ if(typeof o != 'object') { this[k] = o; - } else if (k == 'componentCapacity') { + } else if (k == 'slotCap') { angular.forEach(o,function(arr,g){ this[g] = []; for(var i = 0; i < arr.length; i++){ diff --git a/app/less/components.less b/app/less/components.less index b5888c8d..6c085187 100644 --- a/app/less/components.less +++ b/app/less/components.less @@ -1,5 +1,5 @@ -.component-group { +.slot-group { border: 2px solid @border; .border-radius(5px); margin: 5px; @@ -16,7 +16,7 @@ color: @warning; } - .component { + .slot { text-transform: uppercase; float: left; margin: 1%; @@ -24,7 +24,7 @@ .border-radius(2px); width: 250px; position: relative; - padding-top: 3px; + padding: 3px; color: #BBB; font-size: 0.8em; @@ -35,12 +35,10 @@ .lbl { float: left; - margin-left: 5px; } .cla { float: right; - margin-right: 5px; } .clear { diff --git a/app/less/list.less b/app/less/list.less index 4a090b68..658b1f53 100644 --- a/app/less/list.less +++ b/app/less/list.less @@ -6,7 +6,7 @@ float: left; .list-item { - cursor: pointer; + clear: both; overflow: hidden; margin: 3px 0px; @@ -28,6 +28,10 @@ color: grey; width: 300px; + .list-item { + cursor: pointer; + } + .enabled { color: #FFF; } @@ -42,6 +46,10 @@ color: #FFF; } + .consumer { + cursor: pointer; + } + .consumer.enabled { color: @fg; } diff --git a/app/less/ship.less b/app/less/ship.less index fa75592d..5c854a0a 100644 --- a/app/less/ship.less +++ b/app/less/ship.less @@ -18,7 +18,7 @@ } #standard { - width: 260px; + width: 265px; } #internal { diff --git a/app/views/power.html b/app/views/power.html index 6b7c9945..84d2f584 100644 --- a/app/views/power.html +++ b/app/views/power.html @@ -1,5 +1,8 @@ -