+ { m.name ?
{translate(m.name)}
: null }
{ m.optmass ?
{translate('optimal mass') + ': '}{m.optmass}{units.T}
: null }
{ m.maxmass ?
{translate('max mass') + ': '}{m.maxmass}{units.T}
: null }
{ m.range ?
{translate('range')}: {m.range}{units.km}
: null }
diff --git a/src/app/components/StandardSlotSection.jsx b/src/app/components/StandardSlotSection.jsx
index 1d4c9521..ef6b0dc3 100644
--- a/src/app/components/StandardSlotSection.jsx
+++ b/src/app/components/StandardSlotSection.jsx
@@ -20,7 +20,7 @@ export default class StandardSlotSection extends SlotSection {
constructor(props, context) {
super(props, context, 'standard', 'standard');
this._optimizeStandard = this._optimizeStandard.bind(this);
- this._hideDiff = this._hideDiff.bind(this);
+ this._selectBulkhead = this._selectBulkhead.bind(this);
}
/**
@@ -65,10 +65,10 @@ export default class StandardSlotSection extends SlotSection {
/**
* Use the specified bulkhead
- * @param {number} bulkheadIndex 0 - 4
+ * @param {Object} bulkhead Bulkhead module details
*/
- _selectBulkhead(bulkheadIndex) {
- this.props.ship.useBulkhead(bulkheadIndex);
+ _selectBulkhead(bulkhead) {
+ this.props.ship.useBulkhead(bulkhead.index);
this.context.tooltip();
this.props.onChange();
this._close();
@@ -81,26 +81,6 @@ export default class StandardSlotSection extends SlotSection {
this._optimizeStandard();
}
- /**
- * Show the bulkhead diff tooltip
- * @param {number} bhIndex Potential Bulkhead alternative
- * @param {SyntheticEvent} event Event
- */
- _bhDiff(bhIndex, event) {
- let ship = this.props.ship;
- this.context.tooltip(
- diffDetails.call(ship, this.context.language, ModuleUtils.bulkheads(ship.id, bhIndex), ship.bulkheads.m),
- event.currentTarget.getBoundingClientRect()
- );
- }
-
- /**
- * Hide the diff tooltip
- */
- _hideDiff() {
- this.context.tooltip();
- }
-
/**
* Generate the slot React Components
* @return {Array} Array of Slots
@@ -116,41 +96,15 @@ export default class StandardSlotSection extends SlotSection {
let avail = ship.getAvailableModules().standard;
let bh = ship.bulkheads;
- slots[0] = (
-
-
-
-
8
-
-
{translate('bh')}
-
{bh.m.mass}{units.T}
-
{translate(bh.m.name)}
-
-
-
- {currentMenu === bh &&
-
e.stopPropagation() }>
-
- -
- {translate('Lightweight Alloy')}
-
- -
- {translate('Reinforced Alloy')}
-
- -
- {translate('Military Grade Composite')}
-
- -
- {translate('Mirrored Surface Composite')}
-
- -
- {translate('Reactive Surface Composite')}
-
-
-
- }
-
- );
+ slots[0] =
;
slots[1] =
{
+ return Object.assign({ grp: 'bh', name: BulkheadNames[i], index: i, class: '', rating: '' }, b);
+ });
+
this.standard[0] = filter(stnd.pp, maxStandardArr[0], 0, mass); // Power Plant
this.standard[2] = filter(stnd.fsd, maxStandardArr[2], 0, mass); // FSD
this.standard[4] = filter(stnd.pd, maxStandardArr[4], 0, mass); // Power Distributor
@@ -53,6 +60,15 @@ export default class ModuleSet {
}
}
+ /**
+ * Get the specified bulkhead
+ * @param {integer} index Bulkhead index
+ * @return {Object} Bulkhead module details
+ */
+ getBulkhead(index) {
+ return this.bulkheads[index] || null;
+ }
+
/**
* Determine the modules that areeligible for an internal slot
* @param {integer} c The max class module that can be mounted in the slot
diff --git a/src/app/shipyard/ModuleUtils.js b/src/app/shipyard/ModuleUtils.js
index 06375b46..4543bf32 100755
--- a/src/app/shipyard/ModuleUtils.js
+++ b/src/app/shipyard/ModuleUtils.js
@@ -171,21 +171,6 @@ export function findHardpointId(groupName, clss, rating, name, mount, missile) {
return h ? h.id : 0;
}
-/**
- * Looks up the bulkhead module for a specific ship and bulkhead
- * @param {String} shipId Unique ship Id/Key
- * @param {string|number} index Index for the specified bulkhead
- * @return {Object} The bulkhead module object
- */
-export function bulkheads(shipId, index) {
- let bulkhead = Ships[shipId].bulkheads[index];
- bulkhead.class = 1;
- bulkhead.rating = 'I';
- bulkhead.name = BulkheadNames[index];
-
- return bulkhead;
-}
-
/**
* Get the bulkhead index for the given bulkhead name
* @param {String} bulkheadName Bulkhead name in english
@@ -215,7 +200,5 @@ export function isShieldGenerator(g) {
* @return {ModuleSet} The set of modules the ship can install
*/
export function forShip(shipId) {
- let ship = Ships[shipId];
- let maxInternal = isNaN(ship.slots.internal[0]) ? ship.slots.internal[0].class : ship.slots.internal[0];
- return new ModuleSet(Modules, ship.properties.hullMass + 6.5, ship.slots.standard, maxInternal, ship.slots.hardpoints[0]);
+ return new ModuleSet(Modules, Ships[shipId]);
}
diff --git a/src/app/shipyard/Serializer.js b/src/app/shipyard/Serializer.js
index 7e3fe866..f3033f94 100644
--- a/src/app/shipyard/Serializer.js
+++ b/src/app/shipyard/Serializer.js
@@ -59,7 +59,7 @@ export function toDetailedBuild(buildName, ship) {
}],
components: {
standard: {
- bulkheads: BulkheadNames[ship.bulkheads.index],
+ bulkheads: BulkheadNames[ship.bulkheads.m.index],
cargoHatch: { enabled: Boolean(ship.cargoHatch.enabled), priority: ship.cargoHatch.priority + 1 },
powerPlant: { class: standard[0].m.class, rating: standard[0].m.rating, enabled: Boolean(standard[0].enabled), priority: standard[0].priority + 1 },
thrusters: { class: standard[1].m.class, rating: standard[1].m.rating, enabled: Boolean(standard[1].enabled), priority: standard[1].priority + 1 },
diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js
index 2a48d893..d15d6723 100755
--- a/src/app/shipyard/Ship.js
+++ b/src/app/shipyard/Ship.js
@@ -294,7 +294,7 @@ export default class Ship {
*/
getStandardString() {
if(!this.serialized.standard) {
- this.serialized.standard = this.bulkheads.index + this.standard.reduce((arr, slot, i) => {
+ this.serialized.standard = this.bulkheads.m.index + this.standard.reduce((arr, slot, i) => {
arr[i] = slot.m ? slot.m.class + slot.m.rating : '-';
return arr;
}, new Array(this.standard.length)).join('');
@@ -855,8 +855,7 @@ export default class Ship {
*/
useBulkhead(index, preventUpdate) {
let oldBulkhead = this.bulkheads.m;
- this.bulkheads.index = index;
- this.bulkheads.m = ModuleUtils.bulkheads(this.id, index);
+ this.bulkheads.m = this.availCS.getBulkhead(index);
this.bulkheads.discountedCost = this.bulkheads.m.cost * this.moduleCostMultiplier;
this.armourMultiplier = ArmourMultiplier[index];
this.updateStats(this.bulkheads, this.bulkheads.m, oldBulkhead, preventUpdate);