Skip to content

Commit

Permalink
Merge branch 'release/2.2.19'
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdrmcdonald committed Feb 26, 2017
2 parents a0e8f19 + f4e5254 commit fac279d
Show file tree
Hide file tree
Showing 15 changed files with 545 additions and 286 deletions.
9 changes: 9 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
#2.2.19
* Power management panel now displays modules in descending order of power usage by default
* Shot speed can no longer be modified directly. Its value is derived from the range modifier for Long Range and Focused modifications
* Ensure that jump range chart updates when fuel slider is changed
* Add 'Engine profile' and 'FSD profile' charts. These show how your maximum speed/jump range will alter as you alter the mass of your build
* Use coriolis-data 2.2.19:
* Remove shot speed modification - it is directly tied to range
* Fix incorrect minimal mass for 3C bi-weave shield generator

#2.2.18
* Change methodology for calculating explorer role; can result in lighter builds
* Tidy up layout for module selection and lay everything out in a consistent best-to-worst for both class and grade
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coriolis_shipyard",
"version": "2.2.18",
"version": "2.2.19",
"repository": {
"type": "git",
"url": "https://github.com/EDCD/coriolis"
Expand All @@ -19,7 +19,7 @@
"test": "jest",
"prod-serve": "nginx -p $(pwd) -c nginx.conf",
"prod-stop": "kill -QUIT $(cat nginx.pid)",
"build": "npm run clean && NODE_ENV=production webpack -d -p --config webpack.config.prod.js",
"build": "npm run clean && NODE_ENV=production webpack -p --config webpack.config.prod.js",
"rsync": "rsync -ae \"ssh -i $CORIOLIS_PEM\" --delete build/ $CORIOLIS_USER@$CORIOLIS_HOST:~/wwws",
"deploy": "npm run lint && npm test && npm run build && npm run rsync"
},
Expand Down Expand Up @@ -54,7 +54,7 @@
]
},
"devDependencies": {
"appcache-webpack-plugin": "^1.2.1",
"appcache-webpack-plugin": "^1.3.0",
"babel-core": "*",
"babel-eslint": "*",
"babel-jest": "*",
Expand All @@ -68,9 +68,9 @@
"eslint-plugin-react": "^4.0.0",
"expose-loader": "^0.7.1",
"express": "^4.13.3",
"extract-text-webpack-plugin": "^0.9.1",
"extract-text-webpack-plugin": "2.0.0",
"file-loader": "^0.8.4",
"html-webpack-plugin": "^1.7.0",
"html-webpack-plugin": "^2.28.0",
"jest-cli": "^16.0.1",
"jsen": "^0.6.0",
"json-loader": "^0.5.3",
Expand All @@ -83,8 +83,8 @@
"rollup-plugin-node-resolve": "2",
"style-loader": "^0.13.0",
"url-loader": "^0.5.6",
"webpack": "^1.9.6",
"webpack-dev-server": "^1.14.0"
"webpack": "^2.2.1",
"webpack-dev-server": "^2.4.1"
},
"dependencies": {
"babel-polyfill": "*",
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/DamageDealt.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ export default class DamageDealt extends TranslatedComponent {
const sortOrder = this._sortOrder;
const onCollapseExpand = this._onCollapseExpand;

const code = ship.getHardpointsString() + '.' + ship.getModificationsString() + '.' + against.properties.name;
const code = ship.getHardpointsString() + '.' + ship.getModificationsString() + '.' + ship.getPowerEnabledString() + '.' + against.properties.name;

return (
<span>
Expand Down
150 changes: 150 additions & 0 deletions src/app/components/EngineProfile.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import React from 'react';
import TranslatedComponent from './TranslatedComponent';
import { Ships } from 'coriolis-data/dist';
import ShipSelector from './ShipSelector';
import { nameComparator } from '../utils/SlotFunctions';
import LineChart from '../components/LineChart';
import Slider from '../components/Slider';
import * as ModuleUtils from '../shipyard/ModuleUtils';
import Module from '../shipyard/Module';
import * as Calc from '../shipyard/Calculations';

/**
* Engine profile for a given ship
*/
export default class EngineProfile extends TranslatedComponent {
static PropTypes = {
ship: React.PropTypes.object.isRequired,
chartWidth: React.PropTypes.number.isRequired,
code: React.PropTypes.string.isRequired
};

/**
* Constructor
* @param {Object} props React Component properties
* @param {Object} context React Component context
*/
constructor(props, context) {
super(props);

const ship = this.props.ship;

this.state = {
cargo: ship.cargoCapacity,
calcMaxSpeedFunc: this._calcMaxSpeed.bind(this, ship)
};
}

/**
* Update the state if our ship changes
* @param {Object} nextProps Incoming/Next properties
* @param {Object} nextContext Incoming/Next conext
* @return {boolean} Returns true if the component should be rerendered
*/
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.code != this.props.code) {
this.setState({ cargo: nextProps.ship.cargoCapacity, calcMaxSpeedFunc: this._calcMaxSpeed.bind(this, nextProps.ship) });
}
return true;
}

/**
* Calculate the maximum speed for this ship across its applicable mass
* @param {Object} ship The ship
* @param {Object} mass The mass at which to calculate the top speed
* @return {number} The maximum speed
*/
_calcMaxSpeed(ship, mass) {
// Obtain the thrusters for this ship
const thrusters = ship.standard[1].m;

// Obtain the top speed
return Calc.speed(mass, ship.speed, thrusters, ship.engpip)[4];
}

/**
* Update cargo level
* @param {number} cargoLevel Cargo level 0 - 1
*/
_cargoChange(cargoLevel) {
let ship = this.props.ship;
let cargo = Math.round(ship.cargoCapacity * cargoLevel);
this.setState({
cargo
});
}

/**
* Render engine profile
* @return {React.Component} contents
*/
render() {
const { language, onWindowResize, sizeRatio, tooltip, termtip } = this.context;
const { formats, translate, units } = language;
const { ship } = this.props;
const { cargo } = this.state;

// Calculate bounds for our line chart
const thrusters = ship.standard[1].m;
const minMass = thrusters.getMinMass();
const maxMass = thrusters.getMaxMass();
const minSpeed = Calc.speed(maxMass, ship.speed, thrusters, ship.engpip)[4];
const maxSpeed = Calc.speed(minMass, ship.speed, thrusters, ship.engpip)[4];
let mass = ship.unladenMass + ship.fuelCapacity + cargo;
let mark;
if (mass < minMass) {
mark = minMass;
} else if (mass > maxMass) {
mark = maxMass;
} else {
mark = mass;
}

const cargoPercent = cargo / ship.cargoCapacity;

const code = ship.toString() + '.' + ship.getModificationsString() + '.' + ship.getPowerEnabledString();

// This graph has a precipitous fall-off so we use lots of points to make it look a little smoother
return (
<span>
<h1>{translate('engine profile')}</h1>
<LineChart
width={this.props.chartWidth}
xMin={minMass}
xMax={maxMass}
yMin={minSpeed}
yMax={maxSpeed}
xMark={mark}
xLabel={translate('mass')}
xUnit={translate('T')}
yLabel={translate('maximum speed')}
yUnit={translate('m/s')}
func={this.state.calcMaxSpeedFunc}
points={1000}
code={code}
/>
{ship.cargoCapacity ?
<span>
<h3>{translate('cargo carried')}: {formats.int(cargo)}{units.T}</h3>
<table style={{ width: '100%', lineHeight: '1em', backgroundColor: 'transparent' }}>
<tbody >
<tr>
<td>
<Slider
axis={true}
onChange={this._cargoChange.bind(this)}
axisUnit={translate('T')}
percent={cargoPercent}
max={ship.cargoCapacity}
scale={sizeRatio}
onResize={onWindowResize}
/>
</td>
</tr>
</tbody>
</table>
</span> : '' }
</span>
);
}
}
151 changes: 151 additions & 0 deletions src/app/components/FSDProfile.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import React from 'react';
import TranslatedComponent from './TranslatedComponent';
import { Ships } from 'coriolis-data/dist';
import ShipSelector from './ShipSelector';
import { nameComparator } from '../utils/SlotFunctions';
import LineChart from '../components/LineChart';
import Slider from '../components/Slider';
import * as ModuleUtils from '../shipyard/ModuleUtils';
import Module from '../shipyard/Module';
import * as Calc from '../shipyard/Calculations';

/**
* FSD profile for a given ship
*/
export default class FSDProfile extends TranslatedComponent {
static PropTypes = {
ship: React.PropTypes.object.isRequired,
chartWidth: React.PropTypes.number.isRequired,
code: React.PropTypes.string.isRequired
};

/**
* Constructor
* @param {Object} props React Component properties
* @param {Object} context React Component context
*/
constructor(props, context) {
super(props);

const ship = this.props.ship;

this.state = {
cargo: ship.cargoCapacity,
calcMaxRangeFunc: this._calcMaxRange.bind(this, ship)
};
}

/**
* Update the state if our ship changes
* @param {Object} nextProps Incoming/Next properties
* @param {Object} nextContext Incoming/Next conext
* @return {boolean} Returns true if the component should be rerendered
*/
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.code != this.props.code) {
this.setState({ cargo: nextProps.ship.cargoCapacity, calcMaxRangeFunc: this._calcMaxRange.bind(this, nextProps.ship) });
}
return true;
}

