Take modifications in to account when deciding whether to issue a

warning on a standard module.
Fix for #16.
This commit is contained in:
Cmdr McDonald
2016-11-08 09:05:54 +00:00
parent 616ed0bf10
commit 5f0b851de7
2 changed files with 5 additions and 4 deletions

View File

@@ -79,7 +79,7 @@ export default class StandardSlot extends TranslatedComponent {
<div className={cn('details-container', { warning: warning && warning(slot.m) })}>
<div className={'sz'}>{slot.maxClass}</div>
<div>
<div className={'l'}>{classRating}{translate(m.grp == 'bh' ? m.grp : m.name || m.grp)}{ Object.keys(m.mods).length > 0 ? <span className='r' onMouseOver={termtip.bind(null, 'modified')} onMouseOut={tooltip.bind(null, null)}><Modified /></span> : null }</div>
<div className={'l'}>{classRating} {translate(m.grp == 'bh' ? m.grp : m.name || m.grp)}{ Object.keys(m.mods).length > 0 ? <span className='r' onMouseOver={termtip.bind(null, 'modified')} onMouseOut={tooltip.bind(null, null)}><Modified /></span> : null }</div>
<div className={'r'}>{formats.round(mass)}{units.T}</div>
<div/>
<div className={'cb'}>

View File

@@ -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] = <StandardSlot
@@ -126,7 +127,7 @@ export default class StandardSlotSection extends SlotSection {
selected={currentMenu == st[1]}
onChange={this.props.onChange}
ship={ship}
warning={m => 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] = <StandardSlot