mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-10 07:05:35 +00:00
A-rated uses largest eligible shield slot; dirty hacks rewritten
This commit is contained in:
@@ -175,28 +175,23 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Strip ship to A-class and A-class shield generator.
|
* Strip ship to A-class and biggest A-class shield generator with military bulkheads
|
||||||
*/
|
*/
|
||||||
$scope.aRatedBuild = function() {
|
$scope.aRatedBuild = function() {
|
||||||
ship.buildWith(data.defaults); // Reset build to default -- lazy hack to find shield slot
|
|
||||||
var sgSlot = 0;
|
|
||||||
var sgId = 0;
|
|
||||||
ship.internal.forEach(function(slot) {
|
|
||||||
// TODO: equip biggest A-rated shield in highest slot instead
|
|
||||||
if (slot.c && (slot.c.grp == 'sg')) {
|
|
||||||
sgSlot = ship.internal.indexOf(slot);
|
|
||||||
// Dirty hack using char decrement to get to A rated shield from default E
|
|
||||||
sgId = slot.c.id.charAt(0) + String.fromCharCode(slot.c.id.charCodeAt(1) - 4);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
for (var i = 0, l = ship.common.length - 1; i < l; i++) { // All except Fuel Tank
|
for (var i = 0, l = ship.common.length - 1; i < l; i++) { // All except Fuel Tank
|
||||||
var id = ship.common[i].maxClass + 'A';
|
var id = ship.common[i].maxClass + 'A';
|
||||||
ship.use(ship.common[i], id, Components.common(i, id));
|
ship.use(ship.common[i], id, Components.common(i, id));
|
||||||
}
|
}
|
||||||
ship.hardpoints.forEach(function(slot) { ship.use(slot, null, null); });
|
ship.hardpoints.forEach(function(slot) { ship.use(slot, null, null); });
|
||||||
ship.internal.forEach(function(slot) { ship.use(slot, null, null); });
|
ship.internal.forEach(function(slot) { ship.use(slot, null, null); });
|
||||||
ship.use(ship.internal[sgSlot], sgId, Components.internal(sgId));
|
ship.internal.some(function(slot) {
|
||||||
ship.useBulkhead(0);
|
if ('undefined' == typeof slot.eligible) { // Assuming largest slot can hold an eligible shield
|
||||||
|
var id = Components.findInternalId('Shield Generator', slot.maxClass, 'A');
|
||||||
|
ship.use(slot, id, Components.internal(id));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ship.useBulkhead(2);
|
||||||
updateState(Serializer.fromShip(ship));
|
updateState(Serializer.fromShip(ship));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user