/**
* Calculate the maximum range for this ship across its applicable mass
* @param {Object} ship The ship
* @param {Object} mass The mass at which to calculate the maximum range
* @return {number} The maximum range
*/
_calcMaxRange(ship, mass) {
// Obtain the FSD for this ship
const fsd = ship.standard[2].m;

// Obtain the maximum range
return Calc.jumpRange(mass, fsd, fsd.getMaxFuelPerJump());
}

/**
* Update cargo level
* @param {number} cargoLevel Cargo level 0 - 1
*/
_cargoChange(cargoLevel) {
let ship = this.props.ship;
let cargo = Math.round(ship.cargoCapacity * cargoLevel);
this.setState({
cargo
});
}

/**
* Render engine profile
* @return {React.Component} contents
*/
render() {
const { language, onWindowResize, sizeRatio, tooltip, termtip } = this.context;
const { formats, translate, units } = language;
const { ship } = this.props;
const { cargo } = this.state;


// Calculate bounds for our line chart - use thruster info for X
const thrusters = ship.standard[1].m;
const fsd = ship.standard[2].m;
const minMass = thrusters.getMinMass();
const maxMass = thrusters.getMaxMass();
const minRange = 0;
const maxRange = Calc.jumpRange(minMass + fsd.getMaxFuelPerJump(), fsd, fsd.getMaxFuelPerJump());
let mass = ship.unladenMass + fsd.getMaxFuelPerJump() + cargo;
let mark;
if (mass < minMass) {
mark = minMass;
} else if (mass > maxMass) {
mark = maxMass;
} else {
mark = mass;
}

const cargoPercent = cargo / ship.cargoCapacity;

const code = ship.name + ship.toString() + '.' + ship.getModificationsString() + '.' + ship.getPowerEnabledString();

return (
<span>
<h1>{translate('fsd profile')}</h1>
<LineChart
width={this.props.chartWidth}
xMin={minMass}
xMax={maxMass}
yMin={minRange}
yMax={maxRange}
xMark={mark}
xLabel={translate('mass')}
xUnit={translate('T')}
yLabel={translate('maximum range')}
yUnit={translate('LY')}
func={this.state.calcMaxRangeFunc}
points={200}
code={code}
/>
{ship.cargoCapacity ?
<span>
<h3>{translate('cargo carried')}: {formats.int(cargo)}{units.T}</h3>
<table style={{ width: '100%', lineHeight: '1em', backgroundColor: 'transparent' }}>
<tbody >
<tr>
<td>
<Slider
axis={true}
onChange={this._cargoChange.bind(this)}
axisUnit={translate('T')}
percent={cargoPercent}
max={ship.cargoCapacity}
scale={sizeRatio}
onResize={onWindowResize}
/>
</td>
</tr>
</tbody>
</table>
</span> : '' }
</span>
);
}
}
Loading

0 comments on commit fac279d

Please sign in to comment.