mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 22:33:24 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9009a2a434 | ||
|
|
8b98a98faf | ||
|
|
44de3e4bbc | ||
|
|
ba2e9a12b0 | ||
|
|
57304f55c1 | ||
|
|
1eea358c35 | ||
|
|
f671b7c34f | ||
|
|
211028d80d | ||
|
|
c79359ea2f | ||
|
|
93f92da1df | ||
|
|
25020293ec | ||
|
|
4e7f1d3e8b | ||
|
|
e6ba0a14e8 | ||
|
|
b285a433b2 | ||
|
|
f19c786f64 | ||
|
|
806e545361 | ||
|
|
ae62781d53 | ||
|
|
6fb2247dd7 |
@@ -6,11 +6,11 @@
|
||||
|
||||
The Coriolis project was inspired by [E:D Shipyard](http://www.edshipyard.com/) and, of course, [Elite Dangerous](http://www.elitedangerous.com). The ultimate goal of Coriolis is to provide rich features to support in-game play and planning while engaging the E:D community to support its development.
|
||||
|
||||
Coriolis was created for non-commercial purposes. It is not endorsed by nor reflects the views or opinions of Frontier Developments.
|
||||
Coriolis was created for non-commercial purposes. Coriolis was created using assets and imagery from Elite: Dangerous, with the permission of Frontier Developments plc, for non-commercial purposes. It is not endorsed by nor reflects the views or opinions of Frontier Developments and no employee of Frontier Developments was involved in the making of it.
|
||||
|
||||
## Contributing
|
||||
|
||||
Please [submit issues](https://github.com/cmmcleod/coriolis/issues), or better yet [pull requests](http://www.elitedangerous.com) for any corrections or additions to the database or the code.
|
||||
Please [submit issues](https://github.com/cmmcleod/coriolis/issues), or better yet [pull requests](https://github.com/cmmcleod/coriolis/pulls) for any corrections or additions to the database or the code.
|
||||
|
||||
### Feature Requests, Suggestions & Bugs
|
||||
|
||||
@@ -31,7 +31,8 @@ See [Data wiki](https://github.com/cmmcleod/coriolis/wiki/Database) for details
|
||||
All Data and [associated JSON](https://github.com/cmmcleod/coriolis/tree/master/data) files are intellectual property and copyright of Frontier Developments plc ('Frontier', 'Frontier Developments') and are subject to their
|
||||
[terms and conditions](https://www.frontierstore.net/terms-and-conditions/).
|
||||
|
||||
The code specificially for Coriolis.io is released under the MIT License.
|
||||
The code (Javascript, CSS, HTML, and SVG files only) specificially for Coriolis.io is released under the MIT License.
|
||||
|
||||
Copyright (c) 2015 Coriolis.io, Colin McLeod
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<a href="https://github.com/cmmcleod/coriolis/releases/" target="_blank" title="Coriolis Github Project">Version <%= version %> - <%= date %></a>
|
||||
</div>
|
||||
<div style="max-width:50%" class="l">
|
||||
Coriolis Shipyard was created for non-commercial purposes. It is not endorsed by nor reflects the views or opinions of Frontier Developments.
|
||||
Coriolis was created using assets and imagery from Elite: Dangerous, with the permission of Frontier Developments plc, for non-commercial purposes. It is not endorsed by nor reflects the views or opinions of Frontier Developments and no employee of Frontier Developments was involved in the making of it.
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
@@ -2,7 +2,13 @@ angular.module('app', ['ui.router', 'ct.ui.router.extras.sticky', 'ui.sortable',
|
||||
.run(['$rootScope', '$location', '$window', '$document', '$state', 'commonArray', 'shipPurpose', 'shipSize', 'hardPointClass', 'GroupMap', 'Persist',
|
||||
function($rootScope, $location, $window, $doc, $state, CArr, shipPurpose, sz, hpc, GroupMap, Persist) {
|
||||
// App is running as a standalone web app on tablet/mobile
|
||||
var isStandAlone = $window.navigator.standalone || ($window.external && $window.external.msIsSiteMode && $window.external.msIsSiteMode());
|
||||
var isStandAlone;
|
||||
// This was causing issues on Windows phones ($window.external was causing Angular js to throw an exception). Backup is to try this and set isStandAlone to false if this fails.
|
||||
try {
|
||||
isStandAlone = $window.navigator.standalone || ($window.external && $window.external.msIsSiteMode && $window.external.msIsSiteMode());
|
||||
} catch (ex) {
|
||||
isStandAlone = false;
|
||||
}
|
||||
|
||||
// Redirect any state transition errors to the error controller/state
|
||||
$rootScope.$on('$stateChangeError', function(e, toState, toParams, fromState, fromParams, error) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('app').controller('OutfitController', ['$window', '$rootScope', '$scope', '$state', '$stateParams', 'ShipsDB', 'Ship', 'Components', 'Serializer', 'Persist', 'calcTotalRange', function($window, $rootScope, $scope, $state, $p, Ships, Ship, Components, Serializer, Persist, calcTotalRange) {
|
||||
angular.module('app').controller('OutfitController', ['$window', '$rootScope', '$scope', '$state', '$stateParams', 'ShipsDB', 'Ship', 'Components', 'Serializer', 'Persist', 'calcTotalRange', 'calcSpeed', function($window, $rootScope, $scope, $state, $p, Ships, Ship, Components, Serializer, Persist, calcTotalRange, calcSpeed) {
|
||||
var data = Ships[$p.shipId]; // Retrieve the basic ship properties, slots and defaults
|
||||
var ship = new Ship($p.shipId, data.properties, data.slots); // Create a new Ship instance
|
||||
var win = angular.element($window); // Angularized window object for event triggering
|
||||
@@ -55,8 +55,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
title: 'Jump Range',
|
||||
unit: 'LY'
|
||||
}
|
||||
},
|
||||
watch: $scope.fsd
|
||||
}
|
||||
};
|
||||
|
||||
$scope.trSeries = {
|
||||
@@ -78,8 +77,30 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
title: 'Total Range',
|
||||
unit: 'LY'
|
||||
}
|
||||
},
|
||||
watch: $scope.fsd
|
||||
}
|
||||
};
|
||||
|
||||
$scope.speedSeries = {
|
||||
xMin: 0,
|
||||
xMax: ship.cargoCapacity,
|
||||
yMax: 500,
|
||||
yMin: 0,
|
||||
series: ['speed', 'boost'],
|
||||
func: function(cargo) { // X Axis is Cargo
|
||||
return calcSpeed(ship.unladenMass + $scope.fuel + cargo, ship.speed, ship.boost, $scope.th.c);
|
||||
}
|
||||
};
|
||||
$scope.speedChart = {
|
||||
labels: {
|
||||
xAxis: {
|
||||
title: 'Cargo',
|
||||
unit: 'T'
|
||||
},
|
||||
yAxis: {
|
||||
title: 'Speed',
|
||||
unit: 'm/s'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -122,8 +143,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
ship.useBulkhead(id);
|
||||
}
|
||||
$scope.selectedSlot = null;
|
||||
$scope.code = Serializer.fromShip(ship);
|
||||
updateState();
|
||||
updateState(Serializer.fromShip(ship));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -133,8 +153,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
$scope.reloadBuild = function() {
|
||||
if ($scope.buildName && $scope.savedCode) {
|
||||
Serializer.toShip(ship, $scope.savedCode); // Repopulate with components from last save
|
||||
$scope.code = $scope.savedCode;
|
||||
updateState();
|
||||
updateState($scope.savedCode);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -149,8 +168,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
ship.hardpoints.forEach(function(slot) { ship.use(slot, null, null); });
|
||||
ship.internal.forEach(function(slot) { ship.use(slot, null, null); });
|
||||
ship.useBulkhead(0);
|
||||
$scope.code = Serializer.fromShip(ship);
|
||||
updateState();
|
||||
updateState(Serializer.fromShip(ship));
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -169,7 +187,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
if ($scope.code != $scope.savedCode) {
|
||||
Persist.saveBuild(ship.id, $scope.buildName, $scope.code);
|
||||
$scope.savedCode = $scope.code;
|
||||
updateState();
|
||||
updateState($scope.code);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -218,21 +236,18 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
*/
|
||||
$scope.togglePwr = function(c) {
|
||||
ship.setSlotEnabled(c, !c.enabled);
|
||||
$scope.code = Serializer.fromShip(ship);
|
||||
updateState();
|
||||
updateState(Serializer.fromShip(ship));
|
||||
};
|
||||
|
||||
$scope.incPriority = function(c) {
|
||||
if (ship.changePriority(c, c.priority + 1)) {
|
||||
$scope.code = Serializer.fromShip(ship);
|
||||
updateState();
|
||||
updateState(Serializer.fromShip(ship));
|
||||
}
|
||||
};
|
||||
|
||||
$scope.decPriority = function(c) {
|
||||
if (ship.changePriority(c, c.priority - 1)) {
|
||||
$scope.code = Serializer.fromShip(ship);
|
||||
updateState();
|
||||
updateState(Serializer.fromShip(ship));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -251,9 +266,10 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
|
||||
// Utilify functions
|
||||
|
||||
function updateState() {
|
||||
function updateState(code) {
|
||||
$scope.code = code;
|
||||
$state.go('outfit', { shipId: ship.id, code: $scope.code, bn: $scope.buildName }, { location: 'replace', notify: false });
|
||||
$scope.trSeries.xMax = $scope.jrSeries.xMax = ship.cargoCapacity;
|
||||
$scope.speedSeries.xMax = $scope.trSeries.xMax = $scope.jrSeries.xMax = ship.cargoCapacity;
|
||||
$scope.jrSeries.yMax = ship.unladenRange;
|
||||
$scope.trSeries.yMax = ship.unladenTotalRange;
|
||||
win.triggerHandler('pwrchange');
|
||||
|
||||
190
app/js/directives/directive-line-chart.js
Normal file
190
app/js/directives/directive-line-chart.js
Normal file
@@ -0,0 +1,190 @@
|
||||
angular.module('app').directive('lineChart', ['$window', function($window) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: {
|
||||
config: '=',
|
||||
series: '='
|
||||
},
|
||||
link: function(scope, element) {
|
||||
var seriesConfig = scope.series,
|
||||
series = seriesConfig.series,
|
||||
color = d3.scale.ordinal().range([ '#ff8c0d', '#1fb0ff', '#a05d56', '#d0743c']),
|
||||
config = scope.config,
|
||||
labels = config.labels,
|
||||
margin = { top: 15, right: 15, bottom: 35, left: 60 },
|
||||
fmt = d3.format('.3r'),
|
||||
fmtLong = d3.format('.2f'),
|
||||
func = seriesConfig.func,
|
||||
drag = d3.behavior.drag(),
|
||||
dragging = false,
|
||||
// Define Scales
|
||||
x = d3.scale.linear(),
|
||||
y = d3.scale.linear(),
|
||||
// Define Axes
|
||||
xAxis = d3.svg.axis().scale(x).outerTickSize(0).orient('bottom').tickFormat(d3.format('.2r')),
|
||||
yAxis = d3.svg.axis().scale(y).ticks(6).outerTickSize(0).orient('left').tickFormat(fmt),
|
||||
data = [];
|
||||
|
||||
// Create chart
|
||||
var svg = d3.select(element[0]).append('svg');
|
||||
var vis = svg.append('g').attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
|
||||
var lines = vis.append('g');
|
||||
|
||||
// Define Area
|
||||
var line = d3.svg.line().y(function(d) { return y(d[1]); });
|
||||
|
||||
// Create Y Axis SVG Elements
|
||||
var yTxt = vis.append('g').attr('class', 'y axis')
|
||||
.append('text')
|
||||
.attr('transform', 'rotate(-90)')
|
||||
.attr('y', -50)
|
||||
.attr('dy', '.1em')
|
||||
.style('text-anchor', 'middle')
|
||||
.text(labels.yAxis.title + ' (' + labels.yAxis.unit + ')');
|
||||
// Create X Axis SVG Elements
|
||||
var xLbl = vis.append('g').attr('class', 'x axis');
|
||||
var xTxt = xLbl.append('text')
|
||||
.attr('y', 30)
|
||||
.attr('dy', '.1em')
|
||||
.style('text-anchor', 'middle')
|
||||
.text(labels.xAxis.title + ' (' + labels.xAxis.unit + ')');
|
||||
|
||||
// Create and Add tooltip
|
||||
var tipWidth = (Math.max(labels.yAxis.unit.length, labels.xAxis.unit.length) * 1.25) + 2;
|
||||
var tips = vis.append('g').style('display', 'none');
|
||||
|
||||
var background = vis.append('rect') // Background to capture hover/drag
|
||||
.attr('fill-opacity', 0)
|
||||
.on('mouseover', showTip)
|
||||
.on('mouseout', hideTip)
|
||||
.on('mousemove', moveTip)
|
||||
.call(drag);
|
||||
|
||||
drag
|
||||
.on('dragstart', function() {
|
||||
dragging = true;
|
||||
moveTip.call(this);
|
||||
showTip();
|
||||
})
|
||||
.on('dragend', function() {
|
||||
dragging = false;
|
||||
hideTip();
|
||||
})
|
||||
.on('drag', moveTip);
|
||||
|
||||
/**
|
||||
* Watch for changes in the series data (mass changes, etc)
|
||||
*/
|
||||
scope.$watchCollection('series', render);
|
||||
angular.element($window).bind('orientationchange resize render', render);
|
||||
|
||||
function render() {
|
||||
var width = element[0].parentElement.offsetWidth,
|
||||
height = width * 0.5,
|
||||
xMax = seriesConfig.xMax,
|
||||
xMin = seriesConfig.xMin,
|
||||
yMax = seriesConfig.yMax,
|
||||
yMin = seriesConfig.yMin,
|
||||
w = width - margin.left - margin.right,
|
||||
h = height - margin.top - margin.bottom,
|
||||
s, val, yVal, delta;
|
||||
|
||||
data.length = 0; // Reset Data array
|
||||
|
||||
if (seriesConfig.xMax == seriesConfig.xMin) {
|
||||
line.x(function(d, i) { return i * w; });
|
||||
} else {
|
||||
line.x(function(d) { return x(d[0]); });
|
||||
}
|
||||
|
||||
if (series) {
|
||||
for (s = 0; s < series.length; s++) {
|
||||
data.push([]);
|
||||
}
|
||||
|
||||
if (xMax == xMin) {
|
||||
yVal = func(xMin);
|
||||
for (s = 0; s < series.length; s++) {
|
||||
data[s].push( [ xMin, yVal[ series[s] ] ], [ 1, yVal[ series[s] ] ]);
|
||||
}
|
||||
} else {
|
||||
delta = (xMax - xMin) / 30; // Only render 30 points on the graph
|
||||
for (val = xMin; val <= xMax; val += delta) {
|
||||
yVal = func(val);
|
||||
for (s = 0; s < series.length; s++) {
|
||||
data[s].push([ val, yVal[ series[s] ] ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
var seriesData = [];
|
||||
if (xMax == xMin) {
|
||||
yVal = func(xMin);
|
||||
seriesData.push([ xMin, yVal ], [ 1, yVal ]);
|
||||
} else {
|
||||
delta = (xMax - xMin) / 30; // Only render 30 points on the graph
|
||||
for (val = xMin; val <= xMax; val += delta) {
|
||||
seriesData.push([val, func(val) ]);
|
||||
}
|
||||
}
|
||||
|
||||
data.push(seriesData);
|
||||
}
|
||||
|
||||
// Update Chart Size
|
||||
svg.attr('width', width).attr('height', height);
|
||||
background.attr('height', h).attr('width', w);
|
||||
|
||||
// Update domain and scale for axes
|
||||
x.range([0, w]).domain([xMin, xMax]).clamp(true);
|
||||
xLbl.attr('transform', 'translate(0,' + h + ')');
|
||||
xTxt.attr('x', w / 2);
|
||||
y.range([h, 0]).domain([yMin, yMax]);
|
||||
yTxt.attr('x', -h / 2);
|
||||
vis.selectAll('.y.axis').call(yAxis);
|
||||
vis.selectAll('.x.axis').call(xAxis);
|
||||
|
||||
lines.selectAll('path.line')
|
||||
.data(data)
|
||||
.attr('d', line) // Update existing series
|
||||
.enter() // Add new series
|
||||
.append('path')
|
||||
.attr('class', 'line')
|
||||
.attr('stroke', function(d, i) { return color(i); })
|
||||
.attr('stroke-width', 2)
|
||||
.attr('d', line);
|
||||
|
||||
var tip = tips.selectAll('g.tooltip').data(data).enter().append('g').attr('class', 'tooltip');
|
||||
tip.append('rect').attr('width', tipWidth + 'em').attr('height', '2em').attr('x', '0.5em').attr('y', '-1em').attr('class', 'tip');
|
||||
tip.append('circle').attr('class', 'marker').attr('r', 4);
|
||||
tip.append('text').attr('class', 'label x').attr('y', '-0.25em');
|
||||
tip.append('text').attr('class', 'label y').attr('y', '0.85em');
|
||||
}
|
||||
|
||||
function showTip() {
|
||||
tips.style('display', null);
|
||||
}
|
||||
|
||||
function hideTip() {
|
||||
if (!dragging) {
|
||||
tips.style('display', 'none');
|
||||
}
|
||||
}
|
||||
|
||||
function moveTip() {
|
||||
var xPos = d3.mouse(this)[0], x0 = x.invert(xPos), y0 = func(x0), flip = (x0 / x.domain()[1] > 0.65);
|
||||
var tip = tips.selectAll('g.tooltip').attr('transform', function(d, i) { return 'translate(' + x(x0) + ',' + y(series ? y0[series[i]] : y0) + ')'; });
|
||||
tip.selectAll('rect').attr('x', flip ? (-tipWidth - 0.5) + 'em' : '0.5em').style('text-anchor', flip ? 'end' : 'start');
|
||||
tip.selectAll('text.label').attr('x', flip ? '-1em' : '1em').style('text-anchor', flip ? 'end' : 'start');
|
||||
tip.selectAll('text.label.x').text(fmtLong(x0) + ' ' + labels.xAxis.unit);
|
||||
tips.selectAll('text.label.y').text(function(d, i) { return fmtLong(series ? y0[series[i]] : y0) + ' ' + labels.yAxis.unit; });
|
||||
}
|
||||
|
||||
scope.$on('$destroy', function() {
|
||||
angular.element($window).unbind('orientationchange resize render', render);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
}]);
|
||||
@@ -164,11 +164,11 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
Ship.prototype.use = function(slot, id, component, preventUpdate) {
|
||||
if (slot.id != id) { // Selecting a different component
|
||||
// Slot is an internal slot, is not being emptied, and the selected component group/type must be of unique
|
||||
if (slot.cat != 2 && component && _.includes(['sg', 'rf', 'fs'], component.grp)) {
|
||||
if (slot.cat == 2 && component && _.includes(['sg', 'rf', 'fs'], component.grp)) {
|
||||
// Find another internal slot that already has this type/group installed
|
||||
var similarSlot = this.findInternalByGroup(component.grp);
|
||||
// If another slot has an installed component with of the same type
|
||||
if (similarSlot && similarSlot !== slot) {
|
||||
if (!preventUpdate && similarSlot && similarSlot !== slot) {
|
||||
this.updateStats(similarSlot, null, similarSlot.c, true); // Update stats but don't trigger a global update
|
||||
similarSlot.id = similarSlot.c = null; // Empty the slot
|
||||
}
|
||||
|
||||
@@ -208,9 +208,6 @@ angular.module('shipyard', ['ngLodash'])
|
||||
* @return {number} Approximate shield strengh in MJ
|
||||
*/
|
||||
.value('calcShieldStrength', function(mass, shields, sg, multiplier) {
|
||||
if (!sg) {
|
||||
return 0;
|
||||
}
|
||||
if (mass <= sg.minmass) {
|
||||
return shields * multiplier * sg.minmul;
|
||||
}
|
||||
@@ -221,4 +218,20 @@ angular.module('shipyard', ['ngLodash'])
|
||||
return shields * multiplier * (sg.optmul + (mass - sg.optmass) / (sg.maxmass - sg.optmass) * (sg.maxmul - sg.optmul));
|
||||
}
|
||||
return shields * multiplier * sg.maxmul;
|
||||
})
|
||||
/**
|
||||
* Calculate the a ships speed based on mass, and thrusters. Currently Innacurate / Incomplete :(
|
||||
*
|
||||
* @private
|
||||
* @param {number} mass Current mass of the ship
|
||||
* @param {number} baseSpeed Base speed m/s for ship
|
||||
* @param {number} baseBoost Base boost m/s for ship
|
||||
* @param {object} thrusters The shield generator used
|
||||
* @return {object} Approximate speed and boost speed in m/s
|
||||
*/
|
||||
.value('calcSpeed', function(mass, baseSpeed, baseBoost) { //, thrusters) {
|
||||
//var speed = baseSpeed * (1 + ((thrusters.optmass / mass) * 0.1 ) ); // TODO: find thruser coefficient(s)
|
||||
//var boost = baseBoost * (1 + ((thrusters.optmass / mass) * 0.1 ) );
|
||||
|
||||
return { boost: baseSpeed, speed: baseBoost };
|
||||
});
|
||||
|
||||
@@ -1,3 +1,30 @@
|
||||
.chart {
|
||||
.user-select-none();
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
cursor: default;
|
||||
overflow: hidden;
|
||||
width: 33%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.tablet({
|
||||
width: 50%;
|
||||
});
|
||||
|
||||
.largePhone({
|
||||
width: 100%;
|
||||
});
|
||||
|
||||
h3 {
|
||||
text-align: center;
|
||||
|
||||
&[ng-click] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
svg {
|
||||
|
||||
.axis {
|
||||
|
||||
@@ -39,6 +39,7 @@ header {
|
||||
}
|
||||
|
||||
.smallTablet({
|
||||
position: static;
|
||||
position: initial;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ table.total {
|
||||
width: 100%;
|
||||
});
|
||||
|
||||
&.dbl {
|
||||
&.half {
|
||||
width: 50%;
|
||||
|
||||
.tablet({
|
||||
@@ -166,20 +166,18 @@ table.total {
|
||||
});
|
||||
}
|
||||
|
||||
&.semi {
|
||||
width: 50%;
|
||||
&.third {
|
||||
width: 33%;
|
||||
|
||||
.smallTablet({
|
||||
.axis {
|
||||
font-size: 0.8em;
|
||||
|
||||
.axis.x {
|
||||
g.tick:nth-child(2n + 1) text {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
.medPhone({
|
||||
.largePhone({
|
||||
width: 100% !important;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
border-right: 1px solid @primary-disabled;
|
||||
box-sizing: border-box;
|
||||
padding-top: 0.2em;
|
||||
padding-left: 0.1em;
|
||||
}
|
||||
|
||||
.empty {
|
||||
|
||||
@@ -196,7 +196,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="group dbl" id="componentPriority">
|
||||
<div class="group half" id="componentPriority">
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr class="main">
|
||||
@@ -236,7 +236,7 @@
|
||||
<div style="margin-top: 1em" power-bands bands="priorityBands" available="ship.powerAvailable"></div>
|
||||
</div>
|
||||
|
||||
<div class="group dbl">
|
||||
<div class="group half">
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr class="main">
|
||||
@@ -264,17 +264,24 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="group semi">
|
||||
<div class="group half">
|
||||
<h1>Jump Range</h1>
|
||||
<div class="chart" area-chart config="jrChart" series="jrSeries"></div>
|
||||
<div line-chart config="jrChart" series="jrSeries"></div>
|
||||
</div>
|
||||
|
||||
<div class="group semi">
|
||||
<div class="group half">
|
||||
<h1>Total Range</h1>
|
||||
<div class="chart" area-chart config="trChart" series="trSeries"></div>
|
||||
<div line-chart config="trChart" series="trSeries"></div>
|
||||
</div>
|
||||
|
||||
<div class="group dbl">
|
||||
<!-- TODO: Add back in once calcSpeed is dynamic and accurate
|
||||
<div class="group third">
|
||||
<h1>Thruster Speed</h1>
|
||||
<div line-chart config="speedChart" series="speedSeries"></div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="group half">
|
||||
<div slider max="ship.fuelCapacity" unit="'T'" on-change="::fuelChange(val)" style="position:relative; margin: 0 auto;">
|
||||
<svg class="icon xl primary-disabled" style="position:absolute;height: 100%;"><use xlink:href="#fuel"></use></svg>
|
||||
</div>
|
||||
|
||||
@@ -123,28 +123,28 @@
|
||||
"class": 1,
|
||||
"rating": "I",
|
||||
"cost": 1017200,
|
||||
"mass": 21
|
||||
"mass": 4
|
||||
},
|
||||
{
|
||||
"name": "Military Grade Composite",
|
||||
"class": 1,
|
||||
"rating": "I",
|
||||
"cost": 2288600,
|
||||
"mass": 42
|
||||
"mass": 8
|
||||
},
|
||||
{
|
||||
"name": "Mirrored Surface Composite",
|
||||
"class": 1,
|
||||
"rating": "I",
|
||||
"cost": 5408800,
|
||||
"mass": 42
|
||||
"mass": 8
|
||||
},
|
||||
{
|
||||
"name": "Reactive Surface Composite",
|
||||
"class": 1,
|
||||
"rating": "I",
|
||||
"cost": 5993700,
|
||||
"mass": 42
|
||||
"mass": 8
|
||||
}
|
||||
],
|
||||
"cobra_mk_iii": [
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 320,
|
||||
"agility": 8,
|
||||
"shields": 60,
|
||||
"armour": 90,
|
||||
"armour": 162,
|
||||
"fuelcost": 50,
|
||||
"mass": 35
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 240,
|
||||
"agility": 2,
|
||||
"shields": 350,
|
||||
"armour": 525,
|
||||
"armour": 945,
|
||||
"fuelcost": 50,
|
||||
"mass": 400
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 340,
|
||||
"agility": 6,
|
||||
"shields": 140,
|
||||
"armour": 210,
|
||||
"armour": 378,
|
||||
"fuelcost": 50,
|
||||
"mass": 280
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 400,
|
||||
"agility": 6,
|
||||
"shields": 80,
|
||||
"armour": 120,
|
||||
"armour": 216,
|
||||
"fuelcost": 50,
|
||||
"mass": 180
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 350,
|
||||
"agility": 10,
|
||||
"shields": 60,
|
||||
"armour": 40,
|
||||
"armour": 72,
|
||||
"fuelcost": 50,
|
||||
"mass": 50
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 300,
|
||||
"agility": 0,
|
||||
"shields": 200,
|
||||
"armour": 300,
|
||||
"armour": 540,
|
||||
"fuelcost": 50,
|
||||
"mass": 580
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 350,
|
||||
"agility": 6,
|
||||
"shields": 300,
|
||||
"armour": 225,
|
||||
"armour": 405,
|
||||
"fuelcost": 50,
|
||||
"mass": 250
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 300,
|
||||
"agility": 6,
|
||||
"shields": 50,
|
||||
"armour": 50,
|
||||
"armour": 90,
|
||||
"fuelcost": 50,
|
||||
"mass": 14
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 380,
|
||||
"agility": 2,
|
||||
"shields": 180,
|
||||
"armour": 270,
|
||||
"armour": 486,
|
||||
"fuelcost": 50,
|
||||
"mass": 400
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 380,
|
||||
"agility": 2,
|
||||
"shields": 220,
|
||||
"armour": 220,
|
||||
"armour": 396,
|
||||
"fuelcost": 50,
|
||||
"mass": 580
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 280,
|
||||
"agility": 6,
|
||||
"shields": 260,
|
||||
"armour": 260,
|
||||
"armour": 468,
|
||||
"fuelcost": 50,
|
||||
"mass": 350
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 320,
|
||||
"agility": 8,
|
||||
"shields": 40,
|
||||
"armour": 60,
|
||||
"armour": 108,
|
||||
"fuelcost": 50,
|
||||
"mass": 25
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 350,
|
||||
"agility": 3,
|
||||
"shields": 90,
|
||||
"armour": 90,
|
||||
"armour": 162,
|
||||
"fuelcost": 50,
|
||||
"mass": 155
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 300,
|
||||
"agility": 2,
|
||||
"shields": 120,
|
||||
"armour": 120,
|
||||
"armour": 216,
|
||||
"fuelcost": 50,
|
||||
"mass": 420
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 200,
|
||||
"agility": 0,
|
||||
"shields": 240,
|
||||
"armour": 240,
|
||||
"armour": 432,
|
||||
"fuelcost": 50,
|
||||
"mass": 1000
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 400,
|
||||
"agility": 6,
|
||||
"shields": 105,
|
||||
"armour": 70,
|
||||
"armour": 126,
|
||||
"fuelcost": 50,
|
||||
"mass": 60
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"boost": 340,
|
||||
"agility": 9,
|
||||
"shields": 240,
|
||||
"armour": 160,
|
||||
"armour": 288,
|
||||
"fuelcost": 50,
|
||||
"mass": 230
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "coriolis_shipyard",
|
||||
"version": "0.12.1",
|
||||
"version": "0.13.4",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cmmcleod/coriolis"
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
describe("Ship Factory", function() {
|
||||
|
||||
var Ship;
|
||||
var Components;
|
||||
|
||||
beforeEach(module('shipyard'));
|
||||
beforeEach(inject(['Ship', function (_Ship_) {
|
||||
beforeEach(inject(['Ship', 'Components', function (_Ship_, _Components_) {
|
||||
Ship = _Ship_;
|
||||
Components = _Components_;
|
||||
}]));
|
||||
|
||||
it("can build all ships", function() {
|
||||
@@ -32,39 +34,89 @@ describe("Ship Factory", function() {
|
||||
});
|
||||
|
||||
it("resets and rebuilds properly", function() {
|
||||
var id = 'cobra_mk_iii';
|
||||
var cobra = DB.ships[id];
|
||||
var shipA = new Ship(id, cobra.properties, cobra.slots);
|
||||
var shipB = new Ship(id, cobra.properties, cobra.slots);
|
||||
var testShip = new Ship(id, cobra.properties, cobra.slots);
|
||||
var id = 'cobra_mk_iii';
|
||||
var cobra = DB.ships[id];
|
||||
var shipA = new Ship(id, cobra.properties, cobra.slots);
|
||||
var shipB = new Ship(id, cobra.properties, cobra.slots);
|
||||
var testShip = new Ship(id, cobra.properties, cobra.slots);
|
||||
|
||||
var buildA = cobra.defaults;
|
||||
var buildB = {
|
||||
common:['4A', '4A', '4A', '3D', '3A', '3A', '4C'],
|
||||
hardpoints: ['0s', '0s', '2d', '2d', 0, '04'],
|
||||
internal: ['45', '03', '2b', '2o', '27', '53']
|
||||
};
|
||||
var buildA = cobra.defaults;
|
||||
var buildB = {
|
||||
common:['4A', '4A', '4A', '3D', '3A', '3A', '4C'],
|
||||
hardpoints: ['0s', '0s', '2d', '2d', 0, '04'],
|
||||
internal: ['45', '03', '2b', '2o', '27', '53']
|
||||
};
|
||||
|
||||
shipA.buildWith(buildA); // Build A
|
||||
shipB.buildWith(buildB);// Build B
|
||||
testShip.buildWith(buildA);
|
||||
shipA.buildWith(buildA); // Build A
|
||||
shipB.buildWith(buildB);// Build B
|
||||
testShip.buildWith(buildA);
|
||||
|
||||
for(var p in testShip) {
|
||||
expect(testShip[p]).toEqual(shipA[p], p + ' does not match');
|
||||
}
|
||||
for(var p in testShip) {
|
||||
expect(testShip[p]).toEqual(shipA[p], p + ' does not match');
|
||||
}
|
||||
|
||||
testShip.buildWith(buildB);
|
||||
testShip.buildWith(buildB);
|
||||
|
||||
for(var p in testShip) {
|
||||
expect(testShip[p]).toEqual(shipB[p], p + ' does not match');
|
||||
}
|
||||
for(var p in testShip) {
|
||||
expect(testShip[p]).toEqual(shipB[p], p + ' does not match');
|
||||
}
|
||||
|
||||
testShip.buildWith(buildA);
|
||||
testShip.buildWith(buildA);
|
||||
|
||||
for(var p in testShip) {
|
||||
expect(testShip[p]).toEqual(shipA[p], p + ' does not match');
|
||||
}
|
||||
for(var p in testShip) {
|
||||
expect(testShip[p]).toEqual(shipA[p], p + ' does not match');
|
||||
}
|
||||
});
|
||||
|
||||
it("enforces a single shield generator", function() {
|
||||
var id = 'anaconda';
|
||||
var anacondaData = DB.ships[id];
|
||||
var anaconda = new Ship(id, anacondaData.properties, anacondaData.slots);
|
||||
anaconda.buildWith(anacondaData.defaults);
|
||||
|
||||
expect(anaconda.internal[2].c.grp).toEqual('sg', 'Anaconda default shield generator slot');
|
||||
|
||||
anaconda.use(anaconda.internal[1], '4j', Components.internal('4j')); // 6E Shield Generator
|
||||
|
||||
expect(anaconda.internal[2].c).toEqual(null, 'Anaconda default shield generator slot is empty');
|
||||
expect(anaconda.internal[2].id).toEqual(null, 'Anaconda default shield generator slot id is null');
|
||||
expect(anaconda.internal[1].id).toEqual('4j', 'Slot 1 should have SG 4j in it');
|
||||
expect(anaconda.internal[1].c.grp).toEqual('sg','Slot 1 should have SG 4j in it');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
it("enforces a single shield fuel scoop", function() {
|
||||
var id = 'anaconda';
|
||||
var anacondaData = DB.ships[id];
|
||||
var anaconda = new Ship(id, anacondaData.properties, anacondaData.slots);
|
||||
anaconda.buildWith(anacondaData.defaults);
|
||||
|
||||
anaconda.use(anaconda.internal[4], '32', Components.internal('32')); // 4A Fuel Scoop
|
||||
expect(anaconda.internal[4].c.grp).toEqual('fs', 'Anaconda fuel scoop slot');
|
||||
|
||||
anaconda.use(anaconda.internal[3], '32', Components.internal('32'));
|
||||
|
||||
expect(anaconda.internal[4].c).toEqual(null, 'Anaconda original fuel scoop slot is empty');
|
||||
expect(anaconda.internal[4].id).toEqual(null, 'Anaconda original fuel scoop slot id is null');
|
||||
expect(anaconda.internal[3].id).toEqual('32', 'Slot 1 should have FS 32 in it');
|
||||
expect(anaconda.internal[3].c.grp).toEqual('fs','Slot 1 should have FS 32 in it');
|
||||
});
|
||||
|
||||
it("enforces a single refinery", function() {
|
||||
var id = 'anaconda';
|
||||
var anacondaData = DB.ships[id];
|
||||
var anaconda = new Ship(id, anacondaData.properties, anacondaData.slots);
|
||||
anaconda.buildWith(anacondaData.defaults);
|
||||
|
||||
anaconda.use(anaconda.internal[4], '23', Components.internal('23')); // 4E Refinery
|
||||
expect(anaconda.internal[4].c.grp).toEqual('rf', 'Anaconda refinery slot');
|
||||
|
||||
anaconda.use(anaconda.internal[3], '23', Components.internal('23'));
|
||||
|
||||
expect(anaconda.internal[4].c).toEqual(null, 'Anaconda original refinery slot is empty');
|
||||
expect(anaconda.internal[4].id).toEqual(null, 'Anaconda original refinery slot id is null');
|
||||
expect(anaconda.internal[3].id).toEqual('23', 'Slot 1 should have RF 23 in it');
|
||||
expect(anaconda.internal[3].c.grp).toEqual('rf','Slot 1 should have RF 23 in it');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user