From 464cd4165f1c59b9895021173ea3951cf072b445 Mon Sep 17 00:00:00 2001 From: Cmdr McDonald Date: Tue, 16 May 2017 16:39:15 +0100 Subject: [PATCH] Added translation --- ChangeLog.md | 1 + src/app/components/SlotSection.jsx | 24 +++++++++++++++++-- src/app/i18n/en.js | 38 ++++++++++++++++++++++++++++++ src/app/shipyard/ModuleSet.js | 5 ++-- 4 files changed, 64 insertions(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 6276e551..74664027 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -2,6 +2,7 @@ * Ensure that hidden blueprint effects are applied when a blueprint is selected * Handle display when summary values show thrusters disabled but current mass keeps them enabled * Added updated German translations (thanks to @sweisgerber-dev) + * Power state (enabled and priority) now follows modules when they are swapped or copied #2.3.4 * Fix crash when removing the special effect from a module diff --git a/src/app/components/SlotSection.jsx b/src/app/components/SlotSection.jsx index f18350fc..6f300e8e 100644 --- a/src/app/components/SlotSection.jsx +++ b/src/app/components/SlotSection.jsx @@ -134,18 +134,38 @@ export default class SlotSection extends TranslatedComponent { if (targetSlot && canMount(this.props.ship, targetSlot, m.grp, m.class)) { const mCopy = m.clone(); this.props.ship.use(targetSlot, mCopy, false); + // Copy power info + targetSlot.enabled = originSlot.enabled; + targetSlot.priority = originSlot.priority; this.props.onChange(); } } else { + // Store power info + const originEnabled = targetSlot.enabled; + const originPriority = targetSlot.priority; + const targetEnabled = originSlot.enabled; + const targetPriority = originSlot.priority; // We want to move the module in to the target slot, and swap back any module that was originally in the target slot if (targetSlot && m && canMount(this.props.ship, targetSlot, m.grp, m.class)) { // Swap modules if possible if (targetSlot.m && canMount(this.props.ship, originSlot, targetSlot.m.grp, targetSlot.m.class)) { this.props.ship.use(originSlot, targetSlot.m, true); - } else { // Otherwise empty the origin slot + this.props.ship.use(targetSlot, m); + // Swap power + originSlot.enabled = originEnabled; + originSlot.priority = originPriority; + targetSlot.enabled = targetEnabled; + targetSlot.priority = targetPriority; + } else { // Otherwise empty the origin slot + // Store power + const targetEnabled = originSlot.enabled; this.props.ship.use(originSlot, null, true); // Empty but prevent summary update + this.props.ship.use(targetSlot, m); + originSlot.enabled = 0; + originSlot.priority = 0; + targetSlot.enabled = targetEnabled; + targetSlot.priority = targetPriority; } - this.props.ship.use(targetSlot, m); // update target slot this.props.onChange(); } } diff --git a/src/app/i18n/en.js b/src/app/i18n/en.js index d3fd4bea..50294f7b 100644 --- a/src/app/i18n/en.js +++ b/src/app/i18n/en.js @@ -286,6 +286,44 @@ export const terms = { bulkheads: 'Bulkheads', reinforcement: 'Reinforcement', + // Panel headings and subheadings + 'power and costs': 'power and costs', + 'costs': 'costs', + 'retrofit costs': 'retrofit costs', + 'reload costs': 'reload costs', + 'profiles': 'profiles', + 'engine profile': 'engine profile', + 'fsd profile': 'fsd profile', + 'movement profile': 'movement profile', + 'damage to opponent\'s shields': 'damage to opponent\'s shields', + 'damage to opponent\'s hull': 'damage to opponent\'s hull', + 'offence': 'offence', + 'defence': 'defence', + 'shield metrics': 'shield metrics', + 'raw shield strength': 'raw shield strength', + 'shield sources': 'shield sources', + 'damage taken': 'damage taken', + 'effective shield': 'effective shield', + 'armour metrics': 'armour metrics', + 'raw armour strength': 'raw armour strength', + 'armour sources': 'armour sources', + 'raw module armour': 'raw module armour', + 'effective armour': 'effective armour', + 'offence metrics': 'offence metrics', + 'defence metrics': 'defence metrics', + // Misc items + 'fuel carried': 'fuel carried', + 'cargo carried': 'cargo carried', + 'ship control': 'ship control', + 'opponent': 'opponent', + 'opponent\'s shields': 'opponent\'s shields', + 'opponent\'s armour': 'opponent\'s armour', + 'shield damage sources': 'shield damage sources', + 'armour damage sources': 'armour damage sources', + 'never': 'never', + 'stock': 'stock', + 'boost': 'boost', + // Help text HELP_TEXT: `

Introduction

diff --git a/src/app/shipyard/ModuleSet.js b/src/app/shipyard/ModuleSet.js index c792bccd..211df63f 100755 --- a/src/app/shipyard/ModuleSet.js +++ b/src/app/shipyard/ModuleSet.js @@ -167,14 +167,15 @@ export default class ModuleSet { /** * Find the lightest Power Plant that provides sufficient power * @param {number} powerNeeded Power requirements in MJ + * @param {string} rating The optional rating of the power plant * @return {Object} Power Plant */ - lightestPowerPlant(powerNeeded) { + lightestPowerPlant(powerNeeded, rating) { let pp = this.standard[0][0]; for (let p of this.standard[0]) { // Provides enough power, is lighter or the same mass as current power plant but better output/efficiency - if (p.pgen >= powerNeeded && (p.mass < pp.mass || (p.mass == pp.mass && p.pgen > pp.pgen))) { + if (p.pgen >= powerNeeded && (p.mass < pp.mass || (p.mass == pp.mass && p.pgen > pp.pgen)) && (!rating || rating == p.rating)) { pp = p; } }