diff --git a/ChangeLog.md b/ChangeLog.md index 6b9a9582..f2a04852 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -4,6 +4,7 @@ * Add movement summary to outfitting page * Add standard internal class sizes to shipyard page * Fix issue when importing Viper Mk IV + * Ensure ordering of all types of modules (standard, internal, utilities) is consistent #2.2.5 * Calculate rate of fire for multi-burst weapons diff --git a/src/app/components/AvailableModulesMenu.jsx b/src/app/components/AvailableModulesMenu.jsx index f72a475d..4b5013fb 100644 --- a/src/app/components/AvailableModulesMenu.jsx +++ b/src/app/components/AvailableModulesMenu.jsx @@ -93,8 +93,10 @@ export default class AvailableModulesMenu extends TranslatedComponent { let prevClass = null, prevRating = null; let elems = []; - for (let i = 0; i < modules.length; i++) { - let m = modules[i]; + const sortedModules = modules.sort(this._moduleOrder); + + for (let i = 0; i < sortedModules.length; i++) { + let m = sortedModules[i]; let mount = null; let disabled = m.maxmass && (mass + (m.mass ? m.mass : 0)) > m.maxmass; let active = mountedModule && mountedModule.id === m.id; @@ -126,7 +128,7 @@ export default class AvailableModulesMenu extends TranslatedComponent { case 'T': mount = ; break; } - if (i > 0 && modules.length > 3 && m.class != prevClass && (m.rating != prevRating || m.mount) && m.grp != 'pa') { + if (i > 0 && sortedModules.length > 3 && m.class != prevClass && (m.rating != prevRating || m.mount) && m.grp != 'pa') { elems.push(
); } @@ -201,6 +203,32 @@ export default class AvailableModulesMenu extends TranslatedComponent { this.context.tooltip(); } + _moduleOrder(a, b) { + // Named modules go last + if (!a.name && b.name) { + return -1; + } + if (a.name && !b.name) { + return 1; + } + // Class ordered from highest (8) to lowest (1) + if (a.class < b.class) { + return 1; + } + if (a.class > b.class) { + return -1; + // Rating ordered from lowest (E) to highest (A) + } + if (a.rating < b.rating) { + return 1; + } + if (a.rating > b.rating) { + return -1; + } + // Do not attempt to order by name at this point, as that mucks up the order of armour + return 0; + } + /** * Scroll to mounted (if it exists) module group on mount */ diff --git a/src/app/components/MovementSummary.jsx b/src/app/components/MovementSummary.jsx index 14fba3bf..c3b60970 100644 --- a/src/app/components/MovementSummary.jsx +++ b/src/app/components/MovementSummary.jsx @@ -46,7 +46,7 @@ export default class MovementSummary extends TranslatedComponent { 2 3 4 - 4B + 4B {translate('speed')} ({units['m/s']}) diff --git a/src/app/i18n/en.js b/src/app/i18n/en.js index 08fa074f..383e0f1e 100644 --- a/src/app/i18n/en.js +++ b/src/app/i18n/en.js @@ -109,6 +109,7 @@ export const terms = { 'recovery': 'Recovery', 'recharge': 'Recharge', 'engine pips': 'Engine Pips', + '4b': '4 pips and boost', 'speed': 'Speed', 'pitch': 'Pitch', 'roll': 'Roll',