mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-11 16:53:02 +00:00
Merge branch 'release/2.2.0' into develop
This commit is contained in:
@@ -108,7 +108,8 @@ describe('Import Modal', function() {
|
|||||||
it('catches an invalid backup', function() {
|
it('catches an invalid backup', function() {
|
||||||
const importData = require('./fixtures/valid-backup');
|
const importData = require('./fixtures/valid-backup');
|
||||||
let invalidImportData = Object.assign({}, importData);
|
let invalidImportData = Object.assign({}, importData);
|
||||||
invalidImportData.builds.asp = null; // Remove Asp Miner build used in comparison
|
//invalidImportData.builds.asp = null; // Remove Asp Miner build used in comparison
|
||||||
|
delete(invalidImportData.builds.asp);
|
||||||
|
|
||||||
pasteText('"this is not valid"');
|
pasteText('"this is not valid"');
|
||||||
expect(modal.state.importValid).toBeFalsy();
|
expect(modal.state.importValid).toBeFalsy();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ describe("Ship", function() {
|
|||||||
ship.buildWith(shipData.defaults);
|
ship.buildWith(shipData.defaults);
|
||||||
|
|
||||||
expect(ship.totalCost).toEqual(shipData.retailCost, s + ' retail cost does not match default build cost');
|
expect(ship.totalCost).toEqual(shipData.retailCost, s + ' retail cost does not match default build cost');
|
||||||
expect(ship.cargoCapacity).toBeDefined(s + ' cargo');
|
expect(ship.cargoCapacity).toBeDefined();
|
||||||
expect(ship.priorityBands[0].retracted).toBeGreaterThan(0, s + ' priorityBands');
|
expect(ship.priorityBands[0].retracted).toBeGreaterThan(0, s + ' priorityBands');
|
||||||
expect(ship.powerAvailable).toBeGreaterThan(0, s + ' powerAvailable');
|
expect(ship.powerAvailable).toBeGreaterThan(0, s + ' powerAvailable');
|
||||||
expect(ship.unladenRange).toBeGreaterThan(0, s + ' unladenRange');
|
expect(ship.unladenRange).toBeGreaterThan(0, s + ' unladenRange');
|
||||||
|
|||||||
15
package.json
15
package.json
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "coriolis_shipyard",
|
"name": "coriolis_shipyard",
|
||||||
"version": "2.1.2",
|
"version": "2.2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/cmmcleod/coriolis"
|
"url": "https://github.com/EDCD/coriolis"
|
||||||
},
|
},
|
||||||
"homepage": "https://coriolis.io",
|
"homepage": "https://coriolis.edcd.io",
|
||||||
"bugs": "https://github.com/cmmcleod/coriolis/issues",
|
"bugs": "https://github.com/EDCD/coriolis/issues",
|
||||||
"private": true,
|
"private": true,
|
||||||
"engine": "node >= 4.0.0",
|
"engine": "node >= 4.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -24,14 +24,13 @@
|
|||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
|
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
|
||||||
"testFileExtensions": [
|
"testRegex": "(/__tests__/test-.*|\\.(test|spec))\\.js$",
|
||||||
"js"
|
|
||||||
],
|
|
||||||
"moduleFileExtensions": [
|
"moduleFileExtensions": [
|
||||||
"js",
|
"js",
|
||||||
"json",
|
"json",
|
||||||
"jsx"
|
"jsx"
|
||||||
],
|
],
|
||||||
|
"automock": true,
|
||||||
"unmockedModulePathPatterns": [
|
"unmockedModulePathPatterns": [
|
||||||
"<rootDir>/node_modules/react",
|
"<rootDir>/node_modules/react",
|
||||||
"<rootDir>/node_modules/react-dom",
|
"<rootDir>/node_modules/react-dom",
|
||||||
@@ -68,7 +67,7 @@
|
|||||||
"extract-text-webpack-plugin": "^0.9.1",
|
"extract-text-webpack-plugin": "^0.9.1",
|
||||||
"file-loader": "^0.8.4",
|
"file-loader": "^0.8.4",
|
||||||
"html-webpack-plugin": "^1.7.0",
|
"html-webpack-plugin": "^1.7.0",
|
||||||
"jest-cli": "^0.9.2",
|
"jest-cli": "^16.0.1",
|
||||||
"jsen": "^0.6.0",
|
"jsen": "^0.6.0",
|
||||||
"json-loader": "^0.5.3",
|
"json-loader": "^0.5.3",
|
||||||
"less": "^2.5.3",
|
"less": "^2.5.3",
|
||||||
|
|||||||
@@ -606,6 +606,7 @@ export default class CostSection extends TranslatedComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nextProps.ship != this.props.ship || nextProps.code != this.props.code) {
|
if (nextProps.ship != this.props.ship || nextProps.code != this.props.code) {
|
||||||
|
nextProps.ship.applyDiscounts(Persist.getShipDiscount(), Persist.getModuleDiscount());
|
||||||
this._updateAmmoCosts(nextProps.ship);
|
this._updateAmmoCosts(nextProps.ship);
|
||||||
this._updateRetrofit(nextProps.ship, retrofitShip);
|
this._updateRetrofit(nextProps.ship, retrofitShip);
|
||||||
this._sortCost(nextProps.ship);
|
this._sortCost(nextProps.ship);
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ export default class HardpointSlot extends Slot {
|
|||||||
{m.mount && m.mount == 'T' ? <MountTurret /> : ''}
|
{m.mount && m.mount == 'T' ? <MountTurret /> : ''}
|
||||||
{m.type && m.type == 'K' ? <DamageKinetic /> : ''}
|
{m.type && m.type == 'K' ? <DamageKinetic /> : ''}
|
||||||
{m.type && m.type == 'T' ? <DamageThermal /> : ''}
|
{m.type && m.type == 'T' ? <DamageThermal /> : ''}
|
||||||
{m.type && m.type == 'KT' ? <span><DamageKinetic /><DamageThermal /></span>: ''}
|
{m.type && m.type == 'KT' ? <span><DamageKinetic /><DamageThermal /></span> : ''}
|
||||||
{m.type && m.type == 'E' ? <DamageExplosive />: ''}
|
{m.type && m.type == 'E' ? <DamageExplosive /> : ''}
|
||||||
{classRating} {translate(m.name || m.grp)}</div>
|
{classRating} {translate(m.name || m.grp)}</div>
|
||||||
<div className={'r'}>{m.mass}{u.T}</div>
|
<div className={'r'}>{m.mass}{u.T}</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -56,7 +56,7 @@ export default class HardpointSlot extends Slot {
|
|||||||
{ 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.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.dps && m.eps ? <div className={'l'}>{translate('DPE')}: {formats.round1(m.dps / m.eps)}</div> : null }
|
{ m.dps && m.eps ? <div className={'l'}>{translate('DPE')}: {formats.round1(m.dps / m.eps)}</div> : null }
|
||||||
{ m.rof ? <div className={'l'}>{translate('ROF')}: {m.rof}{u.ps}</div> : null }
|
{ m.rof ? <div className={'l'}>{translate('ROF')}: {m.rof}{u.ps}</div> : null }
|
||||||
{ m.range && !m.dps ? <div className={'l'}>{translate('Range')}: {formats.round(m.range/1000)}{u.km}</div> : null }
|
{ m.range && !m.dps ? <div className={'l'}>{translate('Range')} : {formats.round(m.range / 1000)}{u.km}</div> : null }
|
||||||
{ m.shieldmul ? <div className={'l'}>+{formats.rPct(m.shieldmul)}</div> : null }
|
{ m.shieldmul ? <div className={'l'}>+{formats.rPct(m.shieldmul)}</div> : null }
|
||||||
{ m.ammo >= 0 ? <div className={'l'}>{translate('ammo')}: {formats.int(m.clip)}/{formats.int(m.ammo)}</div> : null }
|
{ m.ammo >= 0 ? <div className={'l'}>{translate('ammo')}: {formats.int(m.clip)}/{formats.int(m.ammo)}</div> : null }
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,6 +6,29 @@ import LZString from 'lz-string';
|
|||||||
|
|
||||||
const STANDARD = ['powerPlant', 'thrusters', 'frameShiftDrive', 'lifeSupport', 'powerDistributor', 'sensors', 'fuelTank'];
|
const STANDARD = ['powerPlant', 'thrusters', 'frameShiftDrive', 'lifeSupport', 'powerDistributor', 'sensors', 'fuelTank'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates ship-loadout JSON Schema standard object
|
||||||
|
* @param {Object} standard model
|
||||||
|
* @return {Object} JSON Schema
|
||||||
|
*/
|
||||||
|
function standardToSchema(standard) {
|
||||||
|
if (standard.m) {
|
||||||
|
let o = {
|
||||||
|
class: standard.m.class,
|
||||||
|
rating: standard.m.rating,
|
||||||
|
enabled: Boolean(standard.enabled),
|
||||||
|
priority: standard.priority + 1
|
||||||
|
};
|
||||||
|
|
||||||
|
if (standard.m.name) {
|
||||||
|
o.name = standard.m.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates ship-loadout JSON Schema slot object
|
* Generates ship-loadout JSON Schema slot object
|
||||||
* @param {Object} slot Slot model
|
* @param {Object} slot Slot model
|
||||||
@@ -61,13 +84,13 @@ export function toDetailedBuild(buildName, ship) {
|
|||||||
standard: {
|
standard: {
|
||||||
bulkheads: BulkheadNames[ship.bulkheads.m.index],
|
bulkheads: BulkheadNames[ship.bulkheads.m.index],
|
||||||
cargoHatch: { enabled: Boolean(ship.cargoHatch.enabled), priority: ship.cargoHatch.priority + 1 },
|
cargoHatch: { enabled: Boolean(ship.cargoHatch.enabled), priority: ship.cargoHatch.priority + 1 },
|
||||||
powerPlant: { class: standard[0].m.class, rating: standard[0].m.rating, enabled: Boolean(standard[0].enabled), priority: standard[0].priority + 1 },
|
powerPlant: standardToSchema(standard[0]),
|
||||||
thrusters: { class: standard[1].m.class, rating: standard[1].m.rating, enabled: Boolean(standard[1].enabled), priority: standard[1].priority + 1 },
|
thrusters: standardToSchema(standard[1]),
|
||||||
frameShiftDrive: { class: standard[2].m.class, rating: standard[2].m.rating, enabled: Boolean(standard[2].enabled), priority: standard[2].priority + 1 },
|
frameShiftDrive: standardToSchema(standard[2]),
|
||||||
lifeSupport: { class: standard[3].m.class, rating: standard[3].m.rating, enabled: Boolean(standard[3].enabled), priority: standard[3].priority + 1 },
|
lifeSupport: standardToSchema(standard[3]),
|
||||||
powerDistributor: { class: standard[4].m.class, rating: standard[4].m.rating, enabled: Boolean(standard[4].enabled), priority: standard[4].priority + 1 },
|
powerDistributor: standardToSchema(standard[4]),
|
||||||
sensors: { class: standard[5].m.class, rating: standard[5].m.rating, enabled: Boolean(standard[5].enabled), priority: standard[5].priority + 1 },
|
sensors: standardToSchema(standard[5]),
|
||||||
fuelTank: { class: standard[6].m.class, rating: standard[6].m.rating, enabled: Boolean(standard[6].enabled), priority: standard[6].priority + 1 }
|
fuelTank: standardToSchema(standard[6])
|
||||||
},
|
},
|
||||||
hardpoints: hardpoints.filter(slot => slot.maxClass > 0).map(slotToSchema),
|
hardpoints: hardpoints.filter(slot => slot.maxClass > 0).map(slotToSchema),
|
||||||
utility: hardpoints.filter(slot => slot.maxClass === 0).map(slotToSchema),
|
utility: hardpoints.filter(slot => slot.maxClass === 0).map(slotToSchema),
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ import Persist from '../stores/Persist';
|
|||||||
* @return {Boolean} True if the slot can mount the module
|
* @return {Boolean} True if the slot can mount the module
|
||||||
*/
|
*/
|
||||||
export function canMount(ship, slot, group, clazz) {
|
export function canMount(ship, slot, group, clazz) {
|
||||||
if (slot
|
if (slot &&
|
||||||
&& (!slot.eligible || slot.eligible[group])
|
(!slot.eligible || slot.eligible[group]) &&
|
||||||
&& (group != 'pcq' || (ship.luxuryCabins && ship.luxuryCabins === true))
|
(group != 'pcq' || (ship.luxuryCabins && ship.luxuryCabins === true)) &&
|
||||||
&& (group != 'fh' || (ship.fighterHangars && ship.fighterHangars === true))
|
(group != 'fh' || (ship.fighterHangars && ship.fighterHangars === true)) &&
|
||||||
&& (clazz === undefined || slot.maxClass >= clazz)) {
|
(clazz === undefined || slot.maxClass >= clazz)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -76,7 +76,11 @@
|
|||||||
"class": { "type": "integer", "minimum": 2, "maximum": 8 },
|
"class": { "type": "integer", "minimum": 2, "maximum": 8 },
|
||||||
"rating": { "$ref": "#/definitions/standardRatings" },
|
"rating": { "$ref": "#/definitions/standardRatings" },
|
||||||
"enabled": { "type": "boolean" },
|
"enabled": { "type": "boolean" },
|
||||||
"priority": { "type": "integer", "minimum": 1, "maximum": 5 }
|
"priority": { "type": "integer", "minimum": 1, "maximum": 5 },
|
||||||
|
"name": {
|
||||||
|
"description": "The name identifing the thrusters (if applicable), e.g. 'Enhanced Performance'",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"frameShiftDrive": {
|
"frameShiftDrive": {
|
||||||
|
|||||||
Reference in New Issue
Block a user