From 1c0b76a8c29c3233b88b7f16e5d8f0f161d87ac2 Mon Sep 17 00:00:00 2001 From: Alex Shearn Date: Mon, 15 Jun 2015 20:07:13 +0100 Subject: [PATCH] Adding in 'Strip Ship' functionality. This commit adds a simple button next to the save/reload icons that strips the ship to maximum class, D-rated modules, and no optional modules. Still needs a custom icon! May try to add in future things like 'all cargo' or 'fill empty with...' options. --- app/js/controllers/controller-outfit.js | 16 ++++++++++++++++ app/views/page-outfit.html | 3 +++ 2 files changed, 19 insertions(+) diff --git a/app/js/controllers/controller-outfit.js b/app/js/controllers/controller-outfit.js index 1e3e71d5..782a07a2 100755 --- a/app/js/controllers/controller-outfit.js +++ b/app/js/controllers/controller-outfit.js @@ -116,6 +116,22 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', ' } }; + /** + * Strip ship to D-class and no other components. + */ + $scope.stripBuild = function() { + angular.forEach(ship.common, function(slot,i) { + id = slot.maxClass+'D'; + ship.use(slot, id, Components.common(ship.common.indexOf(slot), id)); + }); + angular.forEach(ship.hardpoints, function(slot,i) { + ship.use(slot, null, null); + }); + angular.forEach(ship.internal, function(slot,i) { + ship.use(slot, null, null); + }); + }; + /** * Save the current build. Will replace the saved build if there is one * for this ship & with the exact name. diff --git a/app/views/page-outfit.html b/app/views/page-outfit.html index 4bbceeb0..c86d6bf2 100644 --- a/app/views/page-outfit.html +++ b/app/views/page-outfit.html @@ -3,6 +3,9 @@

+