From 5f0b851de787dc0b8dbdb207e231ee4dfd0ff568 Mon Sep 17 00:00:00 2001 From: Cmdr McDonald Date: Tue, 8 Nov 2016 09:05:54 +0000 Subject: [PATCH] Take modifications in to account when deciding whether to issue a warning on a standard module. Fix for #16. --- src/app/components/StandardSlot.jsx | 2 +- src/app/components/StandardSlotSection.jsx | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/components/StandardSlot.jsx b/src/app/components/StandardSlot.jsx index 3b54fd7c..dddf9edc 100644 --- a/src/app/components/StandardSlot.jsx +++ b/src/app/components/StandardSlot.jsx @@ -79,7 +79,7 @@ export default class StandardSlot extends TranslatedComponent {
{slot.maxClass}
-
{classRating}{translate(m.grp == 'bh' ? m.grp : m.name || m.grp)}{ Object.keys(m.mods).length > 0 ? : null }
+
{classRating} {translate(m.grp == 'bh' ? m.grp : m.name || m.grp)}{ Object.keys(m.mods).length > 0 ? : null }
{formats.round(mass)}{units.T}
diff --git a/src/app/components/StandardSlotSection.jsx b/src/app/components/StandardSlotSection.jsx index 48e53656..7a591b76 100644 --- a/src/app/components/StandardSlotSection.jsx +++ b/src/app/components/StandardSlotSection.jsx @@ -2,6 +2,7 @@ import React from 'react'; import cn from 'classnames'; import SlotSection from './SlotSection'; import StandardSlot from './StandardSlot'; +import Module from '../shipyard/Module'; import { diffDetails } from '../utils/SlotFunctions'; import * as ModuleUtils from '../shipyard/ModuleUtils'; import * as ShipRoles from '../shipyard/ShipRoles'; @@ -114,7 +115,7 @@ export default class StandardSlotSection extends SlotSection { selected={currentMenu == st[0]} onChange={this.props.onChange} ship={ship} - warning={m => m.pgen < ship.powerRetracted} + warning={m => m instanceof Module ? m.getPowerGeneration() < ship.powerRetracted : m.pgen< ship.powerRetracted} />; slots[2] = m.maxmass < (ship.ladenMass - st[1].mass + m.mass)} + warning={m => m instanceof Module ? m.getMaxMass() < (ship.ladenMass - st[1].mass + m.mass) : m.maxmass < (ship.ladenMass - st[1].mass + m.mass)} />; @@ -161,7 +162,7 @@ export default class StandardSlotSection extends SlotSection { selected={currentMenu == st[4]} onChange={this.props.onChange} ship={ship} - warning= {m => m.engcap < ship.boostEnergy} + warning={m => m instanceof Module ? m.getEnginesCapacity() < ship.boostEnergy : m.engcap < ship.boostEnergy} />; slots[6] =