mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 06:43:24 +00:00
Additional auto-fill for SCB and other weapons
This commit is contained in:
@@ -260,6 +260,21 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
updateState(Serializer.fromShip(ship));
|
||||
};
|
||||
|
||||
$scope.fillWithCells = function() {
|
||||
var chargeCap = 0; // Capacity of single activation
|
||||
ship.internal.forEach(function(slot) {
|
||||
var id = Components.findInternalId('scb', slot.maxClass, 'A');
|
||||
if ((!slot.c || (slot.c.grp != 'sg' && slot.c.grp != 'psg')) && (!slot.eligible || slot.eligible.scb)) { // Check eligibility because of Orca, don't overwrite generator
|
||||
ship.use(slot, id, Components.internal(id));
|
||||
chargeCap += Components.internal(id).recharge;
|
||||
if (chargeCap >= ship.shieldStrength) {
|
||||
ship.setSlotEnabled(slot, false); // Don't waste cell capacity on overcharge
|
||||
}
|
||||
}
|
||||
});
|
||||
updateState(Serializer.fromShip(ship));
|
||||
};
|
||||
|
||||
/**
|
||||
* Fill all internal slots with Cargo Racks, and optmize internal components.
|
||||
* Hardpoints are not altered.
|
||||
|
||||
@@ -561,10 +561,18 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
var hps = this.hardpoints;
|
||||
for (var i = hps.length; i--; ) {
|
||||
if (hps[i].maxClass) {
|
||||
var component = Components.findHardpoint(group, hps[i].maxClass, null, null, mount);
|
||||
if (component) {
|
||||
this.use(hps[i], component.id, component);
|
||||
}
|
||||
var size = hps[i].maxClass, component;
|
||||
do {
|
||||
if (group == 'mr') {
|
||||
component = Components.findHardpoint(group, size, null, null, 'F', mount);
|
||||
} else {
|
||||
component = Components.findHardpoint(group, size, null, null, mount);
|
||||
}
|
||||
if (component) {
|
||||
this.use(hps[i], component.id, component);
|
||||
break;
|
||||
}
|
||||
} while (!component && (--size > 0));
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user