mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 06:43:24 +00:00
Calculate top boost speed
This commit is contained in:
@@ -100,11 +100,12 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
|||||||
$scope.speedSeries = {
|
$scope.speedSeries = {
|
||||||
xMin: 0,
|
xMin: 0,
|
||||||
xMax: ship.cargoCapacity,
|
xMax: ship.cargoCapacity,
|
||||||
yMax: calcSpeed(ship.unladenMass, ship.speed, $scope.th.c, ship.pipSpeed)['4 Pips'],
|
yMax: calcSpeed(ship.unladenMass, ship.speed, ship.boost, $scope.th.c, ship.pipSpeed)['boost'],
|
||||||
yMin: 0,
|
yMin: 0,
|
||||||
series: ['4 Pips', '2 Pips', '0 Pips'],
|
series: ['boost', '4 Pips', '2 Pips', '0 Pips'],
|
||||||
|
colors: ['#0088d2', '#ff8c0d', '#D26D00', '#c06400'],
|
||||||
func: function(cargo) { // X Axis is Cargo
|
func: function(cargo) { // X Axis is Cargo
|
||||||
return calcSpeed(ship.unladenMass + $scope.fuel + cargo, ship.speed, $scope.th.c, ship.pipSpeed);
|
return calcSpeed(ship.unladenMass + $scope.fuel + cargo, ship.speed, ship.boost, $scope.th.c, ship.pipSpeed);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$scope.speedChart = {
|
$scope.speedChart = {
|
||||||
@@ -360,7 +361,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
|||||||
$scope.speedSeries.xMax = $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.jrSeries.yMax = ship.unladenRange;
|
||||||
$scope.trSeries.yMax = ship.unladenTotalRange;
|
$scope.trSeries.yMax = ship.unladenTotalRange;
|
||||||
$scope.speedSeries.yMax = calcSpeed(ship.unladenMass, ship.speed, $scope.th.c, ship.pipSpeed)['4 Pips'];
|
$scope.speedSeries.yMax = calcSpeed(ship.unladenMass, ship.speed, ship.boost, $scope.th.c, ship.pipSpeed)['boost'];
|
||||||
updateRetrofitCosts();
|
updateRetrofitCosts();
|
||||||
win.triggerHandler('pwrchange');
|
win.triggerHandler('pwrchange');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -398,7 +398,9 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
|||||||
};
|
};
|
||||||
|
|
||||||
Ship.prototype.updateTopSpeed = function() {
|
Ship.prototype.updateTopSpeed = function() {
|
||||||
this.topSpeed = calcSpeed(this.unladenMass + this.fuelCapacity, this.speed, this.common[1].c, this.pipSpeed)['4 Pips'];
|
var speeds = calcSpeed(this.unladenMass + this.fuelCapacity, this.speed, this.boost, this.common[1].c, this.pipSpeed);
|
||||||
|
this.topSpeed = speeds['4 Pips'];
|
||||||
|
this.topBoost = speeds['boost'];
|
||||||
};
|
};
|
||||||
|
|
||||||
Ship.prototype.updateShieldStrength = function() {
|
Ship.prototype.updateShieldStrength = function() {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ angular.module('shipyard', ['ngLodash'])
|
|||||||
sc: 'Scanner',
|
sc: 'Scanner',
|
||||||
am: 'Auto Field-Maintenance Unit',
|
am: 'Auto Field-Maintenance Unit',
|
||||||
cr: 'Cargo Rack',
|
cr: 'Cargo Rack',
|
||||||
fi: 'FSD Interdictor',
|
fi: 'Frame Shift Drive Interdictor',
|
||||||
hb: 'Hatch Breaker Limpet Controller',
|
hb: 'Hatch Breaker Limpet Controller',
|
||||||
hr: 'Hull Reinforcement Package',
|
hr: 'Hull Reinforcement Package',
|
||||||
rf: 'Refinery',
|
rf: 'Refinery',
|
||||||
@@ -233,16 +233,19 @@ angular.module('shipyard', ['ngLodash'])
|
|||||||
*
|
*
|
||||||
* @param {number} mass Current mass of the ship
|
* @param {number} mass Current mass of the ship
|
||||||
* @param {number} baseSpeed Base speed m/s for ship
|
* @param {number} baseSpeed Base speed m/s for ship
|
||||||
|
* @param {number} baseBoost Base boost speed m/s for ship
|
||||||
* @param {object} thrusters The Thrusters used
|
* @param {object} thrusters The Thrusters used
|
||||||
* @param {number} pipSpeed Speed pip multiplier
|
* @param {number} pipSpeed Speed pip multiplier
|
||||||
* @return {object} Approximate speed by pips
|
* @return {object} Approximate speed by pips
|
||||||
*/
|
*/
|
||||||
.value('calcSpeed', function(mass, baseSpeed, thrusters, pipSpeed) {
|
.value('calcSpeed', function(mass, baseSpeed, baseBoost, thrusters, pipSpeed) {
|
||||||
var speed = baseSpeed * ((1 - thrusters.M) + (thrusters.M * Math.pow(3 - (2 * Math.max(0.5, mass / thrusters.optmass)), thrusters.P)));
|
var multiplier = mass > thrusters.maxmass ? 0 : ((1 - thrusters.M) + (thrusters.M * Math.pow(3 - (2 * Math.max(0.5, mass / thrusters.optmass)), thrusters.P)));
|
||||||
|
var speed = baseSpeed * multiplier;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'0 Pips': speed * (1 - (pipSpeed * 4)),
|
'0 Pips': speed * (1 - (pipSpeed * 4)),
|
||||||
'2 Pips': speed * (1 - (pipSpeed * 2)),
|
'2 Pips': speed * (1 - (pipSpeed * 2)),
|
||||||
'4 Pips': speed
|
'4 Pips': speed,
|
||||||
|
'boost': baseBoost * multiplier
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user