Fix to calculate boost when engcap changes

This commit is contained in:
Cmdr McDonald
2017-03-13 19:55:45 +00:00
parent 0729fc29fa
commit 1605e80884
3 changed files with 7 additions and 1 deletions

View File

@@ -7,6 +7,7 @@
* Fix issue where new module added to a slot did not reset its enabled status
* Show integrity value for relevant modules
* Reset old modification values when a new roll is applied
* Ensure that boost value is set correctly when modifications to power distributor enable/disable boost
#2.2.19
* Power management panel now displays modules in descending order of power usage by default

View File

@@ -5,7 +5,7 @@ import * as d3 from 'd3';
const CORIOLIS_COLOURS = [ '#FF8C0D', '#1FB0FF', '#519032', '#D5420D' ];
const LABEL_COLOUR = '#FFFFFF';
var margin = {top: 10, right: 0, bottom: 0, left: 50};
var margin = {top: 10, right: 0, bottom: 0, left: 55};
const ASPECT = 1;

View File

@@ -553,6 +553,10 @@ export default class Ship {
} else if (name === 'wepcap' || name === 'weprate') {
m.setModValue(name, value, sentfromui);
this.recalculateTtd();
} else if (name === 'engcap') {
m.setModValue(name, value, sentfromui);
// Might have resulted in a change in boostability
this.updateMovement();
} else {
// Generic
m.setModValue(name, value, sentfromui);
@@ -1247,6 +1251,7 @@ export default class Ship {
* @return {this} The ship instance (for chaining operations)
*/
updateMovement() {
console.log('updateMovement()');
this.speeds = Calc.speed(this.unladenMass + this.fuelCapacity, this.speed, this.standard[1].m, this.pipSpeed);
this.topSpeed = this.speeds[4];
this.topBoost = this.canBoost() ? this.speeds[4] * this.boost / this.speed : 0;