diff --git a/package-lock.json b/package-lock.json
index 4770cf04..6dc12b01 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "coriolis_shipyard",
- "version": "2.5.1",
+ "version": "2.5.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index fc28b4c8..594296ed 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "coriolis_shipyard",
- "version": "2.5.2",
+ "version": "2.5.3",
"repository": {
"type": "git",
"url": "https://github.com/EDCD/coriolis"
diff --git a/src/app/components/ShipSummaryTable.jsx b/src/app/components/ShipSummaryTable.jsx
index 41deed29..c2e0dec2 100644
--- a/src/app/components/ShipSummaryTable.jsx
+++ b/src/app/components/ShipSummaryTable.jsx
@@ -53,6 +53,7 @@ export default class ShipSummaryTable extends TranslatedComponent {
{translate('TTD')} |
{/* {translate('HPS')} | */}
{translate('cargo')} |
+ {translate('passengers')} |
{translate('fuel')} |
{translate('mass')} |
{translate('hrd')} |
@@ -86,6 +87,7 @@ export default class ShipSummaryTable extends TranslatedComponent {
{timeToDrain === Infinity ? '∞' : time(timeToDrain)} |
{/* {f1(ship.totalHps)} | */}
{round(ship.cargoCapacity)}{u.T} |
+ {ship.passengerCapacity} |
{round(ship.fuelCapacity)}{u.T} |
{ship.hullMass}{u.T} |
{int(ship.unladenMass)}{u.T} |
diff --git a/src/app/components/StandardSlotSection.jsx b/src/app/components/StandardSlotSection.jsx
index cba5511f..566478f2 100644
--- a/src/app/components/StandardSlotSection.jsx
+++ b/src/app/components/StandardSlotSection.jsx
@@ -235,12 +235,10 @@ export default class StandardSlotSection extends SlotSection {
- {translate('Multi-purpose')}
- {translate('Combat')}
- - {translate('Trader')}
- - {translate('Shielded Trader')}
+ - {translate('Trader')}
- {translate('Explorer')}
- {translate('Planetary Explorer')}
- - {translate('Miner')}
- - {translate('Shielded Miner')}
+ - {translate('Miner')}
- {translate('Racer')}
;
diff --git a/src/app/pages/ShipyardPage.jsx b/src/app/pages/ShipyardPage.jsx
index fe756a90..5debd8bd 100644
--- a/src/app/pages/ShipyardPage.jsx
+++ b/src/app/pages/ShipyardPage.jsx
@@ -42,7 +42,7 @@ function countInt(slot) {
passSlotType = 'pcq';
passSlotRating = 'B';
}
- let passengerBay = passSlotType ? ModuleUtils.findInternal(passSlotType, slot.maxClass, passSlotRating) : null;
+ let passengerBay = passSlotType ? ModuleUtils.findMaxInternal(passSlotType, slot.maxClass, passSlotRating) : null;
this.maxPassengers += passengerBay ? passengerBay.passengers : 0;
}
diff --git a/src/app/shipyard/ModuleUtils.js b/src/app/shipyard/ModuleUtils.js
index cde26352..e913fce4 100755
--- a/src/app/shipyard/ModuleUtils.js
+++ b/src/app/shipyard/ModuleUtils.js
@@ -195,6 +195,29 @@ export function findInternal(groupName, clss, rating, name) {
return null;
}
+/**
+ * Finds an internal module based on Class, Rating, Group and/or name.
+ * At least one of Group name or unique module name must be provided.
+ * will start searching at specified class and proceed lower until a
+ * module is found or 0 is hit
+ * Uses findInternal internally
+ *
+ * @param {String} groupName [Optional] Full name or abbreviated name for module group
+ * @param {integer} clss module Class
+ * @param {String} rating module Rating
+ * @param {String} name [Optional] Long/unique name for module -e.g. 'Advanced Discover Scanner'
+ * @return {Object} The module if found, null if not found
+ */
+export function findMaxInternal(groupName, clss, rating, name) {
+ let foundModule = null;
+ let currentClss = clss;
+ while (currentClss > 0 && foundModule == null) {
+ foundModule = findInternal(groupName, currentClss, rating, name);
+ currentClss = currentClss - 1;
+ }
+ return foundModule;
+}
+
/**
* Finds an internal Module ID based on Class, Rating, Group and/or name.
* At least one ofGroup name or unique module name must be provided
diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js
index ed4baa42..eddafc19 100755
--- a/src/app/shipyard/Ship.js
+++ b/src/app/shipyard/Ship.js
@@ -569,6 +569,7 @@ export default class Ship {
// Reset Cumulative stats
this.fuelCapacity = 0;
this.cargoCapacity = 0;
+ this.passengerCapacity = 0;
this.ladenMass = 0;
this.armour = this.baseArmour;
this.shield = this.baseShieldStrength;
@@ -1188,6 +1189,7 @@ export default class Ship {
let unladenMass = this.hullMass;
let cargoCapacity = 0;
let fuelCapacity = 0;
+ let passengerCapacity = 0;
unladenMass += this.bulkheads.m.getMass();
@@ -1209,6 +1211,8 @@ export default class Ship {
fuelCapacity += slot.m.fuel;
} else if (slot.m.grp === 'cr') {
cargoCapacity += slot.m.cargo;
+ } else if (slot.m.grp.slice(0,2) === 'pc') {
+ passengerCapacity += slot.m.passengers
}
}
}
@@ -1224,6 +1228,7 @@ export default class Ship {
this.unladenMass = unladenMass;
this.cargoCapacity = cargoCapacity;
this.fuelCapacity = fuelCapacity;
+ this.passengerCapacity = passengerCapacity;
this.ladenMass = unladenMass + fuelCapacity + cargoCapacity;
return this;
diff --git a/src/app/shipyard/ShipRoles.js b/src/app/shipyard/ShipRoles.js
index bb2f0a38..69e35fa1 100644
--- a/src/app/shipyard/ShipRoles.js
+++ b/src/app/shipyard/ShipRoles.js
@@ -1,5 +1,5 @@
-import * as ModuleUtils from './ModuleUtils';
-import { canMount } from '../utils/SlotFunctions';
+import * as ModuleUtils from './ModuleUtils'
+import { canMount } from '../utils/SlotFunctions'
/**
* Standard / typical role for multi-purpose or combat (if shielded with better bulkheads)
@@ -7,20 +7,20 @@ import { canMount } from '../utils/SlotFunctions';
* @param {Boolean} shielded True if shield generator should be included
* @param {integer} bulkheadIndex Bulkhead to use see Constants.BulkheadNames
*/
-export function multiPurpose(ship, shielded, bulkheadIndex) {
+export function multiPurpose (ship, shielded, bulkheadIndex) {
ship.useStandard('A')
- .use(ship.standard[3], ModuleUtils.standard(3, ship.standard[3].maxClass + 'D')) // D Life Support
- .use(ship.standard[5], ModuleUtils.standard(5, ship.standard[5].maxClass + 'D')) // D Sensors
- .useBulkhead(bulkheadIndex);
+ .use(ship.standard[3], ModuleUtils.standard(3, ship.standard[3].maxClass + 'D')) // D Life Support
+ .use(ship.standard[5], ModuleUtils.standard(5, ship.standard[5].maxClass + 'D')) // D Sensors
+ .useBulkhead(bulkheadIndex)
if (shielded) {
- ship.internal.some(function(slot) {
+ ship.internal.some(function (slot) {
if (canMount(ship, slot, 'sg')) { // Assuming largest slot can hold an eligible shield
- ship.use(slot, ModuleUtils.findInternal('sg', slot.maxClass, 'A'));
- ship.setSlotEnabled(slot, true);
- return true;
+ ship.use(slot, ModuleUtils.findInternal('sg', slot.maxClass, 'A'))
+ ship.setSlotEnabled(slot, true)
+ return true
}
- });
+ })
}
}
@@ -30,40 +30,55 @@ export function multiPurpose(ship, shielded, bulkheadIndex) {
* @param {Boolean} shielded True if shield generator should be included
* @param {Object} standardOpts [Optional] Standard module optional overrides
*/
-export function trader(ship, shielded, standardOpts) {
- let usedSlots = [],
- sg = ship.getAvailableModules().lightestShieldGenerator(ship.hullMass);
-
- // Shield generator if required
- if (shielded) {
- const shieldOrder = [1, 2, 3, 4, 5, 6, 7, 8];
- const shieldInternals = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
- .filter(a => (!a.eligible) || a.eligible.sg)
- .filter(a => a.maxClass >= sg.class)
- .sort((a,b) => shieldOrder.indexOf(a.maxClass) - shieldOrder.indexOf(b.maxClass));
- for (let i = 0; i < shieldInternals.length; i++) {
- if (canMount(ship, shieldInternals[i], 'sg')) {
- ship.use(shieldInternals[i], sg);
- usedSlots.push(shieldInternals[i]);
- break;
+export function trader (ship, shielded, standardOpts) {
+ let usedSlots = []
+ let bstCount = 2
+ let sg = ship.getAvailableModules().lightestShieldGenerator(ship.hullMass)
+ ship.useStandard('A')
+ .use(ship.standard[3], ModuleUtils.standard(3, ship.standard[3].maxClass + 'D')) // D Life Support
+ .use(ship.standard[1], ModuleUtils.standard(1, ship.standard[1].maxClass + 'D')) // D Life Support
+ .use(ship.standard[4], ModuleUtils.standard(4, ship.standard[4].maxClass + 'D')) // D Life Support
+ .use(ship.standard[5], ModuleUtils.standard(5, ship.standard[5].maxClass + 'D')) // D Sensors
+
+ const shieldOrder = [1, 2, 3, 4, 5, 6, 7, 8]
+ const shieldInternals = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
+ .filter(a => (!a.eligible) || a.eligible.sg)
+ .filter(a => a.maxClass >= sg.class)
+ .sort((a, b) => shieldOrder.indexOf(a.maxClass) - shieldOrder.indexOf(b.maxClass))
+ shieldInternals.some(function (slot) {
+ if (canMount(ship, slot, 'sg')) { // Assuming largest slot can hold an eligible shield
+ const shield = ModuleUtils.findInternal('sg', slot.maxClass, 'A')
+ if (shield && shield.maxmass > ship.hullMass) {
+ console.log(shield)
+ ship.use(slot, shield)
+ ship.setSlotEnabled(slot, true)
+ usedSlots.push(slot)
+ return true
}
}
- }
+ })
// Fill the empty internals with cargo racks
for (let i = ship.internal.length; i--;) {
- let slot = ship.internal[i];
+ let slot = ship.internal[i]
if (usedSlots.indexOf(slot) == -1 && canMount(ship, slot, 'cr')) {
- ship.use(slot, ModuleUtils.findInternal('cr', slot.maxClass, 'E'));
+ ship.use(slot, ModuleUtils.findInternal('cr', slot.maxClass, 'E'))
}
}
// Empty the hardpoints
for (let s of ship.hardpoints) {
- ship.use(s, null);
+ ship.use(s, null)
}
-
- ship.useLightestStandard(standardOpts);
+ for (let s of ship.hardpoints) {
+ if (s.maxClass == 0 && bstCount) { // Mount up to 2 boosters
+ ship.use(s, ModuleUtils.hardpoints('04'))
+ bstCount--
+ } else {
+ ship.use(s, null)
+ }
+ }
+ // ship.useLightestStandard(standardOpts);
}
/**
@@ -71,127 +86,127 @@ export function trader(ship, shielded, standardOpts) {
* @param {Ship} ship Ship instance
* @param {Boolean} planetary True if Planetary Vehicle Hangar (PVH) should be included
*/
-export function explorer(ship, planetary) {
- let standardOpts = { ppRating: 'A' },
- heatSinkCount = 2, // Fit 2 heat sinks if possible
- usedSlots = [],
- sgSlot,
- fuelScoopSlot,
- sg = ship.getAvailableModules().lightestShieldGenerator(ship.hullMass);
+export function explorer (ship, planetary) {
+ let standardOpts = {ppRating: 'A'},
+ heatSinkCount = 2, // Fit 2 heat sinks if possible
+ usedSlots = [],
+ sgSlot,
+ fuelScoopSlot,
+ sg = ship.getAvailableModules().lightestShieldGenerator(ship.hullMass)
if (!planetary) { // Non-planetary explorers don't really need to boost
- standardOpts.pd = '1D';
+ standardOpts.pd = '1D'
}
// Cargo hatch can be disabled
- ship.setSlotEnabled(ship.cargoHatch, false);
+ ship.setSlotEnabled(ship.cargoHatch, false)
// Advanced Discovery Scanner - class 1 or higher
- const adsOrder = [1, 2, 3, 4, 5, 6, 7, 8];
+ const adsOrder = [1, 2, 3, 4, 5, 6, 7, 8]
const adsInternals = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
- .filter(a => (!a.eligible) || a.eligible.sc)
- .sort((a,b) => adsOrder.indexOf(a.maxClass) - adsOrder.indexOf(b.maxClass));
+ .filter(a => (!a.eligible) || a.eligible.sc)
+ .sort((a, b) => adsOrder.indexOf(a.maxClass) - adsOrder.indexOf(b.maxClass))
for (let i = 0; i < adsInternals.length; i++) {
if (canMount(ship, adsInternals[i], 'sc')) {
- ship.use(adsInternals[i], ModuleUtils.internal('2f'));
- usedSlots.push(adsInternals[i]);
- break;
+ ship.use(adsInternals[i], ModuleUtils.internal('2f'))
+ usedSlots.push(adsInternals[i])
+ break
}
}
if (planetary) {
// Planetary Vehicle Hangar - class 2 or higher
- const pvhOrder = [2, 3, 4, 5, 6, 7, 8, 1];
+ const pvhOrder = [2, 3, 4, 5, 6, 7, 8, 1]
const pvhInternals = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
- .filter(a => (!a.eligible) || a.eligible.pv)
- .sort((a,b) => pvhOrder.indexOf(a.maxClass) - pvhOrder.indexOf(b.maxClass));
+ .filter(a => (!a.eligible) || a.eligible.pv)
+ .sort((a, b) => pvhOrder.indexOf(a.maxClass) - pvhOrder.indexOf(b.maxClass))
for (let i = 0; i < pvhInternals.length; i++) {
if (canMount(ship, pvhInternals[i], 'pv')) {
// Planetary Vehical Hangar only has even classes
- const pvhClass = pvhInternals[i].maxClass % 2 === 1 ? pvhInternals[i].maxClass - 1 : pvhInternals[i].maxClass;
- ship.use(pvhInternals[i], ModuleUtils.findInternal('pv', pvhClass, 'G')); // G is lower mass
- ship.setSlotEnabled(pvhInternals[i], false); // Disable power for Planetary Vehical Hangar
- usedSlots.push(pvhInternals[i]);
- break;
+ const pvhClass = pvhInternals[i].maxClass % 2 === 1 ? pvhInternals[i].maxClass - 1 : pvhInternals[i].maxClass
+ ship.use(pvhInternals[i], ModuleUtils.findInternal('pv', pvhClass, 'G')) // G is lower mass
+ ship.setSlotEnabled(pvhInternals[i], false) // Disable power for Planetary Vehical Hangar
+ usedSlots.push(pvhInternals[i])
+ break
}
}
}
// Shield generator
- const shieldOrder = [1, 2, 3, 4, 5, 6, 7, 8];
+ const shieldOrder = [1, 2, 3, 4, 5, 6, 7, 8]
const shieldInternals = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
- .filter(a => (!a.eligible) || a.eligible.sg)
- .filter(a => a.maxClass >= sg.class)
- .sort((a,b) => shieldOrder.indexOf(a.maxClass) - shieldOrder.indexOf(b.maxClass));
+ .filter(a => (!a.eligible) || a.eligible.sg)
+ .filter(a => a.maxClass >= sg.class)
+ .sort((a, b) => shieldOrder.indexOf(a.maxClass) - shieldOrder.indexOf(b.maxClass))
for (let i = 0; i < shieldInternals.length; i++) {
if (canMount(ship, shieldInternals[i], 'sg')) {
- ship.use(shieldInternals[i], sg);
- usedSlots.push(shieldInternals[i]);
- sgSlot = shieldInternals[i];
- break;
+ ship.use(shieldInternals[i], sg)
+ usedSlots.push(shieldInternals[i])
+ sgSlot = shieldInternals[i]
+ break
}
}
// Detailed Surface Scanner
- const dssOrder = [1, 2, 3, 4, 5, 6, 7, 8];
+ const dssOrder = [1, 2, 3, 4, 5, 6, 7, 8]
const dssInternals = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
- .filter(a => (!a.eligible) || a.eligible.sc)
- .sort((a,b) => dssOrder.indexOf(a.maxClass) - dssOrder.indexOf(b.maxClass));
+ .filter(a => (!a.eligible) || a.eligible.sc)
+ .sort((a, b) => dssOrder.indexOf(a.maxClass) - dssOrder.indexOf(b.maxClass))
for (let i = 0; i < dssInternals.length; i++) {
if (canMount(ship, dssInternals[i], 'sc')) {
- ship.use(dssInternals[i], ModuleUtils.internal('2i'));
- usedSlots.push(dssInternals[i]);
- break;
+ ship.use(dssInternals[i], ModuleUtils.internal('2i'))
+ usedSlots.push(dssInternals[i])
+ break
}
}
// Fuel scoop - best possible
- const fuelScoopOrder = [8, 7, 6, 5, 4, 3, 2, 1];
+ const fuelScoopOrder = [8, 7, 6, 5, 4, 3, 2, 1]
const fuelScoopInternals = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
- .filter(a => (!a.eligible) || a.eligible.fs)
- .sort((a,b) => fuelScoopOrder.indexOf(a.maxClass) - fuelScoopOrder.indexOf(b.maxClass));
+ .filter(a => (!a.eligible) || a.eligible.fs)
+ .sort((a, b) => fuelScoopOrder.indexOf(a.maxClass) - fuelScoopOrder.indexOf(b.maxClass))
for (let i = 0; i < fuelScoopInternals.length; i++) {
if (canMount(ship, fuelScoopInternals[i], 'fs')) {
- ship.use(fuelScoopInternals[i], ModuleUtils.findInternal('fs', fuelScoopInternals[i].maxClass, 'A'));
- usedSlots.push(fuelScoopInternals[i]);
- fuelScoopSlot = fuelScoopInternals[i];
- break;
+ ship.use(fuelScoopInternals[i], ModuleUtils.findInternal('fs', fuelScoopInternals[i].maxClass, 'A'))
+ usedSlots.push(fuelScoopInternals[i])
+ fuelScoopSlot = fuelScoopInternals[i]
+ break
}
}
// AFMUs - fill as they are 0-weight
- const afmuOrder = [8, 7, 6, 5, 4, 3, 2, 1];
+ const afmuOrder = [8, 7, 6, 5, 4, 3, 2, 1]
const afmuInternals = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
- .filter(a => (!a.eligible) || a.eligible.pc)
- .sort((a,b) => afmuOrder.indexOf(a.maxClass) - afmuOrder.indexOf(b.maxClass));
+ .filter(a => (!a.eligible) || a.eligible.pc)
+ .sort((a, b) => afmuOrder.indexOf(a.maxClass) - afmuOrder.indexOf(b.maxClass))
for (let i = 0; i < afmuInternals.length; i++) {
if (canMount(ship, afmuInternals[i], 'am')) {
- ship.use(afmuInternals[i], ModuleUtils.findInternal('am', afmuInternals[i].maxClass, 'A'));
- usedSlots.push(afmuInternals[i]);
- ship.setSlotEnabled(afmuInternals[i], false); // Disable power for AFM Unit
+ ship.use(afmuInternals[i], ModuleUtils.findInternal('am', afmuInternals[i].maxClass, 'A'))
+ usedSlots.push(afmuInternals[i])
+ ship.setSlotEnabled(afmuInternals[i], false) // Disable power for AFM Unit
}
}
for (let s of ship.hardpoints) {
if (s.maxClass == 0 && heatSinkCount) { // Mount up to 2 heatsinks
- ship.use(s, ModuleUtils.hardpoints('02'));
- ship.setSlotEnabled(s, heatSinkCount == 2); // Only enable a single Heatsink
- heatSinkCount--;
+ ship.use(s, ModuleUtils.hardpoints('02'))
+ ship.setSlotEnabled(s, heatSinkCount == 2) // Only enable a single Heatsink
+ heatSinkCount--
} else {
- ship.use(s, null);
+ ship.use(s, null)
}
}
if (sgSlot && fuelScoopSlot) {
// The SG and Fuel scoop to not need to be powered at the same time
if (sgSlot.m.getPowerUsage() > fuelScoopSlot.m.getPowerUsage()) { // The Shield generator uses the most power
- ship.setSlotEnabled(fuelScoopSlot, false);
+ ship.setSlotEnabled(fuelScoopSlot, false)
} else { // The Fuel scoop uses the most power
- ship.setSlotEnabled(sgSlot, false);
+ ship.setSlotEnabled(sgSlot, false)
}
}
- ship.useLightestStandard(standardOpts);
+ ship.useLightestStandard(standardOpts)
}
/**
@@ -199,187 +214,188 @@ export function explorer(ship, planetary) {
* @param {Ship} ship Ship instance
* @param {Boolean} shielded True if shield generator should be included
*/
-export function miner(ship, shielded) {
- let standardOpts = { ppRating: 'A' },
- miningLaserCount = 2,
- usedSlots = [],
- sg = ship.getAvailableModules().lightestShieldGenerator(ship.hullMass);
+export function miner (ship, shielded) {
+ shielded = true
+ let standardOpts = {ppRating: 'A'},
+ miningLaserCount = 2,
+ usedSlots = [],
+ sg = ship.getAvailableModules().lightestShieldGenerator(ship.hullMass)
// Cargo hatch should be enabled
- ship.setSlotEnabled(ship.cargoHatch, true);
+ ship.setSlotEnabled(ship.cargoHatch, true)
// Largest possible refinery
- const refineryOrder = [4, 5, 6, 7, 8, 3, 2, 1];
+ 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));
+ .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', Math.min(refineryInternals[i].maxClass, 4), 'A'));
- usedSlots.push(refineryInternals[i]);
- break;
+ ship.use(refineryInternals[i], ModuleUtils.findInternal('rf', Math.min(refineryInternals[i].maxClass, 4), 'A'))
+ usedSlots.push(refineryInternals[i])
+ break
}
}
// Prospector limpet controller - 3A if possible
- const prospectorOrder = [3, 4, 5, 6, 7, 8, 2, 1];
+ const prospectorOrder = [3, 4, 5, 6, 7, 8, 2, 1]
const prospectorInternals = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
- .filter(a => (!a.eligible) || a.eligible.pc)
- .sort((a,b) => prospectorOrder.indexOf(a.maxClass) - prospectorOrder.indexOf(b.maxClass));
+ .filter(a => (!a.eligible) || a.eligible.pc)
+ .sort((a, b) => prospectorOrder.indexOf(a.maxClass) - prospectorOrder.indexOf(b.maxClass))
for (let i = 0; i < prospectorInternals.length; i++) {
if (canMount(ship, prospectorInternals[i], 'pc')) {
// Prospector only has odd classes
- const prospectorClass = prospectorInternals[i].maxClass % 2 === 0 ? prospectorInternals[i].maxClass - 1 : prospectorInternals[i].maxClass;
- ship.use(prospectorInternals[i], ModuleUtils.findInternal('pc', prospectorClass, 'A'));
- usedSlots.push(prospectorInternals[i]);
- break;
+ const prospectorClass = prospectorInternals[i].maxClass % 2 === 0 ? prospectorInternals[i].maxClass - 1 : prospectorInternals[i].maxClass
+ ship.use(prospectorInternals[i], ModuleUtils.findInternal('pc', prospectorClass, 'A'))
+ usedSlots.push(prospectorInternals[i])
+ break
}
}
// Shield generator if required
if (shielded) {
- const shieldOrder = [1, 2, 3, 4, 5, 6, 7, 8];
+ const shieldOrder = [1, 2, 3, 4, 5, 6, 7, 8]
const shieldInternals = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
- .filter(a => (!a.eligible) || a.eligible.sg)
- .filter(a => a.maxClass >= sg.class)
- .sort((a,b) => shieldOrder.indexOf(a.maxClass) - shieldOrder.indexOf(b.maxClass));
+ .filter(a => (!a.eligible) || a.eligible.sg)
+ .filter(a => a.maxClass >= sg.class)
+ .sort((a, b) => shieldOrder.indexOf(a.maxClass) - shieldOrder.indexOf(b.maxClass))
for (let i = 0; i < shieldInternals.length; i++) {
if (canMount(ship, shieldInternals[i], 'sg')) {
- ship.use(shieldInternals[i], sg);
- usedSlots.push(shieldInternals[i]);
- break;
+ ship.use(shieldInternals[i], sg)
+ usedSlots.push(shieldInternals[i])
+ break
}
}
}
// Dual mining lasers of highest possible class; remove anything else
- const miningLaserOrder = [2, 3, 4, 1, 0];
- const miningLaserHardpoints = ship.hardpoints.concat().sort(function(a,b) {
- return miningLaserOrder.indexOf(a.maxClass) - miningLaserOrder.indexOf(b.maxClass);
- });
+ const miningLaserOrder = [2, 3, 4, 1, 0]
+ const miningLaserHardpoints = ship.hardpoints.concat().sort(function (a, b) {
+ return miningLaserOrder.indexOf(a.maxClass) - miningLaserOrder.indexOf(b.maxClass)
+ })
for (let s of miningLaserHardpoints) {
if (s.maxClass >= 1 && miningLaserCount) {
- ship.use(s, ModuleUtils.hardpoints(s.maxClass >= 2 ? '2m' : '2l'));
- miningLaserCount--;
+ ship.use(s, ModuleUtils.hardpoints(s.maxClass >= 2 ? '2m' : '2l'))
+ miningLaserCount--
} else {
- ship.use(s, null);
+ ship.use(s, null)
}
}
// Number of collector limpets required to be active is a function of the size of the ship and the power of the lasers
const miningLaserDps = ship.hardpoints.filter(h => h.m != null)
- .reduce(function(a, b) {
- return a + b.m.getDps();
- }, 0);
+ .reduce(function (a, b) {
+ return a + b.m.getDps()
+ }, 0)
// Find out how many internal slots we have, and their potential cargo size
const potentialCargo = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
- .filter(a => (!a.eligible) || a.eligible.cr)
- .map(b => Math.pow(2, b.maxClass));
+ .filter(a => (!a.eligible) || a.eligible.cr)
+ .map(b => Math.pow(2, b.maxClass))
// One collector for each 1.25 DPS, multiply by 1.25 for medium ships and 1.5 for large ships as they have further to travel
// 0 if we only have 1 cargo slot, otherwise minium of 1 and maximum of 6 (excluding size modifier)
- const sizeModifier = ship.class == 2 ? 1.2 : ship.class == 3 ? 1.5 : 1;
- let collectorLimpetsRequired = potentialCargo.length == 1 ? 0 : Math.ceil(sizeModifier * Math.min(6, Math.floor(miningLaserDps / 1.25)));
-
+ const sizeModifier = ship.class == 2 ? 1.2 : ship.class == 3 ? 1.5 : 1
+ let collectorLimpetsRequired = potentialCargo.length == 1 ? 0 : Math.ceil(sizeModifier * Math.min(6, Math.floor(miningLaserDps / 1.25)))
+
if (collectorLimpetsRequired > 0) {
- const collectorOrder = [1, 2, 3, 4, 5, 6, 7, 8];
+ const collectorOrder = [1, 2, 3, 4, 5, 6, 7, 8]
const collectorInternals = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
- .filter(a => (!a.eligible) || a.eligible.cc)
- .sort((a,b) => collectorOrder.indexOf(a.maxClass) - collectorOrder.indexOf(b.maxClass));
+ .filter(a => (!a.eligible) || a.eligible.cc)
+ .sort((a, b) => collectorOrder.indexOf(a.maxClass) - collectorOrder.indexOf(b.maxClass))
// Always keep at least 2 slots free for cargo racks (1 for shielded)
for (let i = 0; i < collectorInternals.length - (shielded ? 1 : 2) && collectorLimpetsRequired > 0; i++) {
if (canMount(ship, collectorInternals[i], 'cc')) {
// Collector only has odd classes
- const collectorClass = collectorInternals[i].maxClass % 2 === 0 ? collectorInternals[i].maxClass - 1 : collectorInternals[i].maxClass;
- ship.use(collectorInternals[i], ModuleUtils.findInternal('cc', collectorClass, 'D'));
- usedSlots.push(collectorInternals[i]);
- collectorLimpetsRequired -= collectorInternals[i].m.maximum;
+ const collectorClass = collectorInternals[i].maxClass % 2 === 0 ? collectorInternals[i].maxClass - 1 : collectorInternals[i].maxClass
+ ship.use(collectorInternals[i], ModuleUtils.findInternal('cc', collectorClass, 'D'))
+ usedSlots.push(collectorInternals[i])
+ collectorLimpetsRequired -= collectorInternals[i].m.maximum
}
}
}
// Power distributor to power the mining lasers indefinitely
const wepRateRequired = ship.hardpoints.filter(h => h.m != null)
- .reduce(function(a, b) {
- return a + b.m.getEps();
- }, 0);
- standardOpts.pd = ship.getAvailableModules().matchingPowerDist({ weprate: wepRateRequired }).id;
+ .reduce(function (a, b) {
+ return a + b.m.getEps()
+ }, 0)
+ standardOpts.pd = ship.getAvailableModules().matchingPowerDist({weprate: wepRateRequired}).id
// Fill the empty internals with cargo racks
for (let i = ship.internal.length; i--;) {
- let slot = ship.internal[i];
+ let slot = ship.internal[i]
if (usedSlots.indexOf(slot) == -1 && canMount(ship, slot, 'cr')) {
- ship.use(slot, ModuleUtils.findInternal('cr', slot.maxClass, 'E'));
+ ship.use(slot, ModuleUtils.findInternal('cr', slot.maxClass, 'E'))
}
}
- ship.useLightestStandard(standardOpts);
+ ship.useLightestStandard(standardOpts)
}
/**
* Racer Role
* @param {Ship} ship Ship instance
*/
-export function racer(ship) {
+export function racer (ship) {
let standardOpts = {},
- usedSlots = [],
- sgSlot,
- sg = ship.getAvailableModules().lightestShieldGenerator(ship.hullMass);
+ usedSlots = [],
+ sgSlot,
+ sg = ship.getAvailableModules().lightestShieldGenerator(ship.hullMass)
// Cargo hatch can be disabled
- ship.setSlotEnabled(ship.cargoHatch, false);
+ ship.setSlotEnabled(ship.cargoHatch, false)
// Shield generator
- const shieldOrder = [1, 2, 3, 4, 5, 6, 7, 8];
+ const shieldOrder = [1, 2, 3, 4, 5, 6, 7, 8]
const shieldInternals = ship.internal.filter(a => usedSlots.indexOf(a) == -1)
- .filter(a => (!a.eligible) || a.eligible.sg)
- .filter(a => a.maxClass >= sg.class)
- .sort((a,b) => shieldOrder.indexOf(a.maxClass) - shieldOrder.indexOf(b.maxClass));
+ .filter(a => (!a.eligible) || a.eligible.sg)
+ .filter(a => a.maxClass >= sg.class)
+ .sort((a, b) => shieldOrder.indexOf(a.maxClass) - shieldOrder.indexOf(b.maxClass))
for (let i = 0; i < shieldInternals.length; i++) {
if (canMount(ship, shieldInternals[i], 'sg')) {
- ship.use(shieldInternals[i], sg);
- usedSlots.push(shieldInternals[i]);
- sgSlot = shieldInternals[i];
- break;
+ ship.use(shieldInternals[i], sg)
+ usedSlots.push(shieldInternals[i])
+ sgSlot = shieldInternals[i]
+ break
}
}
// Empty the hardpoints
for (let s of ship.hardpoints) {
- ship.use(s, null);
+ ship.use(s, null)
}
// Empty the internals
for (let i = ship.internal.length; i--;) {
- let slot = ship.internal[i];
+ let slot = ship.internal[i]
if (usedSlots.indexOf(slot) == -1) {
- ship.use(slot, null);
+ ship.use(slot, null)
}
}
// Best thrusters
if (ship.standard[1].maxClass === 3) {
- standardOpts.th = 'tz';
+ standardOpts.th = 'tz'
} else if (ship.standard[1].maxClass === 2) {
- standardOpts.th = 'u0';
+ standardOpts.th = 'u0'
} else {
- standardOpts.th = ship.standard[1].maxClass + 'A';
+ standardOpts.th = ship.standard[1].maxClass + 'A'
}
// Best power distributor for more boosting
- standardOpts.pd = ship.standard[4].maxClass + 'A';
+ standardOpts.pd = ship.standard[4].maxClass + 'A'
// Smallest possible FSD drive
- standardOpts.fsd = '2D';
+ standardOpts.fsd = '2D'
// Minimal fuel tank
- standardOpts.ft = '1C';
+ standardOpts.ft = '1C'
// Disable nearly everything
- standardOpts.fsdDisabled = true;
- standardOpts.sDisabled = true;
- standardOpts.pdDisabled = true;
- standardOpts.lsDisabled = true;
+ standardOpts.fsdDisabled = true
+ standardOpts.sDisabled = true
+ standardOpts.pdDisabled = true
+ standardOpts.lsDisabled = true
- ship.useLightestStandard(standardOpts);
+ ship.useLightestStandard(standardOpts)
// Apply engineering to each module
// ship.standard[1].m.blueprint = getBlueprint('Engine_Dirty', ship.standard[0]);
diff --git a/src/app/utils/JournalUtils.js b/src/app/utils/JournalUtils.js
index 9498858d..23a91baa 100644
--- a/src/app/utils/JournalUtils.js
+++ b/src/app/utils/JournalUtils.js
@@ -2,7 +2,7 @@ import Ship from '../shipyard/Ship'
import { HARDPOINT_NUM_TO_CLASS, shipModelFromJson } from './CompanionApiUtils'
import { Ships } from 'coriolis-data/dist'
import Module from '../shipyard/Module'
-import { Modules } from '../../../../coriolis-data/dist'
+import { Modules } from 'coriolis-data/dist'
/**
* Obtain a module given its FD Name
diff --git a/src/index.ejs b/src/index.ejs
index fd136116..6ea611aa 100644
--- a/src/index.ejs
+++ b/src/index.ejs
@@ -57,7 +57,7 @@
+ data-apikey="ba9fae819372850fb660755341fa6ef5">
diff --git a/webpack.config.dev.js b/webpack.config.dev.js
index e9fdde54..f103cff3 100644
--- a/webpack.config.dev.js
+++ b/webpack.config.dev.js
@@ -18,7 +18,7 @@ CopyDirPlugin.prototype.apply = function(compiler) {
};
module.exports = {
- devtool: 'eval',
+ devtool: 'source-map',
devServer: {
headers: { "Access-Control-Allow-Origin": "*" }
},
diff --git a/webpack.config.prod.js b/webpack.config.prod.js
index 8b276aef..1af83d40 100644
--- a/webpack.config.prod.js
+++ b/webpack.config.prod.js
@@ -23,6 +23,7 @@ module.exports = {
app: ['babel-polyfill', path.resolve(__dirname, 'src/app/index')],
lib: ['d3', 'react', 'react-dom', 'classnames', 'fbemitter', 'lz-string']
},
+ devtool: 'source-map',
resolve: {
extensions: ['.js', '.jsx', '.json', '.less']
},