Updates for modifications

This commit is contained in:
Cmdr McDonald
2016-10-31 11:22:36 +00:00
parent 4b14f617ec
commit e5cc3e269e
13 changed files with 162 additions and 69 deletions

View File

@@ -56,14 +56,14 @@ export default class HardpointSlot extends Slot {
<div className={'r'}>{m.getMass()}{u.T}</div> <div className={'r'}>{m.getMass()}{u.T}</div>
</div> </div>
<div className={'cb'}> <div className={'cb'}>
{ m.dps ? <div className={'l'}>{translate('DPS')}: {formats.round1(m.dps)} { m.clip ? <span>({formats.round1((m.clip * m.dps / m.rof) / ((m.clip / m.rof) + m.reload)) })</span> : null }</div> : null } { m.getDps() ? <div className={'l'}>{translate('DPS')}: {formats.round1(m.getDps())} { m.getClip() ? <span>({formats.round1((m.getClip() * m.getDps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload())) })</span> : null }</div> : null }
{ m.eps ? <div className={'l'}>{translate('EPS')}: {formats.round1(m.eps)}{u.MW} { m.clip ? <span>({formats.round1((m.clip * m.eps / m.rof) / ((m.clip / m.rof) + m.reload)) }{u.MW})</span> : null }</div> : null } { m.getEps() ? <div className={'l'}>{translate('EPS')}: {formats.round1(m.getEps())}{u.MW} { m.getClip() ? <span>({formats.round1((m.getClip() * m.getEps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload())) }{u.MW})</span> : null }</div> : null }
{ m.hps ? <div className={'l'}>{translate('HPS')}: {formats.round1(m.hps)} { m.clip ? <span>({formats.round1((m.clip * m.hps / m.rof) / ((m.clip / m.rof) + m.reload)) })</span> : null }</div> : null } { m.getHps() ? <div className={'l'}>{translate('HPS')}: {formats.round1(m.getHps())} { m.getClip() ? <span>({formats.round1((m.getClip() * m.getHps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload())) })</span> : null }</div> : null }
{ m.dps && m.eps ? <div className={'l'}>{translate('DPE')}: {formats.round1(m.dps / m.eps)}</div> : null } { m.getDps() && m.getEps() ? <div className={'l'}>{translate('DPE')}: {formats.round1(m.getDps() / m.getEps())}</div> : null }
{ m.rof ? <div className={'l'}>{translate('ROF')}: {m.rof}{u.ps}</div> : null } { m.getRoF() ? <div className={'l'}>{translate('ROF')}: {m.getRoF()}{u.ps}</div> : null }
{ m.range && !m.dps ? <div className={'l'}>{translate('Range')} : {formats.round(m.range / 1000)}{u.km}</div> : null } { m.getRange() && !m.getDps() ? <div className={'l'}>{translate('Range')} : {formats.round(m.getRange() / 1000)}{u.km}</div> : null }
{ m.shieldmul ? <div className={'l'}>+{formats.rPct(m.shieldmul)}</div> : null } { m.getShieldMul() ? <div className={'l'}>+{formats.rPct(m.getShieldMul())}</div> : null }
{ m.ammo >= 0 ? <div className={'l'}>{translate('ammo')}: {formats.int(m.clip)}/{formats.int(m.ammo)}</div> : null } { m.getAmmo() ? <div className={'l'}>{translate('ammunition')}: {formats.int(m.getClip())}/{formats.int(m.getAmmo())}</div> : null }
{ m && validMods.length > 0 ? <div className='r' ><button onClick={this._toggleModifications.bind(this)} onContextMenu={stopCtxPropagation} onMouseOver={termtip.bind(null, 'modifications')} onMouseOut={tooltip.bind(null, null)}><ListModifications /></button></div> : null } { m && validMods.length > 0 ? <div className='r' ><button onClick={this._toggleModifications.bind(this)} onContextMenu={stopCtxPropagation} onMouseOver={termtip.bind(null, 'modifications')} onMouseOut={tooltip.bind(null, null)}><ListModifications /></button></div> : null }
</div> </div>
</div>; </div>;

View File

@@ -69,6 +69,7 @@ export default class HardpointsSlotSection extends SlotSection {
availableModules={() => availableModules.getHps(h.maxClass)} availableModules={() => availableModules.getHps(h.maxClass)}
onOpen={this._openMenu.bind(this, h)} onOpen={this._openMenu.bind(this, h)}
onSelect={this._selectModule.bind(this, h)} onSelect={this._selectModule.bind(this, h)}
onChange={this.props.onChange}
selected={currentMenu == h} selected={currentMenu == h}
drag={this._drag.bind(this, h)} drag={this._drag.bind(this, h)}
dragOver={this._dragOverSlot.bind(this, h)} dragOver={this._dragOverSlot.bind(this, h)}

View File

@@ -30,16 +30,16 @@ export default class InternalSlot extends Slot {
<div className={'r'}>{m.getMass() || m.cargo || m.fuel || 0}{u.T}</div> <div className={'r'}>{m.getMass() || m.cargo || m.fuel || 0}{u.T}</div>
</div> </div>
<div className={'cb'}> <div className={'cb'}>
{ m.optmass ? <div className={'l'}>{translate('optimal mass')}: {m.optmass}{u.T}</div> : null } { m.getOptMass() ? <div className={'l'}>{translate('optimal mass')}: {m.getOptMass()}{u.T}</div> : null }
{ m.maxmass ? <div className={'l'}>{translate('max mass')}: {m.maxmass}{u.T}</div> : null } { m.getMaxMass() ? <div className={'l'}>{translate('max mass')}: {m.getMaxMass()}{u.T}</div> : null }
{ m.bins ? <div className={'l'}>{m.bins} <u>{translate('bins')}</u></div> : null } { m.bins ? <div className={'l'}>{m.bins} <u>{translate('bins')}</u></div> : null }
{ m.bays ? <div className={'l'}>{translate('bays')}: {m.bays}</div> : null } { m.bays ? <div className={'l'}>{translate('bays')}: {m.bays}</div> : null }
{ m.rate ? <div className={'l'}>{translate('rate')}: {m.rate}{u.kgs}&nbsp;&nbsp;&nbsp;{translate('refuel time')}: {formats.time(this.props.fuel * 1000 / m.rate)}</div> : null } { m.rate ? <div className={'l'}>{translate('rate')}: {m.rate}{u.kgs}&nbsp;&nbsp;&nbsp;{translate('refuel time')}: {formats.time(this.props.fuel * 1000 / m.rate)}</div> : null }
{ m.ammo ? <div className={'l'}>{translate('ammo')}: {formats.gen(m.ammo)}</div> : null } { m.getAmmo() ? <div className={'l'}>{translate('ammunition')}: {formats.gen(m.getAmmo())}</div> : null }
{ m.cells ? <div className={'l'}>{translate('cells')}: {m.cells}</div> : null } { m.cells ? <div className={'l'}>{translate('cells')}: {m.cells}</div> : null }
{ m.recharge ? <div className={'l'}>{translate('recharge')}: {m.recharge} <u>MJ</u>&nbsp;&nbsp;&nbsp;{translate('total')}: {m.cells * m.recharge}{u.MJ}</div> : null } { m.recharge ? <div className={'l'}>{translate('recharge')}: {m.recharge} <u>MJ</u>&nbsp;&nbsp;&nbsp;{translate('total')}: {m.cells * m.recharge}{u.MJ}</div> : null }
{ m.repair ? <div className={'l'}>{translate('repair')}: {m.repair}</div> : null } { m.repair ? <div className={'l'}>{translate('repair')}: {m.repair}</div> : null }
{ m.range ? <div className={'l'}>{translate('range')} {m.range}{u.km}</div> : null } { m.getRange() ? <div className={'l'}>{translate('range')} {m.getRange()}{u.km}</div> : null }
{ m.time ? <div className={'l'}>{translate('time')}: {formats.time(m.time)}</div> : null } { m.time ? <div className={'l'}>{translate('time')}: {formats.time(m.time)}</div> : null }
{ m.maximum ? <div className={'l'}>{translate('max')}: {(m.maximum)}</div> : null } { m.maximum ? <div className={'l'}>{translate('max')}: {(m.maximum)}</div> : null }
{ m.rangeLS ? <div className={'l'}>{translate('range')}: {m.rangeLS}{u.Ls}</div> : null } { m.rangeLS ? <div className={'l'}>{translate('range')}: {m.rangeLS}{u.Ls}</div> : null }

View File

@@ -114,6 +114,7 @@ export default class InternalSlotSection extends SlotSection {
onSelect={this._selectModule.bind(this, s)} onSelect={this._selectModule.bind(this, s)}
selected={currentMenu == s} selected={currentMenu == s}
enabled={s.enabled} enabled={s.enabled}
eligible={s.eligible}
m={s.m} m={s.m}
drag={this._drag.bind(this, s)} drag={this._drag.bind(this, s)}
dragOver={this._dragOverSlot.bind(this, s)} dragOver={this._dragOverSlot.bind(this, s)}

View File

@@ -41,15 +41,18 @@ export default class ModificationsMenu extends TranslatedComponent {
let formats = context.language.formats; let formats = context.language.formats;
let { m } = props; let { m } = props;
let list = []; let list = [];
let values = {};
for (let modName of Modifications.validity[m.grp]) { for (let modName of Modifications.validity[m.grp]) {
values[modName] = m.getModValue(modName) * 100;
list.push(<div className={'cb'} key={modName}> list.push(<div className={'cb'} key={modName}>
<div className={'cb'}>{translate(modName)}{' (%)'}</div> <div className={'cb'}>{translate(modName)}{' (%)'}</div>
<NumberEditor className={'cb'} style={{ width: '100%', textAlign: 'center' }} step={0.01} stepModifier={1} decimals={2} initialValue={m.getModValue(modName) ? m.getModValue(modName) * 100 : 0} value={m.getModValue(modName) ? m.getModValue(modName) * 100 : 0} onValueChange={this._updateValue.bind(this, modName)} /> <NumberEditor className={'cb'} style={{ width: '100%', textAlign: 'center' }} step={0.01} stepModifier={1} decimals={2} value={this._getValue(modName, values[modName])} onValueChange={this._updateValue.bind(this, modName)} />
</div>); </div>);
} }
//<NumberEditor className={'cb'} style={{ width: '100%', textAlign: 'center' }} step={0.01} stepModifier={1} decimals={2} initialValue={m.getModValue(modName) ? m.getModValue(modName) * 100 : 0} value={m.getModValue(modName) ? m.getModValue(modName) * 100 : 0} onValueChange={this._updateValue.bind(this, modName)} />
return { list }; return { list, values };
} }
/** /**
@@ -61,19 +64,30 @@ export default class ModificationsMenu extends TranslatedComponent {
this.setState(this._initState(nextProps, nextContext)); this.setState(this._initState(nextProps, nextContext));
} }
_getValue(name, defaultValue) {
let values = this.state ? this.state.values : null;
return values ? values[name] : defaultValue;
}
/** /**
* Update modification given a value. * Update modification given a value.
* @param {Number} name The name of the modification * @param {Number} name The name of the modification
* @param {Number} value The value to set, in the range [0,1] * @param {Number} value The value to set, in the range [0,1]
*/ */
_updateValue(name, value) { _updateValue(name, value) {
let scaledValue = Math.floor(value * 100) / 10000;
let m = this.props.m; let values = this.state.values;
let ship = this.props.ship; values[name] = value;
ship.setModification(m, name, scaledValue); // Only update the modification if this is a valid number
if (!isNaN(Number(value)) && !value.endsWith('.')) {
let scaledValue = Math.floor(Number(value) * 100) / 10000;
let m = this.props.m;
let ship = this.props.ship;
ship.setModification(m, name, scaledValue);
}
this.props.onChange(); this.props.onChange();
this.setState({values});
} }
/** /**

View File

@@ -22,6 +22,7 @@ export default class Slot extends TranslatedComponent {
selected: React.PropTypes.bool, selected: React.PropTypes.bool,
m: React.PropTypes.object, m: React.PropTypes.object,
ship: React.PropTypes.object.isRequired, ship: React.PropTypes.object.isRequired,
eligible: React.PropTypes.object,
warning: React.PropTypes.func, warning: React.PropTypes.func,
drag: React.PropTypes.func, drag: React.PropTypes.func,
drop: React.PropTypes.func, drop: React.PropTypes.func,
@@ -80,7 +81,7 @@ export default class Slot extends TranslatedComponent {
let language = this.context.language; let language = this.context.language;
let { termtip, tooltip } = this.context; let { termtip, tooltip } = this.context;
let translate = language.translate; let translate = language.translate;
let { ship, m, dropClass, dragOver, onOpen, onChange, selected, onSelect, warning, shipMass, availableModules } = this.props; let { ship, m, dropClass, dragOver, onOpen, onChange, selected, eligible, onSelect, warning, shipMass, availableModules } = this.props;
let slotDetails, menu; let slotDetails, menu;
let validMods = m == null ? [] : (Modifications.validity[m.grp] || []); let validMods = m == null ? [] : (Modifications.validity[m.grp] || []);
@@ -92,7 +93,7 @@ export default class Slot extends TranslatedComponent {
if (m) { if (m) {
slotDetails = this._getSlotDetails(m, translate, language.formats, language.units); // Must be implemented by sub classes slotDetails = this._getSlotDetails(m, translate, language.formats, language.units); // Must be implemented by sub classes
} else { } else {
slotDetails = <div className={'empty'}>{translate('empty')}</div>; slotDetails = <div className={'empty'}>{translate(eligible ? 'emptyrestricted' : 'empty')}</div>;
} }
if (selected) { if (selected) {

View File

@@ -75,20 +75,20 @@ export default class StandardSlot extends TranslatedComponent {
<div className={'sz'}>{slot.maxClass}</div> <div className={'sz'}>{slot.maxClass}</div>
<div> <div>
<div className='l'>{classRating} {translate(m.grp == 'bh' ? m.grp : m.name || m.grp)}</div> <div className='l'>{classRating} {translate(m.grp == 'bh' ? m.grp : m.name || m.grp)}</div>
<div className={'r'}>{formats.round1(m.getMass()) || m.fuel || 0}{units.T}</div> <div className={'r'}>{formats.round(m.getMass()) || m.fuel || 0}{units.T}</div>
<div/> <div/>
<div className={'cb'}> <div className={'cb'}>
{ m.grp == 'bh' && m.name ? <div className='l'>{translate(m.name)}</div> : null } { m.grp == 'bh' && m.name ? <div className='l'>{translate(m.name)}</div> : null }
{ m.getOptimalMass() ? <div className='l'>{translate('optimal mass')}: {m.getOptimalMass()}{units.T}</div> : null } { m.getOptimalMass() ? <div className='l'>{translate('optimal mass')}: {formats.round(m.getOptimalMass())}{units.T}</div> : null }
{ m.getMaxMass() ? <div className='l'>{translate('max mass')}: {m.getMaxMass()}{units.T}</div> : null } { m.getMaxMass() ? <div className='l'>{translate('max mass')}: {formats.round(m.getMaxMass())}{units.T}</div> : null }
{ m.getRange() ? <div className='l'>{translate('range')}: {m.getRange()}{units.km}</div> : null } { m.getRange() ? <div className='l'>{translate('range')}: {formats.round(m.getRange())}{units.km}</div> : null }
{ m.time ? <div className='l'>{translate('time')}: {formats.time(m.time)}</div> : null } { m.time ? <div className='l'>{translate('time')}: {formats.time(m.time)}</div> : null }
{ m.getThermalEfficiency() ? <div className='l'>{translate('efficiency')}: {m.getThermalEfficiency()}</div> : null } { m.getThermalEfficiency() ? <div className='l'>{translate('efficiency')}: {formats.round(m.getThermalEfficiency())}</div> : null }
{ m.getPowerGeneration() > 0 ? <div className='l'>{translate('pGen')}: {formats.round(m.getPowerGeneration())}{units.MW}</div> : null } { m.getPowerGeneration() > 0 ? <div className='l'>{translate('pGen')}: {formats.round(m.getPowerGeneration())}{units.MW}</div> : null }
{ m.getMaxFuelPerJump() ? <div className='l'>{translate('max')} {translate('fuel')}: {m.getMaxFuelPerJump()}{units.T}</div> : null } { m.getMaxFuelPerJump() ? <div className='l'>{translate('max')} {translate('fuel')}: {formats.round(m.getMaxFuelPerJump())}{units.T}</div> : null }
{ m.getWeaponsCapacity() ? <div className='l'>{translate('WEP')}: {m.getWeaponsCapacity()}{units.MJ} / {m.getWeaponsRechargeRate()}{units.MW}</div> : null } { m.getWeaponsCapacity() ? <div className='l'>{translate('WEP')}: {formats.round(m.getWeaponsCapacity())}{units.MJ} / {formats.round(m.getWeaponsRechargeRate())}{units.MW}</div> : null }
{ m.getSystemsCapacity() ? <div className='l'>{translate('SYS')}: {m.getSystemsCapacity()}{units.MJ} / {m.getSystemsRechargeRate()}{units.MW}</div> : null } { m.getSystemsCapacity() ? <div className='l'>{translate('SYS')}: {formats.round(m.getSystemsCapacity())}{units.MJ} / {formats.round(m.getSystemsRechargeRate())}{units.MW}</div> : null }
{ m.getEnginesCapacity() ? <div className='l'>{translate('ENG')}: {m.getEnginesCapacity()}{units.MJ} / {m.getEnginesRechargeRate()}{units.MW}</div> : null } { m.getEnginesCapacity() ? <div className='l'>{translate('ENG')}: {formats.round(m.getEnginesCapacity())}{units.MJ} / {formats.round(m.getEnginesRechargeRate())}{units.MW}</div> : null }
{ validMods.length > 0 ? <div className='r' ><button onClick={this._toggleModifications.bind(this)} onContextMenu={stopCtxPropagation} onMouseOver={termtip.bind(null, 'modifications')} onMouseOut={tooltip.bind(null, null)}><ListModifications /></button></div> : null } { validMods.length > 0 ? <div className='r' ><button onClick={this._toggleModifications.bind(this)} onContextMenu={stopCtxPropagation} onMouseOver={termtip.bind(null, 'modifications')} onMouseOut={tooltip.bind(null, null)}><ListModifications /></button></div> : null }
</div> </div>

View File

@@ -68,6 +68,7 @@ export default class UtilitySlotSection extends SlotSection {
availableModules={() => availableModules.getHps(h.maxClass)} availableModules={() => availableModules.getHps(h.maxClass)}
onOpen={this._openMenu.bind(this,h)} onOpen={this._openMenu.bind(this,h)}
onSelect={this._selectModule.bind(this, h)} onSelect={this._selectModule.bind(this, h)}
onChange={this.props.onChange}
selected={currentMenu == h} selected={currentMenu == h}
drag={this._drag.bind(this, h)} drag={this._drag.bind(this, h)}
dragOver={this._dragOverSlot.bind(this, h)} dragOver={this._dragOverSlot.bind(this, h)}

View File

@@ -80,41 +80,48 @@ export const terms = {
ul: 'Burst Laser', ul: 'Burst Laser',
ws: 'Frame Shift Wake Scanner', ws: 'Frame Shift Wake Scanner',
// Items on the outfitting page
// Notification of restricted slot for Orca/Beluga
emptyrestricted: 'empty (restricted)',
// 'ammo' was overloaded for outfitting page and modul info, so changed to ammunition for outfitting page
ammunition: 'Ammo',
// Modifications // Modifications
mass: 'Mass', ammo: 'Ammunition maximum',
integrity: 'Integrity', armourpen: 'Armour penetration',
pGen: 'Power generation', boot: 'Boot time',
brokenregen: 'Broken regeneration rate',
burst: 'Burst',
clip: 'Ammunition clip',
damage: 'Damage',
delay: 'Delay',
dps: 'Damage per second',
distdraw: 'Distributor draw',
duration: 'Duration',
eff: 'Efficiency', eff: 'Efficiency',
power: 'Power draw', engcap: 'Engines capacity',
engrate: 'Engines recharge rate',
eps: 'Energy per second',
explres: 'Explosive resistance',
integrity: 'Integrity',
jitter: 'Jitter',
kinres: 'Kinetic resistance',
maxfuel: 'Maximum fuel per jump',
mass: 'Mass',
optmass: 'Optimal mass', optmass: 'Optimal mass',
optmul: 'Optimal multiplier', optmul: 'Optimal multiplier',
dps: 'Damage per second', pGen: 'Power generation',
eps: 'Energy per second', power: 'Power draw',
thermload: 'Thermal load',
boot: 'Boot time',
maxfuel: 'Maximum fuel per jump',
syscap: 'Systems capacity',
engcap: 'Engines capacity',
wepcap: 'Weapons capacity',
sysrate: 'Systems recharge rate',
engrate: 'Engines recharge rate',
weprate: 'Weapons recharge rate',
kinres: 'Kinetic resistance',
thermres: 'Thermal resistance',
explres: 'Explosive resistance',
regen: 'Regeneration rate',
brokenregen: 'Broken regeneration rate',
delay: 'Delay',
duration: 'Duration',
shield: 'Shield',
shieldboost: 'Shield boost',
distdraw: 'Distributor draw',
damage: 'Damage',
armourpen: 'Armour penetration',
range: 'Range', range: 'Range',
regen: 'Regeneration rate',
reload: 'Reload time',
rof: 'Rate of fire', rof: 'Rate of fire',
clip: 'Ammunition clip', shield: 'Shield',
ammo: 'Ammunition maximum', shieldmul: 'Shield boost',
jitter: 'Jitter', syscap: 'Systems capacity',
reload: 'Reload time' sysrate: 'Systems recharge rate',
thermload: 'Thermal load',
thermres: 'Thermal resistance',
wepcap: 'Weapons capacity',
weprate: 'Weapons recharge rate',
}; };

View File

@@ -60,11 +60,8 @@ export function shieldStrength(mass, baseShield, sg, multiplier) {
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 ynorm = Math.pow(xnorm, exponent);
let mul = minMul + ynorm * (maxMul - minMul); let mul = minMul + ynorm * (maxMul - minMul);
let strength = baseShield * mul;
// TODO handle multiplier return baseShield * mul * multiplier;
return strength;
} }
/** /**

View File

@@ -32,7 +32,7 @@ export default class Module {
* @return {Number} The value of the modification, as a decimal value from -1 to 1 * @return {Number} The value of the modification, as a decimal value from -1 to 1
*/ */
getModValue(name) { getModValue(name) {
return this.mods ? this.mods[name] / 10000 : null; return this.mods && this.mods[name] ? this.mods[name] / 10000 : null;
} }
/** /**
@@ -390,4 +390,72 @@ export default class Module {
} }
return result; return result;
} }
/**
* Get the shield multiplier for this module, taking in to account modifications
* @return {Number} the shield multiplier of this module
*/
getShieldMul() {
return this._getModifiedValue('shieldmul');
}
/**
* Get the DPS for this module, taking in to account modifications
* @return {Number} the DPS of this module
*/
getDps() {
// TODO this is not correct; need to include other factors such as rate of fire, damage, etc.
return this._getModifiedValue('dps');
}
/**
* Get the heat generated per second for this module, taking in to account modifications
* @return {Number} the heat generated per second of this module
*/
getHps() {
// TODO this is not correct; need to include other factors such as rate of fire, damage, etc.
return this._getModifiedValue('hps');
}
/**
* Get the energy used per second for this module, taking in to account modifications
* @return {Number} the energy used per second of this module
*/
getEps() {
// TODO this is not correct; need to include other factors such as rate of fire, damage, etc.
return this._getModifiedValue('eps');
}
/**
* Get the clip size for this module, taking in to account modifications
* @return {Number} the clip size of this module
*/
getClip() {
return this._getModifiedValue('clip');
}
/**
* Get the ammo size for this module, taking in to account modifications
* @return {Number} the ammo size of this module
*/
getAmmo() {
return this._getModifiedValue('ammo');
}
/**
* Get the reload time for this module, taking in to account modifications
* @return {Number} the reload time of this module
*/
getReload() {
return this._getModifiedValue('reload');
}
/**
* Get the rate of fire for this module, taking in to account modifications
* @return {Number} the rate of fire for this module
*/
getRoF() {
return this._getModifiedValue('rof');
}
} }

View File

@@ -126,7 +126,7 @@ export default class ModuleSet {
let pd = this.standard[4][0]; let pd = this.standard[4][0];
for (let p of this.standard[4]) { for (let p of this.standard[4]) {
if (p.mass < pd.mass && p.getEnginesCapacity() >= boostEnergy) { if (p.mass < pd.mass && p.engcap >= boostEnergy) {
pd = p; pd = p;
} }
} }

View File

@@ -441,6 +441,9 @@ export default class Ship {
// Could be for either thrusters or FSD // Could be for either thrusters or FSD
this.updateTopSpeed(); this.updateTopSpeed();
this.updateJumpStats(); this.updateJumpStats();
} else if (name == 'shieldmul') {
m.setModValue(name, value);
this.updateShieldStrength();
} else { } else {
// Generic // Generic
m.setModValue(name, value); m.setModValue(name, value);
@@ -686,7 +689,7 @@ export default class Ship {
if (ModuleUtils.isShieldGenerator(slot.m.grp)) { if (ModuleUtils.isShieldGenerator(slot.m.grp)) {
this.updateShieldStrength(); this.updateShieldStrength();
} else if (slot.m.grp == 'sb') { } else if (slot.m.grp == 'sb') {
this.shieldMultiplier += slot.m.shieldmul * (enabled ? 1 : -1); this.shieldMultiplier += slot.m.getShieldMul() * (enabled ? 1 : -1);
this.updateShieldStrength(); this.updateShieldStrength();
} }
if (slot.m.dps) { if (slot.m.dps) {
@@ -752,7 +755,7 @@ export default class Ship {
this.armourAdded -= old.armouradd; this.armourAdded -= old.armouradd;
break; break;
case 'sb': case 'sb':
this.shieldMultiplier -= slot.enabled ? old.shieldmul : 0; this.shieldMultiplier -= slot.enabled ? old.getShieldMul() : 0;
break; break;
} }
@@ -794,7 +797,7 @@ export default class Ship {
this.armourAdded += n.armouradd; this.armourAdded += n.armouradd;
break; break;
case 'sb': case 'sb':
this.shieldMultiplier += slot.enabled ? n.shieldmul : 0; this.shieldMultiplier += slot.enabled ? n.getShieldMul() : 0;
break; break;
} }