From 38b13fca27de3a81c5ec5bf5adb1554930d9eaf2 Mon Sep 17 00:00:00 2001 From: Kevin Chang Date: Thu, 8 Oct 2015 18:06:01 -0700 Subject: [PATCH] Add armor autofill, prevent internal fill clobber --- app/js/controllers/controller-outfit.js | 14 +++++++++++++- app/views/page-outfit.html | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/js/controllers/controller-outfit.js b/app/js/controllers/controller-outfit.js index dff4fed9..9501d566 100755 --- a/app/js/controllers/controller-outfit.js +++ b/app/js/controllers/controller-outfit.js @@ -255,7 +255,9 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', ' $scope.fillWithCargo = function() { ship.internal.forEach(function(slot) { var id = Components.findInternalId('cr', slot.maxClass, 'E'); - ship.use(slot, id, Components.internal(id)); + if (!slot.c) { + ship.use(slot, id, Components.internal(id)); + } }); updateState(Serializer.fromShip(ship)); }; @@ -273,6 +275,16 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', ' updateState(Serializer.fromShip(ship)); }; + $scope.fillWithArmor = function() { + ship.internal.forEach(function(slot) { + var id = Components.findInternalId('hr', slot.maxClass, 'D'); + if (!slot.c) { + ship.use(slot, id, Components.internal(id)); + } + }); + updateState(Serializer.fromShip(ship)); + }; + /** * Fill all internal slots with Cargo Racks, and optmize internal components. * Hardpoints are not altered. diff --git a/app/views/page-outfit.html b/app/views/page-outfit.html index 1ccee8f4..1ff61a15 100644 --- a/app/views/page-outfit.html +++ b/app/views/page-outfit.html @@ -217,6 +217,7 @@
  • +