diff --git a/src/app/components/HardpointSlot.jsx b/src/app/components/HardpointSlot.jsx
index 18f35d36..e2589d5d 100644
--- a/src/app/components/HardpointSlot.jsx
+++ b/src/app/components/HardpointSlot.jsx
@@ -53,7 +53,7 @@ export default class HardpointSlot extends Slot {
{m.type && m.type == 'KT' ? : ''}
{m.type && m.type == 'E' ? : ''}
{classRating} {translate(m.name || m.grp)}
-
{classRating} {translate(m.grp == 'bh' ? m.grp : m.name || m.grp)}
-
{formats.round(m.getMass()) || m.fuel || 0}{units.T}
+
{formats.round1(m.getMass()) || m.fuel || 0}{units.T}
{ m.grp == 'bh' && m.name ?
{translate(m.name)}
: null }
- { m.getOptimalMass() ?
{translate('optimal mass')}: {formats.round(m.getOptimalMass())}{units.T}
: null }
- { m.getMaxMass() ?
{translate('max mass')}: {formats.round(m.getMaxMass())}{units.T}
: null }
- { m.getRange() ?
{translate('range')}: {formats.round(m.getRange())}{units.km}
: null }
+ { m.getOptimalMass() ?
{translate('optimal mass')}: {formats.int(m.getOptimalMass())}{units.T}
: null }
+ { m.getMaxMass() ?
{translate('max mass')}: {formats.int(m.getMaxMass())}{units.T}
: null }
+ { m.getRange() ?
{translate('range')}: {formats.f2(m.getRange())}{units.km}
: null }
{ m.time ?
{translate('time')}: {formats.time(m.time)}
: null }
- { m.getThermalEfficiency() ?
{translate('efficiency')}: {formats.round(m.getThermalEfficiency())}
: null }
- { m.getPowerGeneration() > 0 ?
{translate('pGen')}: {formats.round(m.getPowerGeneration())}{units.MW}
: null }
- { m.getMaxFuelPerJump() ?
{translate('max')} {translate('fuel')}: {formats.round(m.getMaxFuelPerJump())}{units.T}
: null }
- { m.getWeaponsCapacity() ?
{translate('WEP')}: {formats.round(m.getWeaponsCapacity())}{units.MJ} / {formats.round(m.getWeaponsRechargeRate())}{units.MW}
: null }
- { m.getSystemsCapacity() ?
{translate('SYS')}: {formats.round(m.getSystemsCapacity())}{units.MJ} / {formats.round(m.getSystemsRechargeRate())}{units.MW}
: null }
- { m.getEnginesCapacity() ?
{translate('ENG')}: {formats.round(m.getEnginesCapacity())}{units.MJ} / {formats.round(m.getEnginesRechargeRate())}{units.MW}
: null }
+ { m.getThermalEfficiency() ?
{translate('efficiency')}: {formats.f1(m.getThermalEfficiency())}
: null }
+ { m.getPowerGeneration() > 0 ?
{translate('pGen')}: {formats.f1(m.getPowerGeneration())}{units.MW}
: null }
+ { m.getMaxFuelPerJump() ?
{translate('max')} {translate('fuel')}: {formats.f1(m.getMaxFuelPerJump())}{units.T}
: null }
+ { m.getWeaponsCapacity() ?
{translate('WEP')}: {formats.f1(m.getWeaponsCapacity())}{units.MJ} / {formats.f1(m.getWeaponsRechargeRate())}{units.MW}
: null }
+ { m.getSystemsCapacity() ?
{translate('SYS')}: {formats.f1(m.getSystemsCapacity())}{units.MJ} / {formats.f1(m.getSystemsRechargeRate())}{units.MW}
: null }
+ { m.getEnginesCapacity() ?
{translate('ENG')}: {formats.f1(m.getEnginesCapacity())}{units.MJ} / {formats.f1(m.getEnginesRechargeRate())}{units.MW}
: null }
{ validMods.length > 0 ?
: null }
@@ -99,6 +103,9 @@ export default class StandardSlot extends TranslatedComponent {
);
}
+ /**
+ * Toggle the modifications flag when selecting the modifications icon
+ */
_toggleModifications() {
this._modificationsSelected = !this._modificationsSelected;
}
diff --git a/src/app/i18n/Language.jsx b/src/app/i18n/Language.jsx
index 6d4d21a8..fb4ea958 100644
--- a/src/app/i18n/Language.jsx
+++ b/src/app/i18n/Language.jsx
@@ -46,6 +46,7 @@ export function getLanguage(langCode) {
s2: d3Locale.numberFormat('.2s'), // SI Format to 2 decimal places (.e.g 1.1k)
pct: d3Locale.numberFormat('.2%'), // % to 2 decimal places (.e.g 5.40%)
pct1: d3Locale.numberFormat('.1%'), // % to 1 decimal places (.e.g 5.4%)
+ r1: d3Locale.numberFormat('.1r'), // Rounded to 1 significant number (.e.g 512 => 500, 4.122 => 4)
r2: d3Locale.numberFormat('.2r'), // Rounded to 2 significant numbers (.e.g 512 => 510, 4.122 => 4.1)
rPct: d3.format('%'), // % to 0 decimal places (.e.g 5%)
round1: (d) => gen(d3.round(d, 1)), // Rounded to 0-1 decimal places (.e.g 5.1, 4)
diff --git a/src/app/shipyard/Calculations.js b/src/app/shipyard/Calculations.js
index 21d818d6..96c7b0fe 100644
--- a/src/app/shipyard/Calculations.js
+++ b/src/app/shipyard/Calculations.js
@@ -57,7 +57,7 @@ export function shieldStrength(mass, baseShield, sg, multiplier) {
let maxMul = sg instanceof Module ? sg.getMaxMul() : sg.maxmul;
let xnorm = Math.min(1, (maxMass - mass) / (maxMass - minMass));
- let exponent = Math.log((optMul - minMul) / (maxMul - minMul)) / Math.log(Math.min(1, (maxMass - optMass) / (maxMass - minMass)))
+ let exponent = Math.log((optMul - minMul) / (maxMul - minMul)) / Math.log(Math.min(1, (maxMass - optMass) / (maxMass - minMass)));
let ynorm = Math.pow(xnorm, exponent);
let mul = minMul + ynorm * (maxMul - minMul);
@@ -84,7 +84,7 @@ export function speed(mass, baseSpeed, baseBoost, thrusters, pipSpeed) {
let maxMul = thrusters instanceof Module ? thrusters.getMaxMul() : thrusters.maxmul;
let xnorm = Math.min(1, (maxMass - mass) / (maxMass - minMass));
- let exponent = Math.log((optMul - minMul) / (maxMul - minMul)) / Math.log(Math.min(1, (maxMass - optMass) / (maxMass - minMass)))
+ let exponent = Math.log((optMul - minMul) / (maxMul - minMul)) / Math.log(Math.min(1, (maxMass - optMass) / (maxMass - minMass)));
let ynorm = Math.pow(xnorm, exponent);
let mul = minMul + ynorm * (maxMul - minMul);
let speed = baseSpeed * mul;
diff --git a/src/app/shipyard/ModuleUtils.js b/src/app/shipyard/ModuleUtils.js
index d2066c61..dc0b95e6 100755
--- a/src/app/shipyard/ModuleUtils.js
+++ b/src/app/shipyard/ModuleUtils.js
@@ -98,7 +98,7 @@ export function internal(id) {
let group = Modules.internal[n];
for (let i = 0; i < group.length; i++) {
if (group[i].id == id) {
- return group[i];
+ return new Module({ template: group[i] });
}
}
}
diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js
index 6d1720dd..9367f689 100755
--- a/src/app/shipyard/Ship.js
+++ b/src/app/shipyard/Ship.js
@@ -495,7 +495,6 @@ export default class Ship {
bands[this.cargoHatch.priority].retracted += this.cargoHatch.m.getPowerUsage();
}
-
for (i = 0; i < cl; i++) {
standard[i].cat = 0;
standard[i].enabled = enabled ? enabled[i + 1] * 1 : true;
diff --git a/src/app/utils/SlotFunctions.js b/src/app/utils/SlotFunctions.js
index 6309f04e..647d8ef7 100644
--- a/src/app/utils/SlotFunctions.js
+++ b/src/app/utils/SlotFunctions.js
@@ -252,7 +252,7 @@ export function diffDetails(language, m, mm) {
}
} else {
// Old module must be a shield booster
- newShield = this.calcShieldStrengthWith(null, -mm.getShieldMul());
+ newShield = this.calcShieldStrengthWith(null, -mm.getShieldMul());
}
let sgDiffClass = Math.round((newShield - shield) * 100) / 100 == 0 ? 'muted' : (newShield > shield ? 'secondary' : 'warning');
@@ -283,7 +283,7 @@ export function diffDetails(language, m, mm) {
let massDiff = mMass - mmMass;
let mCap = m.fuel || m.cargo || 0;
- let mmCap = mm? mm.fuel || mm.cargo || 0 : 0;
+ let mmCap = mm ? mm.fuel || mm.cargo || 0 : 0;
let capDiff = mCap - mmCap;
if (m.grp == 'fsd' || massDiff || capDiff) {
let fsd = m.grp == 'fsd' ? m : null;