Fix issue putting 4A refinery in class 5 slot

This commit is contained in:
Cmdr McDonald
2017-03-15 11:45:52 +00:00
parent ec0cd37896
commit cd753af48e
2 changed files with 3 additions and 2 deletions

View File

@@ -7,6 +7,7 @@
* Fix issue where new module added to a slot did not reset its enabled status
* Show integrity value for relevant modules
* Reset old modification values when a new roll is applied
* Fix issue with miner role where refinery would not be present in ships with class 5 slots but no class 4
#2.2.19
* Power management panel now displays modules in descending order of power usage by default

View File

@@ -208,14 +208,14 @@ export function miner(ship, shielded) {
// Cargo hatch should be enabled
ship.setSlotEnabled(ship.cargoHatch, true);
// 4A or largest possible refinery
// Largest possible refinery
const refineryOrder = [4, 5, 6, 7, 8, 3, 2, 1];
const refineryInternals = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
.filter(a => (!a.eligible) || a.eligible.rf)
.sort((a,b) => refineryOrder.indexOf(a.maxClass) - refineryOrder.indexOf(b.maxClass));
for (let i = 0; i < refineryInternals.length; i++) {
if (canMount(ship, refineryInternals[i], 'rf')) {
ship.use(refineryInternals[i], ModuleUtils.findInternal('rf', refineryInternals[i].maxClass, 'A'));
ship.use(refineryInternals[i], ModuleUtils.findInternal('rf', Math.min(refineryInternals[i].maxClass, 4), 'A'));
usedSlots.push(refineryInternals[i]);
break;
}