Merge pull request #58 from shearn89/strip-ship

Adding in 'Strip Ship' functionality.
This commit is contained in:
Colin McLeod
2015-06-15 16:26:01 -07:00
2 changed files with 19 additions and 0 deletions

View File

@@ -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.

View File

@@ -16,6 +16,9 @@
<button ui-sref="outfit({shipId: ship.id,code:null, bn: buildName})" ng-disabled="!code">
<svg class="icon lg"><use xlink:href="#switch"></use></svg><span class="button-lbl">Reset</span>
</button>
<button ng-click="stripBuild()">
<svg class="icon lg"><use xlink:href="#spinner11"></use></svg><span class="button-lbl">Strip</span>
</button>
</div>
</div>